PNP: Export pnp_bus_type for modules
Subsystems (2)
PATCH 1/1 PNP: Export pnp_bus_type for modules
Since we have dev_is_pnp() macro that utilises the address of pnp_bus_type variable, the users, which can be compiled as modules, will be failed to build. Export the variable to the modules to prevent build breakage.
--- drivers/pnp/driver.c | 1 + 1 file changed, 1 insertion(+)
drivers/pnp/driver.c +1 -0
@@ -265,6 +265,7 @@ const struct bus_type pnp_bus_type = { .pm = &pnp_bus_dev_pm_ops, .dev_groups = pnp_dev_groups, }; +EXPORT_SYMBOL (pnp_bus_type);int pnp_register_driver (struct pnp_driver *drv) {
Signature · 1 line
2.45.1
Quoted 17 lines · Andy Shevchenko
Since we have
dev_is_pnp()macro that utilises the address ofpnp_bus_typevariable, the users, which can be compiled as modules, will be failed to build. Export the variable to the modules to prevent build breakage.Reported-by Woody Suwalski <[email protected]>Fixes 2a49b45cd0e7 ("PNP: Add dev_is_pnp() macro")Signed-off-by Andy Shevchenko <[email protected]>--- drivers/pnp/driver.c | 1 + 1 file changed, 1 insertion(+)drivers/pnp/driver.c +0
-0
drivers/pnp/driver.c const struct bus_type pnp_bus_type = { · line 271
Quoted 7 lines
drivers/pnp/driver.c +1
-0@@ -265,6 +265,7 @@ const struct bus_type pnp_bus_type = { .pm = &pnp_bus_dev_pm_ops, .dev_groups = pnp_dev_groups, }; +EXPORT_SYMBOL (pnp_bus_type);int pnp_register_driver (struct pnp_driver *drv) {
Confirm the patch works OK.
Thanks, Woody
Quoted 3 lines · Andy Shevchenko
Since we have
dev_is_pnp()macro that utilises the address ofpnp_bus_typevariable, the users, which can be compiled as modules, will be failed to build. Export the variable to the modules to prevent build breakage.
NAK. Please move dev_is_pnp out of line and export it (as EXPORT_SYMBOL_GPL), please. bus types should be private unless we have really good reasons for them not to be private.
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines · Andy Shevchenko
Since we have
dev_is_pnp()macro that utilises the address ofpnp_bus_typevariable, the users, which can be compiled as modules, will be failed to build. Export the variable to the modules to prevent build breakage.NAK. Please move
dev_is_pnpout of line and export it (asEXPORT_SYMBOL_GPL), please. bus types should be private unless we have really good reasons for them not to be private.
Works for me, I'll redo it in the v2, thank you for the review.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines · Andy Shevchenko
Since we have
dev_is_pnp()macro that utilises the address ofpnp_bus_typevariable, the users, which can be compiled as modules, will be failed to build. Export the variable to the modules to prevent build breakage.NAK. Please move
dev_is_pnpout of line and export it (asEXPORT_SYMBOL_GPL), please. bus types should be private unless we have really good reasons for them not to be private.
FWIW, it's not private, it's just not exported to the modules. Are you suggesting to hide the bus type completely to make it static? If so, this is out of scope of this fix.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · Andy Shevchenko
Quoted 3 lines
NAK. Please move
dev_is_pnpout of line and export it (asEXPORT_SYMBOL_GPL), please. bus types should be private unless we have really good reasons for them not to be private.FWIW, it's not private, it's just not exported to the modules. Are you suggesting to hide the bus type completely to make it static? If so, this is out of scope of this fix.
Not exporting it is the most important bit. Making it private would be even better of course.
Rafael J. Wysocki
maintainerQuoted 18 lines · Andy Shevchenko
Since we have
dev_is_pnp()macro that utilises the address ofpnp_bus_typevariable, the users, which can be compiled as modules, will be failed to build. Export the variable to the modules to prevent build breakage.Reported-by Woody Suwalski <[email protected]>Fixes 2a49b45cd0e7 ("PNP: Add dev_is_pnp() macro")Signed-off-by Andy Shevchenko <[email protected]>--- drivers/pnp/driver.c | 1 + 1 file changed, 1 insertion(+)drivers/pnp/driver.c +0
-0
drivers/pnp/driver.c const struct bus_type pnp_bus_type = { · line 268
Quoted 4 lines
drivers/pnp/driver.c +1
-0@@ -265,6 +265,7 @@ const struct bus_type pnp_bus_type = { .pm = &pnp_bus_dev_pm_ops, .dev_groups = pnp_dev_groups, }; +EXPORT_SYMBOL (pnp_bus_type);
Why not EXPORT_SYMBOL_GPL()?
Quoted 6 lines
drivers/pnp/driver.c +0
-1int pnp_register_driver (struct pnp_driver *drv) { --2.45.1
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Andy Shevchenko
Since we have
dev_is_pnp()macro that utilises the address ofpnp_bus_typevariable, the users, which can be compiled as modules, will be failed to build. Export the variable to the modules to prevent build breakage.
...
Quoted 3 lines
Quoted 1 line
+EXPORT_SYMBOL(pnp_bus_type);
Why not
EXPORT_SYMBOL_GPL()?
To be consistent with the rest, but in any case Christoph suggested something else, where _GPL is assumed to be.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Rafael J. Wysocki
maintainerQuoted 9 lines · Andy Shevchenko
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Andy Shevchenko
Since we have
dev_is_pnp()macro that utilises the address ofpnp_bus_typevariable, the users, which can be compiled as modules, will be failed to build. Export the variable to the modules to prevent build breakage.
Quoted 8 lines
...
Quoted 3 lines
Quoted 1 line
+EXPORT_SYMBOL(pnp_bus_type);
Why not
EXPORT_SYMBOL_GPL()?To be consistent with the rest, but in any case Christoph suggested something else, where
_GPLis assumed to be.
Yes, that's even better.