]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
media: smiapp: Register sensor after enabling runtime PM on the device
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 11 Oct 2019 11:16:02 +0000 (08:16 -0300)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:58:30 +0000 (23:58 -0500)
BugLink: https://bugs.launchpad.net/bugs/1860490
[ Upstream commit 90c9e4a4dba9f4de331372e745fb1991c1faa598 ]

Earlier it was possible that the parts of the driver that assumed runtime
PM was enabled were being called before runtime PM was enabled in the
driver's probe function. So enable runtime PM before registering the
sub-device.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/i2c/smiapp/smiapp-core.c

index 2d78e846d82230fde09f3ff64cd97b3857b22c89..b7889bc2390f3f3d71e4ea9860dcceab6aca612b 100644 (file)
@@ -3102,19 +3102,23 @@ static int smiapp_probe(struct i2c_client *client,
        if (rval < 0)
                goto out_media_entity_cleanup;
 
-       rval = v4l2_async_register_subdev_sensor_common(&sensor->src->sd);
-       if (rval < 0)
-               goto out_media_entity_cleanup;
-
        pm_runtime_set_active(&client->dev);
        pm_runtime_get_noresume(&client->dev);
        pm_runtime_enable(&client->dev);
+
+       rval = v4l2_async_register_subdev_sensor_common(&sensor->src->sd);
+       if (rval < 0)
+               goto out_disable_runtime_pm;
+
        pm_runtime_set_autosuspend_delay(&client->dev, 1000);
        pm_runtime_use_autosuspend(&client->dev);
        pm_runtime_put_autosuspend(&client->dev);
 
        return 0;
 
+out_disable_runtime_pm:
+       pm_runtime_disable(&client->dev);
+
 out_media_entity_cleanup:
        media_entity_cleanup(&sensor->src->sd.entity);