summaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorTommi Franttila <tommi.franttila@intel.com>2015-11-12 07:01:07 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-11-17 15:04:12 -0200
commit0d51ebd3f41f195e33ed8d9b9d67ed90f6e298ec (patch)
tree0e3bcbaaebf99898f7c39ca005e3953b13c0451e /drivers/media/v4l2-core
parent16dfe72fd879abc98255bbea62fae9d312ef3b5a (diff)
downloadblackbird-op-linux-0d51ebd3f41f195e33ed8d9b9d67ed90f6e298ec.tar.gz
blackbird-op-linux-0d51ebd3f41f195e33ed8d9b9d67ed90f6e298ec.zip
[media] v4l2-device: Don't unregister ACPI/Device Tree based devices
When a V4L2 sub-device backed by a DT or ACPI based device was removed, the device was unregistered as well which certainly was not intentional, as the client device would not be re-created by simply reinstating the V4L2 sub-device (indeed the device would have to be there first!). Skip unregistering the device in case it has non-NULL of_node or fwnode. Signed-off-by: Tommi Franttila <tommi.franttila@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/v4l2-device.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
index 5b0a30b9252b..7129e438f29e 100644
--- a/drivers/media/v4l2-core/v4l2-device.c
+++ b/drivers/media/v4l2-core/v4l2-device.c
@@ -118,11 +118,20 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev)
if (sd->flags & V4L2_SUBDEV_FL_IS_I2C) {
struct i2c_client *client = v4l2_get_subdevdata(sd);
- /* We need to unregister the i2c client explicitly.
- We cannot rely on i2c_del_adapter to always
- unregister clients for us, since if the i2c bus
- is a platform bus, then it is never deleted. */
- if (client)
+ /*
+ * We need to unregister the i2c client
+ * explicitly. We cannot rely on
+ * i2c_del_adapter to always unregister
+ * clients for us, since if the i2c bus is a
+ * platform bus, then it is never deleted.
+ *
+ * Device tree or ACPI based devices must not
+ * be unregistered as they have not been
+ * registered by us, and would not be
+ * re-created by just probing the V4L2 driver.
+ */
+ if (client &&
+ !client->dev.of_node && !client->dev.fwnode)
i2c_unregister_device(client);
continue;
}
@@ -131,7 +140,7 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev)
if (sd->flags & V4L2_SUBDEV_FL_IS_SPI) {
struct spi_device *spi = v4l2_get_subdevdata(sd);
- if (spi)
+ if (spi && !spi->dev.of_node && !spi->dev.fwnode)
spi_unregister_device(spi);
continue;
}
OpenPOWER on IntegriCloud