Skip to content

Commit 9da36a7

Browse files
pthombarcdnsbbrezillon
authored andcommitted
i3c: master add i3c_master_attach_boardinfo to preserve boardinfo
Boardinfo was lost if I3C object for devices with boardinfo available are not created or not added to the I3C device list because of some failure e.g. SETDASA failed, retrieve info failed etc This patch adds i3c_master_attach_boardinfo which scan boardinfo list in the master object and 'attach' it to the I3C device object. Fixes: 3a379bb ("i3c: Add core I3C infrastructure") Signed-off-by: Parshuram Thombare <pthombar@cadence.com> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://lore.kernel.org/linux-i3c/1590053542-389-1-git-send-email-pthombar@cadence.com
1 parent 9123e3a commit 9da36a7

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

drivers/i3c/master.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,21 @@ static void i3c_master_bus_cleanup(struct i3c_master_controller *master)
17821782
i3c_master_detach_free_devs(master);
17831783
}
17841784

1785+
static void i3c_master_attach_boardinfo(struct i3c_dev_desc *i3cdev)
1786+
{
1787+
struct i3c_master_controller *master = i3cdev->common.master;
1788+
struct i3c_dev_boardinfo *i3cboardinfo;
1789+
1790+
list_for_each_entry(i3cboardinfo, &master->boardinfo.i3c, node) {
1791+
if (i3cdev->info.pid != i3cboardinfo->pid)
1792+
continue;
1793+
1794+
i3cdev->boardinfo = i3cboardinfo;
1795+
i3cdev->info.static_addr = i3cboardinfo->static_addr;
1796+
return;
1797+
}
1798+
}
1799+
17851800
static struct i3c_dev_desc *
17861801
i3c_master_search_i3c_dev_duplicate(struct i3c_dev_desc *refdev)
17871802
{
@@ -1837,10 +1852,10 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
18371852
if (ret)
18381853
goto err_detach_dev;
18391854

1855+
i3c_master_attach_boardinfo(newdev);
1856+
18401857
olddev = i3c_master_search_i3c_dev_duplicate(newdev);
18411858
if (olddev) {
1842-
newdev->boardinfo = olddev->boardinfo;
1843-
newdev->info.static_addr = olddev->info.static_addr;
18441859
newdev->dev = olddev->dev;
18451860
if (newdev->dev)
18461861
newdev->dev->desc = newdev;

0 commit comments

Comments
 (0)