On Fri, Feb 12, 2021 at 11:18 AM Greg KH <gre...@linuxfoundation.org> wrote: le > > @@ -1,2 +1,4 @@ > > obj-$(CONFIG_PVPANIC_MMIO) += pvpanic-mmio.o > > pvpanic-mmio-objs := pvpanic-common.o mmio.o > > +obj-$(CONFIG_PVPANIC_PCI) += pvpanic-pci.o > > +pvpanic-pci-objs := pvpanic-common.o pci.o > > So you now have the pvpanic-common.o file linked into both modules at > the same time? What happens if they are both loaded? > > This feels really broken...
Loading them as two modules should work, but this will probably lead to a link failure if one of the two drivers is built-in and the other one is a loadable module. The usual way to fix this is to make the common part a separate module with exported symbols for the probe/release functions and built based on CONFIG_PVPANIC, which then needs to be a tristate symbol again. Arnd