media: ov5670, ov13858: Use pm_runtime_idle
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 20 Jul 2018 20:26:44 +0000 (16:26 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 31 Aug 2018 13:17:08 +0000 (09:17 -0400)
Replace the calls to pm_runtime_get_noresume() and pm_runtime_put() with
pm_runtime_idle() in the driver's probe function. This will have the same
effect with fewer calls. pm_runtime_disable() in remove is sufficient as
the device is already in RPM_SUSPENDED state.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/ov13858.c
drivers/media/i2c/ov5670.c

index a66f6201f53c71e73306ff3d1942d47ba08d6fef..5f601255a296217dcf7ef6b3e7a9d37ec14181e3 100644 (file)
@@ -1735,10 +1735,9 @@ static int ov13858_probe(struct i2c_client *client,
         * Device is already turned on by i2c-core with ACPI domain PM.
         * Enable runtime PM and turn off the device.
         */
-       pm_runtime_get_noresume(&client->dev);
        pm_runtime_set_active(&client->dev);
        pm_runtime_enable(&client->dev);
-       pm_runtime_put(&client->dev);
+       pm_runtime_idle(&client->dev);
 
        return 0;
 
@@ -1761,14 +1760,7 @@ static int ov13858_remove(struct i2c_client *client)
        media_entity_cleanup(&sd->entity);
        ov13858_free_controls(ov13858);
 
-       /*
-        * Disable runtime PM but keep the device turned on.
-        * i2c-core with ACPI domain PM will turn off the device.
-        */
-       pm_runtime_get_sync(&client->dev);
        pm_runtime_disable(&client->dev);
-       pm_runtime_set_suspended(&client->dev);
-       pm_runtime_put_noidle(&client->dev);
 
        return 0;
 }
index 7b7c74d7737075c3e2dd5402342afd08edf40cc7..5ece90e9451adaf171f8d64477ba7915f6572767 100644 (file)
@@ -2504,10 +2504,9 @@ static int ov5670_probe(struct i2c_client *client)
         * Device is already turned on by i2c-core with ACPI domain PM.
         * Enable runtime PM and turn off the device.
         */
-       pm_runtime_get_noresume(&client->dev);
        pm_runtime_set_active(&client->dev);
        pm_runtime_enable(&client->dev);
-       pm_runtime_put(&client->dev);
+       pm_runtime_idle(&client->dev);
 
        return 0;
 
@@ -2536,14 +2535,7 @@ static int ov5670_remove(struct i2c_client *client)
        v4l2_ctrl_handler_free(sd->ctrl_handler);
        mutex_destroy(&ov5670->mutex);
 
-       /*
-        * Disable runtime PM but keep the device turned on.
-        * i2c-core with ACPI domain PM will turn off the device.
-        */
-       pm_runtime_get_sync(&client->dev);
        pm_runtime_disable(&client->dev);
-       pm_runtime_set_suspended(&client->dev);
-       pm_runtime_put_noidle(&client->dev);
 
        return 0;
 }