* [PATCH] i3c: master: Avoid sending DISEC command with old device address.
@ 2024-08-20 4:38 nxf24178
2024-08-20 14:49 ` Frank Li
0 siblings, 1 reply; 2+ messages in thread
From: nxf24178 @ 2024-08-20 4:38 UTC (permalink / raw)
To: Alexandre Belloni, moderated list:I3C SUBSYSTEM, open list
Cc: imx, Frank.Li, nxf24178
When a new device hotjoins, a new dynamic address is assigned.
i3c_master_add_i3c_dev_locked() identifies that the device was previously
attached to the bus and locates the olddev.
i3c_master_add_i3c_dev_locked()
{
...
olddev = i3c_master_search_i3c_dev_duplicate(newdev);
...
if (olddev) {
enable_ibi = true;
...
}
i3c_dev_free_ibi_locked(olddev);
^^^^^^^^
This function internally calls i3c_dev_disable_ibi_locked(addr)
function causing to send DISEC command with old Address.
The olddev should not receive any commands on the i3c bus as it
does not exist and has been assigned a new address. This will
result in NACK or timeout. So, update the olddev->ibi->enabled
flag to false to avoid DISEC with OldAddr.
...
}
Signed-off-by: Ravindra Yashvant Shinde <ravindra.yashvant.shinde@nxp.com>
---
drivers/i3c/master.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 7028f03c2c42..07ccb2c00074 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -2042,6 +2042,7 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
if (olddev->ibi->enabled) {
enable_ibi = true;
i3c_dev_disable_ibi_locked(olddev);
+ olddev->ibi->enabled = false;
}
i3c_dev_free_ibi_locked(olddev);
--
2.46.0
--
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: Avoid sending DISEC command with old device address.
2024-08-20 4:38 [PATCH] i3c: master: Avoid sending DISEC command with old device address nxf24178
@ 2024-08-20 14:49 ` Frank Li
0 siblings, 0 replies; 2+ messages in thread
From: Frank Li @ 2024-08-20 14:49 UTC (permalink / raw)
To: nxf24178; +Cc: Alexandre Belloni, moderated list:I3C SUBSYSTEM, open list, imx
On Tue, Aug 20, 2024 at 10:08:17AM +0530, nxf24178 wrote:
Avoid use nxp nxf24178 as your name, please update it with your real name.
> When a new device hotjoins, a new dynamic address is assigned.
> i3c_master_add_i3c_dev_locked() identifies that the device was previously
> attached to the bus and locates the olddev.
>
> i3c_master_add_i3c_dev_locked()
> {
> ...
> olddev = i3c_master_search_i3c_dev_duplicate(newdev);
> ...
> if (olddev) {
> enable_ibi = true;
> ...
> }
> i3c_dev_free_ibi_locked(olddev);
> ^^^^^^^^
> This function internally calls i3c_dev_disable_ibi_locked(addr)
> function causing to send DISEC command with old Address.
>
> The olddev should not receive any commands on the i3c bus as it
> does not exist and has been assigned a new address. This will
> result in NACK or timeout. So, update the olddev->ibi->enabled
> flag to false to avoid DISEC with OldAddr.
> ...
> }
>
> Signed-off-by: Ravindra Yashvant Shinde <ravindra.yashvant.shinde@nxp.com>
> ---
> drivers/i3c/master.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 7028f03c2c42..07ccb2c00074 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2042,6 +2042,7 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
> if (olddev->ibi->enabled) {
> enable_ibi = true;
> i3c_dev_disable_ibi_locked(olddev);
> + olddev->ibi->enabled = false;
> }
you can set olddev->ibi->enable = false unconditional. and add comments
about why set it to false here.
Frank
>
> i3c_dev_free_ibi_locked(olddev);
> --
> 2.46.0
>
--
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:[~2024-08-25 1:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20 4:38 [PATCH] i3c: master: Avoid sending DISEC command with old device address nxf24178
2024-08-20 14:49 ` Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox