From a9cff393c1d78ecbbc33e6196e79bb05ccb4a709 Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 15 Aug 2019 13:48:04 -0300 Subject: media: v4l2-core: introduce a helper to unregister a spi subdev Introduce a new video4linux2 spi helper, to unregister a subdev. This allows to get rid of some more ifdefs. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-device.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'drivers/media/v4l2-core/v4l2-device.c') 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 #include #include -#if defined(CONFIG_SPI) -#include -#endif #include #include #include @@ -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'; -- cgit v1.2.3