public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] i3c: master: Set the device name only after we initialize i3c_bus->id
@ 2026-01-13 13:08 Fredrik Markstrom via B4 Relay
  2026-01-14 17:08 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Fredrik Markstrom via B4 Relay @ 2026-01-13 13:08 UTC (permalink / raw)
  To: Alexandre Belloni, Frank Li
  Cc: linux-i3c, linux-kernel, Fredrik Markstrom, Ivar Holmqvist

From: Fredrik Markstrom <fredrik.markstrom@est.tech>

The i3c_bus->id field is used to construct the unique name of the I3C
bus device. This field is initialized and assigned its unique value
within the i3c_bus_init() function.

However, the existing code was referencing i3c_bus->id *before* the
call to i3c_bus_init(), leading to all the masters having the same
device name string.

This commit moves the reference to i3c_bus->id to *after* the call to
i3c_bus_init().

Fixes: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
Signed-off-by: Fredrik Markstrom <fredrik.markstrom@est.tech>
Reviewed-by: Ivar Holmqvist <ivar.holmqvist@est.tech>
---
 drivers/i3c/master.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 7f606c871648..1bc3c9068402 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -2881,7 +2881,6 @@ int i3c_master_register(struct i3c_master_controller *master,
 	INIT_LIST_HEAD(&master->boardinfo.i3c);
 
 	device_initialize(&master->dev);
-	dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
 
 	master->dev.dma_mask = parent->dma_mask;
 	master->dev.coherent_dma_mask = parent->coherent_dma_mask;
@@ -2891,6 +2890,8 @@ int i3c_master_register(struct i3c_master_controller *master,
 	if (ret)
 		goto err_put_dev;
 
+	dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
+
 	ret = of_populate_i3c_bus(master);
 	if (ret)
 		goto err_put_dev;

---
base-commit: 0f61b1860cc3f52aef9036d7235ed1f017632193
change-id: 20260113-set_i3c_master_name-4fe45d589164

Best regards,
-- 
Fredrik Markstrom <fredrik.markstrom@est.tech>



-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i3c: master: Set the device name only after we initialize i3c_bus->id
  2026-01-13 13:08 [PATCH] i3c: master: Set the device name only after we initialize i3c_bus->id Fredrik Markstrom via B4 Relay
@ 2026-01-14 17:08 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2026-01-14 17:08 UTC (permalink / raw)
  To: fredrik.markstrom; +Cc: Frank Li, linux-i3c, linux-kernel, Ivar Holmqvist

Hello,

Thanks for the patch! the exact same one had been sent earlier so I
applied it instead.

On 13/01/2026 14:08:53+0100, Fredrik Markstrom via B4 Relay wrote:
> From: Fredrik Markstrom <fredrik.markstrom@est.tech>
> 
> The i3c_bus->id field is used to construct the unique name of the I3C
> bus device. This field is initialized and assigned its unique value
> within the i3c_bus_init() function.
> 
> However, the existing code was referencing i3c_bus->id *before* the
> call to i3c_bus_init(), leading to all the masters having the same
> device name string.
> 
> This commit moves the reference to i3c_bus->id to *after* the call to
> i3c_bus_init().
> 
> Fixes: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
> Signed-off-by: Fredrik Markstrom <fredrik.markstrom@est.tech>
> Reviewed-by: Ivar Holmqvist <ivar.holmqvist@est.tech>
> ---
>  drivers/i3c/master.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 7f606c871648..1bc3c9068402 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2881,7 +2881,6 @@ int i3c_master_register(struct i3c_master_controller *master,
>  	INIT_LIST_HEAD(&master->boardinfo.i3c);
>  
>  	device_initialize(&master->dev);
> -	dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
>  
>  	master->dev.dma_mask = parent->dma_mask;
>  	master->dev.coherent_dma_mask = parent->coherent_dma_mask;
> @@ -2891,6 +2890,8 @@ int i3c_master_register(struct i3c_master_controller *master,
>  	if (ret)
>  		goto err_put_dev;
>  
> +	dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
> +
>  	ret = of_populate_i3c_bus(master);
>  	if (ret)
>  		goto err_put_dev;
> 
> ---
> base-commit: 0f61b1860cc3f52aef9036d7235ed1f017632193
> change-id: 20260113-set_i3c_master_name-4fe45d589164
> 
> Best regards,
> -- 
> Fredrik Markstrom <fredrik.markstrom@est.tech>
> 
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-14 17:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13 13:08 [PATCH] i3c: master: Set the device name only after we initialize i3c_bus->id Fredrik Markstrom via B4 Relay
2026-01-14 17:08 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox