]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] smiapp: Register async subdev
authorSakari Ailus <sakari.ailus@iki.fi>
Sat, 30 Nov 2013 20:51:15 +0000 (17:51 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 23 Dec 2014 13:30:48 +0000 (11:30 -0200)
Register and unregister async sub-device for DT.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/smiapp/smiapp-core.c

index 3d5fba4cc66a11d67e3000c57e30944bd87305b2..2c65ff3ed769945bfcad09de1c732ed0c5f300e5 100644 (file)
@@ -2942,8 +2942,21 @@ static int smiapp_probe(struct i2c_client *client,
        sensor->src->sensor = sensor;
 
        sensor->src->pads[0].flags = MEDIA_PAD_FL_SOURCE;
-       return media_entity_init(&sensor->src->sd.entity, 2,
+       rval = media_entity_init(&sensor->src->sd.entity, 2,
                                 sensor->src->pads, 0);
+       if (rval < 0)
+               return rval;
+
+       rval = v4l2_async_register_subdev(&sensor->src->sd);
+       if (rval < 0)
+               goto out_media_entity_cleanup;
+
+       return 0;
+
+out_media_entity_cleanup:
+       media_entity_cleanup(&sensor->src->sd.entity);
+
+       return rval;
 }
 
 static int smiapp_remove(struct i2c_client *client)
@@ -2952,6 +2965,8 @@ static int smiapp_remove(struct i2c_client *client)
        struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
        unsigned int i;
 
+       v4l2_async_unregister_subdev(subdev);
+
        if (sensor->power_count) {
                if (gpio_is_valid(sensor->platform_data->xshutdown))
                        gpio_set_value(sensor->platform_data->xshutdown, 0);