upstream: [media] em28xx-dvb: fix PCTV 461e tuner I2C binding
authorAntti Palosaari <crope@iki.fi>
Wed, 12 Feb 2014 17:59:37 +0000 (14:59 -0300)
committerChanho Park <chanho61.park@samsung.com>
Thu, 7 Aug 2014 05:26:54 +0000 (14:26 +0900)
Add missing m88ts2022 module reference counts as removing that module
is not allowed when it is used by em28xx-dvb module. That same module
was not unregistered correctly, fix it too.

Error cases validated by returning errors from m88ds3103, m88ts2022
and a8293 probe().

Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/usb/em28xx/em28xx-dvb.c

index d381861..ddc511f 100644 (file)
@@ -1712,6 +1712,7 @@ static int em28xx_dvb_resume(struct em28xx *dev)
        em28xx_info("Resuming DVB extension");
        if (dev->dvb) {
                struct em28xx_dvb *dvb = dev->dvb;
+               struct i2c_client *client = dvb->i2c_client_tuner;
 
                if (dvb->fe[0]) {
                        ret = dvb_frontend_resume(dvb->fe[0]);
@@ -1722,6 +1723,15 @@ static int em28xx_dvb_resume(struct em28xx *dev)
                        ret = dvb_frontend_resume(dvb->fe[1]);
                        em28xx_info("fe1 resume %d", ret);
                }
+               /* remove I2C tuner */
+               if (client) {
+                       module_put(client->dev.driver->owner);
+                       i2c_unregister_device(client);
+               }
+
+               em28xx_unregister_dvb(dvb);
+               kfree(dvb);
+               dev->dvb = NULL;
        }
 
        return 0;