Re: [PATCH v2] ravb: Fixed the problem that rmmod can not be done
From: Sergei Shtylyov <hidden>
Date: 2020-07-31 17:45:07
Also in:
linux-renesas-soc
Hello! On 7/31/20 9:43 AM, Yoshihiro Shimoda wrote:
quoted
quoted
quoted
From: Yuusuke Ashizuka, Sent: Thursday, July 30, 2020 7:02 PM Subject: [PATCH v2] ravb: Fixed the problem that rmmod can not be doneThank you for the patch! I found a similar patch for another driver [1].It's not the same case -- that driver hadn't had the MDIO release code at all before that patch.You're correct. I didn't realized it...
The patch description was somewhat incomplete there...
quoted
quoted
So, we should apply this patch to the ravb driver.I believe the driver is innocent. :-)I hope so :)
Looks like I was wrong in this case. It's very fortunate that the MDIO bitbang is not as popular as I thought.
<snip>quoted
quoted
quoted
$ lsmod Module Size Used by ravb 40960 1 $ rmmod ravb rmmod: ERROR: Module ravb is in useShouldn't the driver core call the remove() method for the affected devices first, before checking the refcount?In this case, an mii bus of "mdiobb_ops bb_ops" is affected "device" by the ravb driver. And the ravb driver sets the owner of mii bus as THIS_MODULE like below: static struct mdiobb_ops bb_ops = { .owner = THIS_MODULE, .set_mdc = ravb_set_mdc, .set_mdio_dir = ravb_set_mdio_dir, .set_mdio_data = ravb_set_mdio_data, .get_mdio_data = ravb_get_mdio_data, }; So, I don't think the driver core can call the remove() method for the mii bus because it's a part of the ravb driver...
And because the MDIO module just doesn't have the usual method! :-) (I meant the EtherAVB driver's remove() method, and that one would be called after a successful reference count check...)
By the way, about the mdio-gpio driver, I'm wondering if the mdio-gpio driver cannot be removed by rmmod too. (perhaps, we need "rmmod -f" to remove it.)
You're on your own here. It's fortunate for this patch that I'm not currently loaded at work! :-)
quoted
quoted
By the way, I think you have to send this patch to the following maintainers too: # We can get it by using scripts/get_maintainers.pl. David S. Miller [off-list ref] (maintainer:NETWORKING DRIVERS,commit_signer:8/8=100%) Jakub Kicinski [off-list ref] (maintainer:NETWORKING DRIVERS)
Not critical, as DaveM uses the patchwork anyway. He started to be CC'ed on netdev patches only recently. :-) [...]
Best regards, Yoshihiro Shimoda
MBR, Sergei