Subject: Re: [PATCH net-next 2/8] net: dsa: make module builds work

From: Florian Fainelli <[email-masked]>
Date: Tue, 13 Jan 2015 14:27:19 -0800

On 13/01/15 13:38, David Miller wrote:
> From: Florian Fainelli <[email-masked]>
> Date: Mon, 12 Jan 2015 13:57:40 -0800
> 
>> Building any DSA driver as a module will work from a compilation/linking
>> perspective, but the resulting modules produced are not functional.
>>
>> Any DSA driver references register_switch_driver and
>> unregister_switch_driver which are provided by net/dsa/dsa.c, so loading
>> any of these modules prior to dsa_core.ko being loaded will faill.
>>
>> Unfortunately, loading dsa_core.ko will make us call dsa_switch_probe()
>> which will find no DSA switch driver and return an error so we are stuck
>> there because there is no switch driver available. So this is getting us
>> nowhere.
>>
>> This patch introduces a separate module, named dsa_lib which contains
>> register_switch_driver, unregister_switch_driver and dsa_switch_probe
>> (to avoid exposing the list and mutex used for walking switch drivers),
>> such that the following can be done:
>>
>> - load dsa_lib
>> - load the dsa switch driver, e.g: mv88e6060, bcm_sf2
>> - load the dsa_core module
>>
>> Signed-off-by: Florian Fainelli <[email-masked]>
> 
> This looks worse to me.
> 
> Really, the match table and probing should not be in dsa_core at all.
> 
> It should only be done in individual drivers.

Right, I guess enough procrastination on my side is enough, time to get
this plan submitted: http://marc.info/?t=141038714600002&r=1&w=2.
-- 
Florian