On Wed, Mar 24, 2021 at 10:26 PM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > > On Wed, Mar 24, 2021 at 10:00:05PM +0530, Devesh Sharma wrote: > > > > > > -static void bnxt_re_dev_unprobe(struct net_device *netdev, > > > > > - struct bnxt_en_dev *en_dev) > > > > > -{ > > > > > - dev_put(netdev); > > > > > - module_put(en_dev->pdev->driver->driver.owner); > > > > > -} > > > > > > > > And you are right to be wondering WTF is this > > > > Still trying to understand but what's the big idea here may be I can help. > > A driver should not have module put things like the above > > It should not be accessing ->driver without holding the device_lock() > > Basically it is all nonsense coding, Leon suggests to delete it and he > is probably right. > > Can you explain what it thinks it is doing? That F'ed up code is trying to prevent a situation where someone tries to remove the bnxt_en driver while bnxt_re driver is using it. All because bnxt_re driver is at the mercy of bnxt_en drive and there is not symbole dependence, Do you suggest anything to prevent that unload of bnxt_en other than doing this jargon. I did not follow how DEPENDS_ON would prevent things. > > Jason -- -Regards Devesh
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature