[U-Boot] [RFC PATCH 4/5] scsi: Move pccb buffer initalization directly to scsi_detect_dev
Michal Simek
michal.simek at xilinx.com
Fri Nov 18 16:44:49 CET 2016
pccb is pointer to temporary buffer which is used only for sending
command. Make it local as is done in scsi_read/scsi_write.
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---
common/scsi.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/common/scsi.c b/common/scsi.c
index c8d43c5b188d..4ac31fe8118b 100644
--- a/common/scsi.c
+++ b/common/scsi.c
@@ -480,12 +480,14 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum)
#endif
}
-static int scsi_detect_dev(ccb *pccb, struct blk_desc *dev_desc)
+static int scsi_detect_dev(int target, struct blk_desc *dev_desc)
{
unsigned char perq, modi;
lbaint_t capacity;
unsigned long blksz;
+ ccb *pccb = (ccb *)&tempccb;
+ pccb->target = target;
pccb->lun = dev_desc->lun;
pccb->pdata = (unsigned char *)&tempbuff;
pccb->datalen = 512;
@@ -553,7 +555,6 @@ void scsi_scan(int mode)
{
unsigned char i, lun;
int ret;
- ccb *pccb = (ccb *)&tempccb;
if (mode == 1)
printf("scanning bus for devices...\n");
@@ -562,11 +563,9 @@ void scsi_scan(int mode)
scsi_max_devs = 0;
for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) {
- pccb->target = i;
for (lun = 0; lun < CONFIG_SYS_SCSI_MAX_LUN; lun++) {
scsi_dev_desc[scsi_max_devs].lun = lun;
- ret = scsi_detect_dev(pccb,
- &scsi_dev_desc[scsi_max_devs]);
+ ret = scsi_detect_dev(i, &scsi_dev_desc[scsi_max_devs]);
if (ret)
continue;
--
1.9.1
More information about the U-Boot
mailing list