diff mbox series

[1/2] i3c: master: Free the old_dyn_addr when reattach.

Message ID 20220926105145.8145-1-billy_tsai@aspeedtech.com (mailing list archive)
State Accepted
Headers show
Series [1/2] i3c: master: Free the old_dyn_addr when reattach. | expand

Commit Message

Billy Tsai Sept. 26, 2022, 10:51 a.m. UTC
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(+)

Comments

Alexandre Belloni Oct. 12, 2022, 9:47 p.m. UTC | #1
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,
diff mbox series

Patch

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