Skip to content

Commit

Permalink
drivers: fix section mismatch in qcom's regulator drivers
Browse files Browse the repository at this point in the history
Section mismatch was warned after upstream commit 1b9980f
finally fixed modpost's ability to detect EXPORT_SYMBOL plus __init
or __exit. Qcom's qpnp and stub regulator drivers have both __init
and EXPORT_SYMBOL.

- This particular 4.9 kernel does not build anything into modules.
- Currently I do not see any code using qpnp_regulator_init or
  regulator_stub_init outside its own translation unit.

Therefore, similar to d336e9a, just unexport the symbol.

Also, according to the kernel-hacking doc [1], "it makes no sense
for a function marked with __init to be exported to modules with
EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL()" because functions marked
with __init are dropped after boot is complete.

[1] https://docs.kernel.org/kernel-hacking/hacking.html#init-exit-initdata

Signed-off-by: Chenyang Zhong <[email protected]>
  • Loading branch information
jjpprrrr authored and PainKiller3 committed Sep 19, 2022
1 parent 6e1afa9 commit f712080
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 2 deletions.
1 change: 0 additions & 1 deletion drivers/regulator/qpnp-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,6 @@ int __init qpnp_regulator_init(void)

return platform_driver_register(&qpnp_regulator_driver);
}
EXPORT_SYMBOL(qpnp_regulator_init);

static void __exit qpnp_regulator_exit(void)
{
Expand Down
1 change: 0 additions & 1 deletion drivers/regulator/stub-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ int __init regulator_stub_init(void)

return platform_driver_register(&regulator_stub_driver);
}
EXPORT_SYMBOL(regulator_stub_init);
postcore_initcall(regulator_stub_init);

static void __exit regulator_stub_exit(void)
Expand Down

0 comments on commit f712080

Please sign in to comment.