summaryrefslogtreecommitdiffstats
path: root/drivers/fsi
diff options
context:
space:
mode:
authorEddie James <eajames@linux.ibm.com>2020-06-09 23:39:28 +0200
committerJoel Stanley <joel@jms.id.au>2020-09-10 04:52:48 +0200
commitb36875a453ef8cb429f5e1064a7329b751fd0dda (patch)
tree4f643a401a7a13fc6e5450ac7b4a88c4f8db4e69 /drivers/fsi
parentfsi: master: Add boolean parameter to link_enable function (diff)
downloadlinux-b36875a453ef8cb429f5e1064a7329b751fd0dda.tar.xz
linux-b36875a453ef8cb429f5e1064a7329b751fd0dda.zip
fsi: core: Disable link when slave init fails
In the case that links don't have slaves or fail to be accessed, the master should disable the link during the scan since it won't be using the slave. Signed-off-by: Eddie James <eajames@linux.ibm.com> Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/fsi')
-rw-r--r--drivers/fsi/fsi-core.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 0743bba42757..c9c3842f6e62 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1154,6 +1154,14 @@ static int fsi_master_write(struct fsi_master *master, int link,
return rc;
}
+static int fsi_master_link_disable(struct fsi_master *master, int link)
+{
+ if (master->link_enable)
+ return master->link_enable(master, link, false);
+
+ return 0;
+}
+
static int fsi_master_link_enable(struct fsi_master *master, int link)
{
if (master->link_enable)
@@ -1192,12 +1200,15 @@ static int fsi_master_scan(struct fsi_master *master)
}
rc = fsi_master_break(master, link);
if (rc) {
+ fsi_master_link_disable(master, link);
dev_dbg(&master->dev,
"break to link %d failed: %d\n", link, rc);
continue;
}
- fsi_slave_init(master, link, 0);
+ rc = fsi_slave_init(master, link, 0);
+ if (rc)
+ fsi_master_link_disable(master, link);
}
return 0;