i2c: i2c-boardinfo: Annotate code used in init phase only
Subsystems (3)
PATCH 1/1 i2c: i2c-boardinfo: Annotate code used in init phase only
Annotate two places in boardinfo code:
- __i2c_first_dynamic_bus_num is set in init phase. Annotate it as __ro_after_init to prevent later changes.
- i2c_register_board_info() is used in init phase only, so annotate it as __init, allowing to free the memory after init phase. This is safe, see comment: "done in board-specific init code near arch_initcall() time"
--- drivers/i2c/i2c-boardinfo.c | 4 ++-- include/linux/i2c.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/i2c-boardinfo.c +2 -2
@@ -22,7 +22,7 @@ EXPORT_SYMBOL_GPL(__i2c_board_lock);LIST_HEAD (__i2c_board_list);EXPORT_SYMBOL_GPL (__i2c_board_list); -int __i2c_first_dynamic_bus_num; +int __i2c_first_dynamic_bus_num__ro_after_init ;EXPORT_SYMBOL_GPL (__i2c_first_dynamic_bus_num);
@@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(__i2c_first_dynamic_bus_num);* The board info passed can safely be __initdata, but be careful of embedded * pointers (for platform_data, functions, etc) since that won't be copied. */ -int i2c_register_board_info (int busnum,struct i2c_board_info const *info,unsigned len) +int __init i2c_register_board_info (int busnum,struct i2c_board_info const *info,unsigned len) {int status;
include/linux/i2c.h +1 -1
@@ -499,7 +499,7 @@ static inline struct i2c_client *i2c_verify_client(struct device *dev)* Modules for add-on boards must use other calls. */ #ifdef CONFIG_I2C_BOARDINFO -int +int __init i2c_register_board_info (int busnum,struct i2c_board_info const *info,unsigned n);#else
Signature · 1 line
2.51.0
Wolfram Sang
AppliedQuoted 9 lines · Heiner Kallweit
Annotate two places in boardinfo code:
-__i2c_first_dynamic_bus_numis set in init phase. Annotate it as__ro_after_initto prevent later changes.
-i2c_register_board_info()is used in init phase only, so annotate it as__init, allowing to free the memory after init phase. This is safe, see comment: "done in board-specific init code neararch_initcall()time"Signed-off-by Heiner Kallweit <[email protected]>
Applied to for-next, thanks!
The other patch needs some more time to look at.
Quoted 10 lines · Heiner Kallweit
Annotate two places in boardinfo code:
-__i2c_first_dynamic_bus_numis set in init phase. Annotate it as__ro_after_initto prevent later changes.
-i2c_register_board_info()is used in init phase only, so annotate it as__init, allowing to free the memory after init phase. This is safe, see comment: "done in board-specific init code neararch_initcall()time"Signed-off-by Heiner Kallweit <[email protected]>---
Hi, this seems to break booting on Qualcomm X1E80100 Surface Laptop 7 (arm64/boot/dts/qcom/x1e80100-microsoft-romulus.dtsi)
gcc-14.2 and clang-20.x
Funnily enough when I build this (albeit on another computer, but also with clang-20.x) and boot another X1E80100-based device (x1-crd.dtsi in the same DT dir), it boots up fine
Konrad
Hi Konrad,
Quoted 8 lines
Hi, this seems to break booting on Qualcomm X1E80100 Surface Laptop 7 (
arm64/boot/dts/qcom/x1e80100-microsoft-romulus.dtsi)gcc-14.2 and clang-20.x
Funnily enough when I build this (albeit on another computer, but also with clang-20.x) and boot another X1E80100-based device (
x1-crd.dtsiin the same DT dir), it boots up fine
I reverted the commit now, but please if you can find out more details about the boot regression, this would be extremly helpful (maybe earlycon helps?).
All the best,
Wolfram
Quoted 7 lines · Wolfram Sang
Hi Konrad,
Quoted 5 lines
Hi, this seems to break booting on Qualcomm X1E80100 Surface Laptop 7 (
arm64/boot/dts/qcom/x1e80100-microsoft-romulus.dtsi)gcc-14.2 and clang-20.x
Quoted 7 lines
Quoted 3 lines
Funnily enough when I build this (albeit on another computer, but also with clang-20.x) and boot another X1E80100-based device (
x1-crd.dtsiin the same DT dir), it boots up fineI reverted the commit now, but please if you can find out more details about the boot regression, this would be extremly helpful (maybe earlycon helps?).
I'll try to poke at it the upcoming week, thanks
Konrad
Quoted 12 lines · Konrad Dybcio
Quoted 11 lines · Wolfram Sang
Hi Konrad,
Quoted 8 lines
Hi, this seems to break booting on Qualcomm X1E80100 Surface Laptop 7 (
arm64/boot/dts/qcom/x1e80100-microsoft-romulus.dtsi)gcc-14.2 and clang-20.x
Funnily enough when I build this (albeit on another computer, but also with clang-20.x) and boot another X1E80100-based device (
x1-crd.dtsiin the same DT dir), it boots up fine
Quoted 6 lines
Quoted 3 lines
I reverted the commit now, but please if you can find out more details about the boot regression, this would be extremly helpful (maybe earlycon helps?).
I'll try to poke at it the upcoming week, thanks
Any result? It's somewhat unfortunate to revert a change just because of a vague report w/o evidence / logs / bisect results.
Quoted 1 line
Konrad
Quoted 9 lines · Konrad Dybcio
Quoted 8 lines · Heiner Kallweit
Annotate two places in boardinfo code:
-__i2c_first_dynamic_bus_numis set in init phase. Annotate it as__ro_after_initto prevent later changes.
-i2c_register_board_info()is used in init phase only, so annotate it as__init, allowing to free the memory after init phase. This is safe, see comment: "done in board-specific init code neararch_initcall()time"
Quoted 6 lines
Quoted 2 lines
Signed-off-by Heiner Kallweit <[email protected]>---
Hi, this seems to break booting on Qualcomm X1E80100 Surface Laptop 7 (
arm64/boot/dts/qcom/x1e80100-microsoft-romulus.dtsi)
What means "seems to break"? Is it or not? Did you bisect? Where exactly does the boot break/stop?
Can you provide a full dmesg log for success and error case on this device?
Quoted 7 lines
gcc-14.2 and clang-20.x
Funnily enough when I build this (albeit on another computer, but also with clang-20.x) and boot another X1E80100-based device (
x1-crd.dtsiin the same DT dir), it boots up fineKonrad