Skip to contentSkip to conversation

bcma: fix linking problem with of_default_bus_match_table

PATCH In review Kalle Valo 2 participants 6 messages Jul 23, 2015 – Jul 26, 2015 Broadcom specific amba driver (bcma)

lore
Share & tools
lore

Kalle Valo

author
#0 lore raw

PATCH 1/1 bcma: fix linking problem with of_default_bus_match_table

Stephen reported a build problem caused by commit cae761b5a6bd ("bcma: populate bus DT subnodes as platform_device-s"):

ERROR: "of_default_bus_match_table" [drivers/bcma/bcma.ko] undefined!

Rafał Miłecki suggested as a quick fix to use IS_BUILTIN() to workaround the issue. The downside is that this won't work when BCMA is compiled as a module, but we can live with that for now just to unblock the breakage.

Fixes cae761b5a6bd ("bcma: populate bus DT subnodes as platform_device-s")
---
 drivers/bcma/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bcma/main.c +1 -1
index 59128478a90f..6b7d54622058 100644
@@ -410,7 +410,7 @@ int bcma_bus_register(struct bcma_bus *bus)
 		bcma_core_pci_early_init(&bus->drv_pci[0]);
 	}
 
-	if (bus->host_pdev) {
+	if (IS_BUILTIN(CONFIG_BCMA) && bus->host_pdev) {
 		struct device *dev = &bus->host_pdev->dev;
 
 		of_platform_populate(dev->of_node, of_default_bus_match_table,
Signature · 1 line
1.7.9.5
#1 lore raw

Hi,

Quoted 21 lines · Kalle Valo

Stephen reported a build problem caused by commit cae761b5a6bd ("bcma: populate bus DT subnodes as platform_device-s"):

ERROR: "of_default_bus_match_table" [drivers/bcma/bcma.ko] undefined!

Rafał Miłecki suggested as a quick fix to use IS_BUILTIN() to workaround the issue. The downside is that this won't work when BCMA is compiled as a module, but we can live with that for now just to unblock the breakage.

Fixes cae761b5a6bd ("bcma: populate bus DT subnodes as platform_device-s")
---
 drivers/bcma/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bcma/main.c +0 -0
index 59128478a90f..6b7d54622058 100644

drivers/bcma/main.c int bcma_bus_register(struct bcma_bus *bus) · line 416

Quoted 8 lines
drivers/bcma/main.c +1 -1
@@ -410,7 +410,7 @@ int bcma_bus_register(struct bcma_bus *bus)
                bcma_core_pci_early_init(&bus->drv_pci[0]);
        }
 
-       if (bus->host_pdev) {
+       if (IS_BUILTIN(CONFIG_BCMA) && bus->host_pdev) {
                struct device *dev = &bus->host_pdev->dev;
 
                of_platform_populate(dev->of_node, of_default_bus_match_table,

I think this isn't enough, AFAICT this needs IS_BUILTIN(CONFIG_BCMA) && IS_ENABLED(CONFIG_OF), else it will break with OF=n and BCMA=y, as of_default_bus_match_table is only defined/built-in when OF=y.

Jonas

author
#2 lore raw
Quoted 16 lines · Jonas Gorski

Hi,

Quoted 12 lines · Kalle Valo
drivers/bcma/main.c +1 -1
index 59128478a90f..6b7d54622058 100644
@@ -410,7 +410,7 @@ int bcma_bus_register(struct bcma_bus *bus)
                bcma_core_pci_early_init(&bus->drv_pci[0]);
        }
 
-       if (bus->host_pdev) {
+       if (IS_BUILTIN(CONFIG_BCMA) && bus->host_pdev) {
                struct device *dev = &bus->host_pdev->dev;
 
Quoted 5 lines

drivers/bcma/main.c int bcma_bus_register(struct bcma_bus *bus) · line 416

Quoted 1 line
drivers/bcma/main.c +0 -0
                of_platform_populate(dev->of_node, of_default_bus_match_table,

I think this isn't enough, AFAICT this needs IS_BUILTIN(CONFIG_BCMA) && IS_ENABLED(CONFIG_OF), else it will break with OF=n and BCMA=y, as of_default_bus_match_table is only defined/built-in when OF=y.

I just tested and OF=n and BCMA=y case built succesfully for me. I think it's because of_default_bus_match_table is created even when CONFIG_OF is n. Can you double check, please?

Signature · 1 line
Kalle Valo
#3 lore raw
Quoted 24 lines · Kalle Valo
Quoted 16 lines · Jonas Gorski

Hi,

Quoted 12 lines · Kalle Valo
drivers/bcma/main.c +1 -1
index 59128478a90f..6b7d54622058 100644
@@ -410,7 +410,7 @@ int bcma_bus_register(struct bcma_bus *bus)
                bcma_core_pci_early_init(&bus->drv_pci[0]);
        }
 
-       if (bus->host_pdev) {
+       if (IS_BUILTIN(CONFIG_BCMA) && bus->host_pdev) {
                struct device *dev = &bus->host_pdev->dev;
 
Quoted 5 lines

drivers/bcma/main.c int bcma_bus_register(struct bcma_bus *bus) · line 416

Quoted 1 line
drivers/bcma/main.c +0 -0
                of_platform_populate(dev->of_node, of_default_bus_match_table,

I think this isn't enough, AFAICT this needs IS_BUILTIN(CONFIG_BCMA) && IS_ENABLED(CONFIG_OF), else it will break with OF=n and BCMA=y, as of_default_bus_match_table is only defined/built-in when OF=y.

Quoted 4 lines

I just tested and OF=n and BCMA=y case built succesfully for me. I think it's because of_default_bus_match_table is created even when CONFIG_OF is n. Can you double check, please?

Thinking more about it, I know/remember why it complies even if it shouldn't: the inline prototype for !OF of of_platform_populate does not use any of the arguments so the compiler optimises the reference out. So unless you compile with -O0, you are fine.

I always forget that this works, so sorry for the noise.

Jonas

author
#4 lore raw
Quoted 9 lines · Jonas Gorski
Quoted 8 lines
Quoted 3 lines

I think this isn't enough, AFAICT this needs IS_BUILTIN(CONFIG_BCMA) && IS_ENABLED(CONFIG_OF), else it will break with OF=n and BCMA=y, as of_default_bus_match_table is only defined/built-in when OF=y.

I just tested and OF=n and BCMA=y case built succesfully for me. I think it's because of_default_bus_match_table is created even when CONFIG_OF is n. Can you double check, please?

Quoted 4 lines

Thinking more about it, I know/remember why it complies even if it shouldn't: the inline prototype for !OF of of_platform_populate does not use any of the arguments so the compiler optimises the reference out. So unless you compile with -O0, you are fine.

Thanks for checking. I think this is good enough for now and I'll apply this once I get the report from kbuild.

Signature · 1 line
Kalle Valo
author
#5 lore raw
In reply to Kalle Valo
Quoted 5 lines · Kalle Valo

Stephen reported a build problem caused by commit cae761b5a6bd ("bcma: populate bus DT subnodes as platform_device-s"):

ERROR: "of_default_bus_match_table" [drivers/bcma/bcma.ko] undefined!

Quoted 7 lines

Rafał Miłecki suggested as a quick fix to use IS_BUILTIN() to workaround the issue. The downside is that this won't work when BCMA is compiled as a module, but we can live with that for now just to unblock the breakage.

Fixes cae761b5a6bd ("bcma: populate bus DT subnodes as platform_device-s")

I dropped this as Hauke sent a better patch.

Signature · 1 line
Kalle Valo