linux-i3c.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach.
@ 2022-09-26 10:51 Billy Tsai
  2022-09-26 10:51 ` [PATCH 2/2] i3c: master: Remove the wrong place of reattach Billy Tsai
  2022-10-12 21:47 ` [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Billy Tsai @ 2022-09-26 10:51 UTC (permalink / raw)
  To: alexandre.belloni, linux-i3c, linux-kernel, BMC-SW

This patch is used to free the old_dyn_addr when the caller want to
reattach the device to the different dynamic address. If the
old_dyn_addr is 0 the function will treat it as no old_dyn_addr is
reserved on the bus. Without the patch, when the driver reattach the i3c
device after setnewda the old_dyn_addr will be permanently occupied.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 drivers/i3c/master.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 7850287dfe7a..6349ce0ce835 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1379,6 +1379,9 @@ static int i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev,
 		i3c_bus_set_addr_slot_status(&master->bus,
 					     dev->info.dyn_addr,
 					     I3C_ADDR_SLOT_I3C_DEV);
+		if (old_dyn_addr)
+			i3c_bus_set_addr_slot_status(&master->bus, old_dyn_addr,
+						     I3C_ADDR_SLOT_FREE);
 	}
 
 	if (master->ops->reattach_i3c_dev) {
-- 
2.25.1


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

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

* [PATCH 2/2] i3c: master: Remove the wrong place of reattach.
  2022-09-26 10:51 [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach Billy Tsai
@ 2022-09-26 10:51 ` Billy Tsai
  2022-10-12 21:47 ` [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Billy Tsai @ 2022-09-26 10:51 UTC (permalink / raw)
  To: alexandre.belloni, linux-i3c, linux-kernel, BMC-SW

The reattach should be used when an I3C device has its address changed.
But the modified place in this patch doesn't have the address changed of
the newdev. This wrong reattach will reserve the same address slot twice
and return unexpected -EBUSY when the bus find the duplicate device with
diffent dynamic address.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 drivers/i3c/master.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 6349ce0ce835..351c81a929a6 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1911,10 +1911,6 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
 		i3c_master_free_i3c_dev(olddev);
 	}
 
-	ret = i3c_master_reattach_i3c_dev(newdev, old_dyn_addr);
-	if (ret)
-		goto err_detach_dev;
-
 	/*
 	 * Depending on our previous state, the expected dynamic address might
 	 * differ:
-- 
2.25.1


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

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

* Re: [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach.
  2022-09-26 10:51 [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach Billy Tsai
  2022-09-26 10:51 ` [PATCH 2/2] i3c: master: Remove the wrong place of reattach Billy Tsai
@ 2022-10-12 21:47 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2022-10-12 21:47 UTC (permalink / raw)
  To: linux-kernel, Billy Tsai, BMC-SW, linux-i3c

On Mon, 26 Sep 2022 18:51:44 +0800, Billy Tsai wrote:
> This patch is used to free the old_dyn_addr when the caller want to
> reattach the device to the different dynamic address. If the
> old_dyn_addr is 0 the function will treat it as no old_dyn_addr is
> reserved on the bus. Without the patch, when the driver reattach the i3c
> device after setnewda the old_dyn_addr will be permanently occupied.
> 
> 
> [...]

Applied, thanks!

[1/2] i3c: master: Free the old_dyn_addr when reattach.
      commit: d4fa7d772adc02451076b3ad1f990d8b822909fc
[2/2] i3c: master: Remove the wrong place of reattach.
      commit: 90f4a09a15239f4a819b2e90a7a0b92a75060655

Best regards,

-- 
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] 3+ messages in thread

end of thread, other threads:[~2022-10-12 21:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 10:51 [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach Billy Tsai
2022-09-26 10:51 ` [PATCH 2/2] i3c: master: Remove the wrong place of reattach Billy Tsai
2022-10-12 21:47 ` [PATCH 1/2] i3c: master: Free the old_dyn_addr when reattach Alexandre Belloni

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).