Hi Andrew, Florian, Florian Fainelli <f.faine...@gmail.com> writes:
> Le 23/12/2015 04:56, Andrew Lunn a écrit : >> Turn mv88e6xxx into a library module, by exporting its symbols. Have >> each driver register their own driver functions with the DSA core in >> there init function. >> >> This results in each driver being a loadable module. >> >> Signed-off-by: Andrew Lunn <and...@lunn.ch> >> --- > > [snip] > >> +obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o >> +obj-$(CONFIGNET_DSA_MV88E6131) += mv88e6123.o > > Missing underscore here between CONFIG and NET. > >> +obj-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o >> +obj-$(CONFIG_NET_DSA_MV88E6352) += mv88e6352.o >> +obj-$(CONFIG_NET_DSA_MV88E6171) += mv88e6171.o >> obj-$(CONFIG_NET_DSA_BCM_SF2) += bcm_sf2.o >> diff --git a/drivers/net/dsa/mv88e6123.c b/drivers/net/dsa/mv88e6123.c >> index bb39720f3e8b..9680e59fd2ae 100644 >> --- a/drivers/net/dsa/mv88e6123.c >> +++ b/drivers/net/dsa/mv88e6123.c >> @@ -167,7 +167,21 @@ static struct platform_driver mv88e6123_driver = { >> .of_match_table = mv88e6123_of_match, >> }, >> }; >> -module_platform_driver(mv88e6123_driver); >> >> +static int __init mv88e6123_init(void) >> +{ >> + register_switch_driver(&mv88e6123_switch_driver); >> + >> + return platform_driver_register(&mv88e6123_driver); >> +} >> + >> +static void __exit mv88e6123_exit(void) >> +{ >> + platform_driver_unregister(&mv88e6123_driver); >> + unregister_switch_driver(&mv88e6123_switch_driver); >> +} > > I think Vivien had started something like this, but it could be nice to > have a helper function/macro which reduces the boilerplate code, not > critical for now though. Indeed I did suggest this macro and exporting in the past, without success though: https://lkml.org/lkml/2015/5/2/152 Maybe the other approach with a reference driver (e.g. mv88e6352.c) declaring a table of supported switch names is more natural? Most Linux drivers factorize the support for similar devices this way (e.g. lm75, ...). Thanks, -v