Skip to contentSkip to conversation

PCI: export pci_find_host_bridge() to fix MFD build error

PATCH In review Randy Dunlap 3 participants 7 messages Oct 19, 2020 – Oct 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: export pci_find_host_bridge() to fix MFD build error

Fix a build error in drivers/mfd/ioc.o by exporting pci_find_host_bridge().

ERROR: modpost: "pci_find_host_bridge" [drivers/mfd/ioc3.ko] undefined!

---
 drivers/pci/host-bridge.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/pci/host-bridge.c +2 -0
@@ -4,6 +4,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/export.h>
 #include <linux/pci.h>
 #include <linux/module.h>
 
@@ -23,6 +24,7 @@ struct pci_host_bridge *pci_find_host_br
 
 	return to_pci_host_bridge(root_bus->bridge);
 }
+EXPORT_SYMBOL(pci_find_host_bridge);
 
 struct device *pci_get_host_bridge_device(struct pci_dev *dev)
 {
#1 lore raw
Quoted 4 lines · Randy Dunlap

Fix a build error in drivers/mfd/ioc.o by exporting pci_find_host_bridge().

ERROR: modpost: "pci_find_host_bridge" [drivers/mfd/ioc3.ko] undefined!

I think the mfd code should be fixed to not depend on such an internal symbol instead.

#2 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Randy Dunlap

Fix a build error in drivers/mfd/ioc.o by exporting pci_find_host_bridge().

ERROR: modpost: "pci_find_host_bridge" [drivers/mfd/ioc3.ko] undefined!

I think the mfd code should be fixed to not depend on such an internal symbol instead.

Thanks for commenting. and I am not surprised.

Adding Cc: for Thomas and Lee.

Signature · 1 line
~Randy
#3 lore raw
Quoted 7 lines · Randy Dunlap
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Randy Dunlap

Fix a build error in drivers/mfd/ioc.o by exporting pci_find_host_bridge().

ERROR: modpost: "pci_find_host_bridge" [drivers/mfd/ioc3.ko] undefined!

Quoted 7 lines
Quoted 3 lines

I think the mfd code should be fixed to not depend on such an internal symbol instead.

Thanks for commenting. and I am not surprised.

Adding Cc: for Thomas and Lee.

BTW, if someone wants to use the MFD ioc3 driver now, without any source code patches, they can just build it in (SGI_MFD_IOC3=y) instead of building it as a loadable module.

It builds successfully and can use pci_find_host_bridge(). pci_find_host_bridge() just isn't exported for loadable modules.

So this could be useful (PCI=y):

config SGI_MFD_IOC3

	tristate "SGI IOC3 core driver"
	depends on PCI=y && MIPS && 64BIT
	select MFD_CORE
Signature · 1 line
~Randy
#4 lore raw
Quoted 23 lines · Randy Dunlap
Quoted 7 lines · Randy Dunlap
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Randy Dunlap

Fix a build error in drivers/mfd/ioc.o by exporting pci_find_host_bridge().

ERROR: modpost: "pci_find_host_bridge" [drivers/mfd/ioc3.ko] undefined!

Quoted 7 lines
Quoted 3 lines

I think the mfd code should be fixed to not depend on such an internal symbol instead.

Thanks for commenting. and I am not surprised.

Adding Cc: for Thomas and Lee.

BTW, if someone wants to use the MFD ioc3 driver now, without any source code patches, they can just build it in (SGI_MFD_IOC3=y) instead of building it as a loadable module.

It builds successfully and can use pci_find_host_bridge(). pci_find_host_bridge() just isn't exported for loadable modules.

Quoted 6 lines

So this could be useful (PCI=y):

config SGI_MFD_IOC3

	tristate "SGI IOC3 core driver"
	depends on PCI=y && MIPS && 64BIT
	select MFD_CORE

Wow. That's not correct at all. Need more coffee.

Just set SGI_MFD_IOC3=y and it will be fine.

Signature · 1 line
~Randy
#5 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Randy Dunlap

Fix a build error in drivers/mfd/ioc.o by exporting pci_find_host_bridge().

ERROR: modpost: "pci_find_host_bridge" [drivers/mfd/ioc3.ko] undefined!

I think the mfd code should be fixed to not depend on such an internal symbol instead.

are you talking about the EXPORT_SYMBOL or the usage of pci_find_host_bridge() outside of drivers/pci ? If the latter the function is used in arm/arm64 code and pci controller code... so I doesn't look like a pure internal symbol to me.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#6 lore raw
Quoted 7 lines · Thomas Bogendoerfer
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Randy Dunlap

Fix a build error in drivers/mfd/ioc.o by exporting pci_find_host_bridge().

ERROR: modpost: "pci_find_host_bridge" [drivers/mfd/ioc3.ko] undefined!

Quoted 7 lines
Quoted 2 lines

I think the mfd code should be fixed to not depend on such an internal symbol instead.

are you talking about the EXPORT_SYMBOL or the usage of pci_find_host_bridge() outside of drivers/pci ? If the latter the function is used in arm/arm64 code and pci controller code... so I doesn't look like a pure internal symbol to me.

All of those are built-in and related bits aren't exported at all, or at best EXPORT_SYMBOL_GPL. I think just not allowing the ioc3 mfd to be built modular might be the easiest fix here. Especially as for IP27 and co kernel it is everything but optional anyway.