[U-Boot] [PATCH v2 22/29] dm: scsi: Document and rename the scsi_scan() parameter
Simon Glass
sjg at chromium.org
Thu Jun 15 03:28:41 UTC 2017
The 'mode' parameter is actually a flag to determine whether to display
a list of devices found during the scan. Rename it to reflect this, add a
function comment and adjust callers to use a boolean.
Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
---
Changes in v2: None
arch/arm/cpu/armv7/ls102xa/ls102xa_sata.c | 2 +-
arch/arm/cpu/armv8/fsl-layerscape/soc.c | 4 ++--
board/highbank/highbank.c | 2 +-
cmd/scsi.c | 4 ++--
common/spl/spl_sata.c | 2 +-
drivers/scsi/scsi.c | 20 ++++++++++----------
include/scsi.h | 8 +++++---
7 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/arch/arm/cpu/armv7/ls102xa/ls102xa_sata.c b/arch/arm/cpu/armv7/ls102xa/ls102xa_sata.c
index 144f2c368d..e11d3a197d 100644
--- a/arch/arm/cpu/armv7/ls102xa/ls102xa_sata.c
+++ b/arch/arm/cpu/armv7/ls102xa/ls102xa_sata.c
@@ -36,7 +36,7 @@ int ls1021a_sata_init(void)
out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG);
ahci_init((void __iomem *)AHCI_BASE_ADDR);
- scsi_scan(0);
+ scsi_scan(false);
return 0;
}
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 0943e833d7..aee1ffa7d4 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -225,7 +225,7 @@ int sata_init(void)
out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG);
ahci_init((void __iomem *)CONFIG_SYS_SATA1);
- scsi_scan(0);
+ scsi_scan(false);
return 0;
}
@@ -244,7 +244,7 @@ int sata_init(void)
out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG);
ahci_init((void __iomem *)CONFIG_SYS_SATA);
- scsi_scan(0);
+ scsi_scan(false);
return 0;
}
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 55999ed226..1af2207867 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -67,7 +67,7 @@ void scsi_init(void)
cphy_disable_overrides();
if (reg & PWRDOM_STAT_SATA) {
ahci_init((void __iomem *)HB_AHCI_BASE);
- scsi_scan(1);
+ scsi_scan(true);
}
}
#endif
diff --git a/cmd/scsi.c b/cmd/scsi.c
index 46171e5436..570971891e 100644
--- a/cmd/scsi.c
+++ b/cmd/scsi.c
@@ -37,7 +37,7 @@ static int do_scsi(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (strncmp(argv[1], "res", 3) == 0) {
printf("\nReset SCSI\n");
scsi_bus_reset(NULL);
- ret = scsi_scan(1);
+ ret = scsi_scan(true);
if (ret)
return CMD_RET_FAILURE;
return ret;
@@ -55,7 +55,7 @@ static int do_scsi(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
return 0;
}
if (strncmp(argv[1], "scan", 4) == 0) {
- ret = scsi_scan(1);
+ ret = scsi_scan(true);
if (ret)
return CMD_RET_FAILURE;
return ret;
diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index 5476206131..bac11f64f1 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -34,7 +34,7 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
return err;
} else {
/* try to recognize storage devices immediately */
- scsi_scan(0);
+ scsi_scan(false);
stor_dev = blk_get_devnum_by_type(IF_TYPE_SCSI, 0);
if (!stor_dev)
return -ENODEV;
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 9232f3a824..f3f8d31e1a 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -326,7 +326,7 @@ void scsi_init(void)
#endif
bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci");
scsi_low_level_init(busdevfunc);
- scsi_scan(1);
+ scsi_scan(true);
bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI);
}
#endif
@@ -555,7 +555,7 @@ removable:
* to the user if mode = 1
*/
#if defined(CONFIG_DM_SCSI)
-static int do_scsi_scan_one(struct udevice *dev, int id, int lun, int mode)
+static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
{
int ret;
struct udevice *bdev;
@@ -594,21 +594,21 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, int mode)
memcpy(&bdesc->revision, &bd.revision, sizeof(bd.revision));
part_init(bdesc);
- if (mode == 1) {
+ if (verbose) {
printf(" Device %d: ", 0);
dev_print(bdesc);
}
return 0;
}
-int scsi_scan(int mode)
+int scsi_scan(bool verbose)
{
unsigned char i, lun;
struct uclass *uc;
struct udevice *dev; /* SCSI controller */
int ret;
- if (mode == 1)
+ if (verbose)
printf("scanning bus for devices...\n");
blk_unbind_all(IF_TYPE_SCSI);
@@ -630,18 +630,18 @@ int scsi_scan(int mode)
for (i = 0; i < plat->max_id; i++)
for (lun = 0; lun < plat->max_lun; lun++)
- do_scsi_scan_one(dev, i, lun, mode);
+ do_scsi_scan_one(dev, i, lun, verbose);
}
return 0;
}
#else
-int scsi_scan(int mode)
+int scsi_scan(bool verbose)
{
unsigned char i, lun;
int ret;
- if (mode == 1)
+ if (verbose)
printf("scanning bus for devices...\n");
for (i = 0; i < CONFIG_SYS_SCSI_MAX_DEVICE; i++)
scsi_init_dev_desc(&scsi_dev_desc[i], i);
@@ -655,10 +655,10 @@ int scsi_scan(int mode)
continue;
part_init(&scsi_dev_desc[scsi_max_devs]);
- if (mode == 1) {
+ if (verbose) {
printf(" Device %d: ", 0);
dev_print(&scsi_dev_desc[scsi_max_devs]);
- } /* if mode */
+ }
scsi_max_devs++;
} /* next LUN */
}
diff --git a/include/scsi.h b/include/scsi.h
index af07dbe6db..20f6932602 100644
--- a/include/scsi.h
+++ b/include/scsi.h
@@ -199,10 +199,12 @@ void scsi_init(void);
int scsi_exec(struct udevice *dev, struct scsi_cmd *pccb);
int scsi_bus_reset(struct udevice *dev);
-/***************************************************************************
- * functions residing inside cmd_scsi.c
+/**
+ * scsi_scan() - Scan all SCSI controllers for available devices
+ *
+ * @vebose: true to show information about each device found
*/
-int scsi_scan(int mode);
+int scsi_scan(bool verbose);
#define SCSI_IDENTIFY 0xC0 /* not used */
--
2.13.1.518.g3df882009-goog
More information about the U-Boot
mailing list