Skip to contentSkip to conversation

fix PCTV 461e tuner I2C binding

DISCUSSION Shuah Khan 2 participants 5 messages Jul 7, 2014 – Jul 8, 2014 Media (V4L/DVB)

lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

Mauro/Antti,

I have been looking at the following commit to

drivers/media/usb/em28xx/em28xx-dvb.c

a83b93a7480441a47856dc9104bea970e84cda87

+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1630,6 +1630,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]);
@@ -1640,6 +1641,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;
        }

Why are we unregistering i2c devices and dvb in this resume path? Looks incorrect to me.

-- Shuah

Signature · 4 lines
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
[email protected] | (970) 672-0658
#1 lore raw

Moikka Shuah

Quoted 32 lines · Shuah Khan

Mauro/Antti,

I have been looking at the following commit to

drivers/media/usb/em28xx/em28xx-dvb.c

a83b93a7480441a47856dc9104bea970e84cda87

+++ b/drivers/media/usb/em28xx/em28xx-dvb.c

(quoted diff) +10 -0
@@ -1630,6 +1630,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]);
@@ -1640,6 +1641,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;
         }
 
Quoted 2 lines

Why are we unregistering i2c devices and dvb in this resume path? Looks incorrect to me.

I don't know. Original patch I send was a bit different and tuner was removed only during em28xx_dvb_fini()

https://patchwork.linuxtv.org/patch/22275/

regards
Antti

Signature · 1 line
http://palosaari.fi/
author
#2 lore raw

Moikka Antti,

Quoted 11 lines · Antti Palosaari

Moikka Shuah

Quoted 2 lines

Why are we unregistering i2c devices and dvb in this resume path? Looks incorrect to me.

I don't know. Original patch I send was a bit different and tuner was removed only during em28xx_dvb_fini()

https://patchwork.linuxtv.org/patch/22275/

Yes. That's what I suspected. My patch and yours got munged somehow. I will send a fix in.

btw: thanks for teaching me how to say hello in Finnish

-- Shuah

Signature · 4 lines
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
[email protected] | (970) 672-0658
#3 lore raw
Quoted 9 lines · Shuah Khan

Moikka Antti,

Quoted 6 lines · Antti Palosaari

Moikka Shuah

Quoted 2 lines

Why are we unregistering i2c devices and dvb in this resume path? Looks incorrect to me.

Quoted 8 lines
Quoted 5 lines

I don't know. Original patch I send was a bit different and tuner was removed only during em28xx_dvb_fini()

https://patchwork.linuxtv.org/patch/22275/

Yes. That's what I suspected. My patch and yours got munged somehow. I will send a fix in.

There has been merge conflict and that is end result. None has reported that bug so far. Likely it is very rare users suspend/resume these devices as DVB suspend/resume has been largely broken always...

Quoted 1 line

btw: thanks for teaching me how to say hello in Finnish

:=)

regards
Antti

Signature · 1 line
http://palosaari.fi/
author
#4 lore raw
Quoted 16 lines · Antti Palosaari
Quoted 15 lines · Shuah Khan

Moikka Antti,

Quoted 11 lines · Antti Palosaari

Moikka Shuah

Quoted 2 lines

Why are we unregistering i2c devices and dvb in this resume path? Looks incorrect to me.

I don't know. Original patch I send was a bit different and tuner was removed only during em28xx_dvb_fini()

https://patchwork.linuxtv.org/patch/22275/

Quoted 7 lines
Quoted 2 lines

Yes. That's what I suspected. My patch and yours got munged somehow. I will send a fix in.

There has been merge conflict and that is end result. None has reported that bug so far. Likely it is very rare users suspend/resume these devices as DVB suspend/resume has been largely broken always...

Somebody reported last week on v4l2 irc that suspend/resume not working starting 3.15. That's what got me started on looking at the code closely.

It should be fixed anyways. :)

-- Shuah

Signature · 4 lines
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
[email protected] | (970) 672-0658