diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-10 09:20:01 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-10 22:35:29 -0200 |
commit | 7528cd273e14020117e6cdb6cc307f223e97c5ed (patch) | |
tree | 872fdcc3f4f8d7349befe6c2a10f079962438827 /drivers/media/video/cx231xx/cx231xx-input.c | |
parent | [media] mb86a20s: implement get_frontend() (diff) | |
download | linux-dev-7528cd273e14020117e6cdb6cc307f223e97c5ed.tar.xz linux-dev-7528cd273e14020117e6cdb6cc307f223e97c5ed.zip |
[media] cx231xx: Fix unregister logic
There are several weirdness at the unregister logic.
First of all, IR has a poll thread. This thread needs to be
removed, as it uses some resources associated to the main driver.
So, the driver needs to explicitly unregister the I2C client for
ir-kbd-i2c.
If, for some reason, the driver needs to wait for a close()
to happen, not all memories will be freed, because the free
logic were in the wrong place.
Also, v4l2_device_unregister() seems to be called too early,
as devices are still using it.
Finally, even with the device disconnected, there is one
USB function call that will still try to talk with it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-input.c')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-input.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index 8a75a908e709..96176e9db5a2 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c @@ -106,11 +106,14 @@ int cx231xx_ir_init(struct cx231xx *dev) ir_i2c_bus = cx231xx_boards[dev->model].ir_i2c_master; dev_dbg(&dev->udev->dev, "Trying to bind ir at bus %d, addr 0x%02x\n", ir_i2c_bus, info.addr); - i2c_new_device(&dev->i2c_bus[ir_i2c_bus].i2c_adap, &info); + dev->ir_i2c_client = i2c_new_device(&dev->i2c_bus[ir_i2c_bus].i2c_adap, &info); return 0; } void cx231xx_ir_exit(struct cx231xx *dev) { + if (dev->ir_i2c_client) + i2c_unregister_device(dev->ir_i2c_client); + dev->ir_i2c_client = NULL; } |