diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-device.c | 14 | ||||
-rw-r--r-- | drivers/media/v4l2-core/v4l2-spi.c | 8 |
2 files changed, 10 insertions, 12 deletions
diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index aa277f5bc862..c2811238996f 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -11,9 +11,6 @@ #include <linux/module.h> #include <linux/i2c.h> #include <linux/slab.h> -#if defined(CONFIG_SPI) -#include <linux/spi/spi.h> -#endif #include <linux/videodev2.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> @@ -124,15 +121,8 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev) continue; } #endif -#if defined(CONFIG_SPI) - if (sd->flags & V4L2_SUBDEV_FL_IS_SPI) { - struct spi_device *spi = v4l2_get_subdevdata(sd); - - if (spi && !spi->dev.of_node && !spi->dev.fwnode) - spi_unregister_device(spi); - continue; - } -#endif + else if (sd->flags & V4L2_SUBDEV_FL_IS_SPI) + v4l2_spi_subdev_unregister(sd); } /* Mark as unregistered, thus preventing duplicate unregistrations */ v4l2_dev->name[0] = '\0'; diff --git a/drivers/media/v4l2-core/v4l2-spi.c b/drivers/media/v4l2-core/v4l2-spi.c index ab5a7eb4205d..2a7e82e1412d 100644 --- a/drivers/media/v4l2-core/v4l2-spi.c +++ b/drivers/media/v4l2-core/v4l2-spi.c @@ -8,6 +8,14 @@ #include <media/v4l2-common.h> #include <media/v4l2-device.h> +void v4l2_spi_subdev_unregister(struct v4l2_subdev *sd) +{ + struct spi_device *spi = v4l2_get_subdevdata(sd); + + if (spi && !spi->dev.of_node && !spi->dev.fwnode) + spi_unregister_device(spi); +} + void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, const struct v4l2_subdev_ops *ops) { |