diff mbox series

[linux,dev-5.4,3/3] fsi: core: Disable link when slave init fails

Message ID 20200406191938.31156-4-eajames@linux.ibm.com
State Not Applicable, archived
Headers show
Series fsi: Disable link when slave init fails | expand

Commit Message

Eddie James April 6, 2020, 7:19 p.m. UTC
In the case that links don't have slaves or fail to be accessed, the
master should disable the link during the scan.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 drivers/fsi/fsi-core.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Andrew Jeffery April 10, 2020, 4:52 a.m. UTC | #1
On Tue, 7 Apr 2020, at 04:49, Eddie James wrote:
> In the case that links don't have slaves or fail to be accessed, the
> master should disable the link during the scan.

What are the side-effects of leaving it enabled?

Andrew
diff mbox series

Patch

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;