Subject: Re: [PATCH (net.git) 4/4 (v2)] stmmac: fix driver Kconfig when built as module

From: Giuseppe CAVALLARO <[email-masked]>
Date: Tue, 05 Jun 2012 07:41:17 +0200

On 6/5/2012 7:26 AM, Rayagond K wrote:
> Hi Giuseppe,
> 
> On Mon, Jun 4, 2012 at 9:07 PM, Giuseppe CAVALLARO
> <[email-masked] <mailto:[email-masked]>> wrote:
> 
>     This patches fixes the driver when built as dyn module.
>     In fact the platform part cannot be built and the probe fails
>     (thanks to Bob Liu that reported this bug).
> 
>     v2: as D. Miller suggested, it is not necessary to make the
>     pci and the platform code mutually exclusive.
>     Having both could also help, at built time ,to verify that
>     all the code is validated and compiles fine.
> 

[snip]

>     +static void __exit stmmac_exit(void)
>     +{
>     +       pci_unregister_driver(&stmmac_pci_driver);
>     +       platform_driver_unregister(&stmmac_pltfr_driver);
>     +}
> 
> 
> I guess, unregistering both PCI and platform driver should also be
> conditional else kernel may give warning message *"Unexpected driver
> unregister!".*
> 
> For example PCI driver registration will be successful only if there is
> PCI card on the system/board else registration will be failed, so if the
> register would have failed then unregistering the driver again will
> cause kernel warning message.
> 
> Please see *driver_unregister(*) function which is called from
> *pci_unregister_driver() *for more info.

Hmm, no driver does that because slightly redundant and, IMO, not
necessary in these cases.

Thanks for your feedback.
Peppe