* [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only
@ 2025-09-14 20:24 Heiner Kallweit
2025-09-25 20:47 ` Wolfram Sang
2025-10-10 19:50 ` Konrad Dybcio
0 siblings, 2 replies; 7+ messages in thread
From: Heiner Kallweit @ 2025-09-14 20:24 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c@vger.kernel.org
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"
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/i2c/i2c-boardinfo.c | 4 ++--
include/linux/i2c.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c
index 4df8ad092..338800321 100644
--- a/drivers/i2c/i2c-boardinfo.c
+++ b/drivers/i2c/i2c-boardinfo.c
@@ -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;
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 20fd41b51..11a19241e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -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
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only
2025-09-14 20:24 [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only Heiner Kallweit
@ 2025-09-25 20:47 ` Wolfram Sang
2025-10-10 19:50 ` Konrad Dybcio
1 sibling, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2025-09-25 20:47 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: linux-i2c@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 606 bytes --]
On Sun, Sep 14, 2025 at 10:24:13PM +0200, Heiner Kallweit wrote:
> 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"
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied to for-next, thanks!
The other patch needs some more time to look at.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only
2025-09-14 20:24 [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only Heiner Kallweit
2025-09-25 20:47 ` Wolfram Sang
@ 2025-10-10 19:50 ` Konrad Dybcio
2025-10-11 10:33 ` Wolfram Sang
2025-10-12 21:05 ` Heiner Kallweit
1 sibling, 2 replies; 7+ messages in thread
From: Konrad Dybcio @ 2025-10-10 19:50 UTC (permalink / raw)
To: Heiner Kallweit, Wolfram Sang
Cc: linux-i2c@vger.kernel.org, Bjorn Andersson, linux-arm-msm
On 9/14/25 10:24 PM, Heiner Kallweit wrote:
> 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"
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only
2025-10-10 19:50 ` Konrad Dybcio
@ 2025-10-11 10:33 ` Wolfram Sang
2025-10-11 16:14 ` Konrad Dybcio
2025-10-12 21:05 ` Heiner Kallweit
1 sibling, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2025-10-11 10:33 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Heiner Kallweit, linux-i2c@vger.kernel.org, Bjorn Andersson,
linux-arm-msm
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
Hi Konrad,
> 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
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only
2025-10-11 10:33 ` Wolfram Sang
@ 2025-10-11 16:14 ` Konrad Dybcio
2025-10-18 20:08 ` Heiner Kallweit
0 siblings, 1 reply; 7+ messages in thread
From: Konrad Dybcio @ 2025-10-11 16:14 UTC (permalink / raw)
To: Wolfram Sang
Cc: Heiner Kallweit, linux-i2c@vger.kernel.org, Bjorn Andersson,
linux-arm-msm
On 10/11/25 12:33 PM, Wolfram Sang wrote:
> Hi Konrad,
>
>> 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
>
> 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
Konrad
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only
2025-10-10 19:50 ` Konrad Dybcio
2025-10-11 10:33 ` Wolfram Sang
@ 2025-10-12 21:05 ` Heiner Kallweit
1 sibling, 0 replies; 7+ messages in thread
From: Heiner Kallweit @ 2025-10-12 21:05 UTC (permalink / raw)
To: Konrad Dybcio, Wolfram Sang
Cc: linux-i2c@vger.kernel.org, Bjorn Andersson, linux-arm-msm
On 10/10/2025 9:50 PM, Konrad Dybcio wrote:
> On 9/14/25 10:24 PM, Heiner Kallweit wrote:
>> 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"
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>
> 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?
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only
2025-10-11 16:14 ` Konrad Dybcio
@ 2025-10-18 20:08 ` Heiner Kallweit
0 siblings, 0 replies; 7+ messages in thread
From: Heiner Kallweit @ 2025-10-18 20:08 UTC (permalink / raw)
To: Konrad Dybcio, Wolfram Sang
Cc: linux-i2c@vger.kernel.org, Bjorn Andersson, linux-arm-msm
On 10/11/2025 6:14 PM, Konrad Dybcio wrote:
> On 10/11/25 12:33 PM, Wolfram Sang wrote:
>> Hi Konrad,
>>
>>> 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
>>
>> 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.
> Konrad
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-10-18 20:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-14 20:24 [PATCH] i2c: i2c-boardinfo: Annotate code used in init phase only Heiner Kallweit
2025-09-25 20:47 ` Wolfram Sang
2025-10-10 19:50 ` Konrad Dybcio
2025-10-11 10:33 ` Wolfram Sang
2025-10-11 16:14 ` Konrad Dybcio
2025-10-18 20:08 ` Heiner Kallweit
2025-10-12 21:05 ` Heiner Kallweit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).