In general you are correct that it is not possible to unload a module when it's being used by another module. That would cause linkage issues and a likely crash if it were allowed.
However the V4L cases here are different, for pretty much all of these chip-level drivers. While logically the pvrusb2 driver is "using" the cx25840 module to do it's job, the physical reality is actually the opposite. The cx25840 module is actually using the pvrusb2 driver. It's the other way around. This makes sense when one realizes that the pvrusb2 driver is supplying a communication path to the cx25840 module so that it can itself reach its corresponding hardware. When the pvrusb2 driver detects new hardware, it figures out which chip-level modules are needed and just requests that the kernel load them. But that's it. It never directly references any of them. Once loaded, the modules will enumerate attached I2C adapters (for which the pvrusb2 driver is one such instance) and then bind to that adapter. So the dependency relationship is actually cx25840 -> pvrusb2, not pvrusb2 -> cx25840. Any activity from the pvrusb2 driver to one of those bound modules generally works through a publish/subscribe approach. So again the bindings work in the opposite direction you might otherwise assume. Thus you can (or, well, "should be able to") actually unload the cx25840 module at any time. Obviously the corresponding functionality will cease when this happens but the pvrusb2 driver generally won't care (or even notice). When the module reappears and rebinds, the pvrusb2 driver will republish appropriate state to it at that point, bringing things back into sync. This sort of thing I used to do a lot of when testing changes in the driver. -Mike On Tue, 5 Nov 2019, Jan Ceuleers wrote: > On 05/11/2019 05:02, Mike Isely wrote: > > With that knowledge, see if unloading / reloading the cx25840 module > > might affect the issue. (And that should actually work right now.) > > Also, you might want to see if there's a different firmware image > > floating around for that part. > > Thanks Mike. I'll experiment with that when the problem reoccurs. > > I didn't think it was possible to unload a module that is being used by > other modules, but as I said I'll give that a go either when I have to > (issue has reoccurred) or when the backend is free for my experimentation. > > root@dracor:~# lsmod | grep cx25 > cx25840 143360 2 > v4l2_common 16384 4 cx2341x,pvrusb2,cx25840,tuner > videodev 188416 5 cx2341x,v4l2_common,pvrusb2,cx25840,tuner > media 40960 3 videodev,cx25840,tuner > > Regarding firmware: we had that discussion back in April when I started > a thread on the subject of "Noise". > > Thx, Jan > > > _______________________________________________ > pvrusb2 mailing list > [email protected] > http://www.isely.net/cgi-bin/mailman/listinfo/pvrusb2 > -- Mike Isely isely @ isely (dot) net PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8 _______________________________________________ pvrusb2 mailing list [email protected] http://www.isely.net/cgi-bin/mailman/listinfo/pvrusb2
