[media] cx231xx: fix device disconnect checks
The driver were using DEV_MISCONFIGURED on some places, and
DEV_DISCONNECTED on others. In a matter of fact, DEV_MISCONFIGURED
were set only during the usb disconnect callback, with
was confusing.
Also, the alsa driver never checks if the device is present,
before doing some dangerous things.
Remove DEV_MISCONFIGURED, replacing it by DEV_DISCONNECTED.
Also, fixes the other usecases for DEV_DISCONNECTED.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c
index 1f2fbbf..7577e6e 100644
--- a/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -1337,6 +1337,8 @@
if (!dev->udev)
return;
+ dev->state |= DEV_DISCONNECTED;
+
flush_request_modules(dev);
/* wait until all current v4l2 io is finished then deallocate
@@ -1354,16 +1356,13 @@
/* Even having users, it is safe to remove the RC i2c driver */
cx231xx_ir_exit(dev);
- dev->state |= DEV_MISCONFIGURED;
if (dev->USE_ISO)
cx231xx_uninit_isoc(dev);
else
cx231xx_uninit_bulk(dev);
- dev->state |= DEV_DISCONNECTED;
wake_up_interruptible(&dev->wait_frame);
wake_up_interruptible(&dev->wait_stream);
} else {
- dev->state |= DEV_DISCONNECTED;
}
cx231xx_close_extension(dev);