[Intel-wired-lan] [PATCH v2 1/2] net: ethernet: i40e: fix build error
Andrew Lunn
andrew at lunn.ch
Thu Sep 6 18:03:16 UTC 2018
> I'm more worried about how it interacts with modules. For example,
> we could have i40e and i40evf share some code, but then wouldn't one
> of them become dependent on the other? i.e. you'd have to load i40e
> in order to successfully load i40evf? Or you'd have to have some
> sort of common glue module which you load first, and then load i40e
> and i40evf after? This also creates some interactions with
> out-of-tree modules which make it difficult. It would be nice if we
> could share the code in some way that still resulted in allowing
> each module to be separate...
You have a few options here.
1) A library module, containing shared code. Use EXPORT_SYMBOL_GPL()
in the library module, and the kernel runtime linker will link the
calls into the library. Also, modprobe will ensure the library module
is loaded first, before the driver module.
2) Build time sharing of code. Place the shared code into a .o file,
and link it to both modules.
There is nothing particularly difficult here, this all done lots of
times within the kernel. Just look around and see how others do it.
Andrew
More information about the Intel-wired-lan
mailing list