[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <da3aa376f3d93cfef8c7c03793f3ad8a0121e97c.1480917789.git.fthain@telegraphics.com.au>
Date: Mon, 5 Dec 2016 01:07:19 -0500 (EST)
From: Finn Thain <fthain@...egraphics.com.au>
To: "James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Ondrej Zary <linux@...nbow-software.org>
Cc: Michael Schmitz <schmitzmic@...il.com>, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/4] g_NCR5380: Check for chip presence before calling
NCR5380_init()
From: Ondrej Zary <linux@...nbow-software.org>
Write and read back mode register to check that a chip is really there.
If no card is present, reads result in 0xff.
Signed-off-by: Ondrej Zary <linux@...nbow-software.org>
Signed-off-by: Finn Thain <fthain@...egraphics.com.au>
---
drivers/scsi/g_NCR5380.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index de5147a..76e3745 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -248,6 +248,13 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
}
}
+ /* Check for vacant slot */
+ NCR5380_write(MODE_REG, 0);
+ if (NCR5380_read(MODE_REG) != 0) {
+ ret = -ENODEV;
+ goto out_unregister;
+ }
+
ret = NCR5380_init(instance, flags | FLAG_LATE_DMA_SETUP);
if (ret)
goto out_unregister;
--
2.7.3
Powered by blists - more mailing lists