Messages in this thread | | | Date | Tue, 15 Nov 2005 15:34:44 +0000 | From | Ralf Baechle <> | Subject | Re: MOD_INC_USE_COUNT |
| |
On Tue, Nov 15, 2005 at 11:56:33AM +0800, Tony wrote:
> >Not strange at all. The typical network driver is implemented using > >pci_register_driver which will set the owner filed of the driver's struct > >driver which then is being used for internal reference counting. Other > >busses or line disciplines (SLIP, PPP, AX.25 ...) need to do the equivalent > >or the kernel will believe reference counting isn't necessary and it's > >ok to unload the module at any time. > > > >In which driver did you hit this problem? > > > > Ralf > > > I have a radio connected to host using ethernet. I'm writing a radio > driver that masquerade radio as a NIC. when the module is loaded, I just > register_netdev a net_device struct, while unregister_netdev at module > cleanup.
register_netdev / unregister_netdev don't deal with the .owner stuff, so your bug isn't there. If your NIC is a PCI card, it should register it's driver through pci_register_driver which would deal with the necessary reference counting. If it's implemented as a platform device you're presumably calling driver_register() before platform_device_register() and driver_register() would do the necessary magic for you. If you're using a different bus it may have it's own variant of driver_register which you should call. If you don't, you have a problem :-)
Ralf - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |