Prepare LUN(Logical unit number) directly in block description structure
and reuse it.

Signed-off-by: Michal Simek <michal.si...@xilinx.com>
---

 common/scsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/scsi.c b/common/scsi.c
index a02c7a505639..c8d43c5b188d 100644
--- a/common/scsi.c
+++ b/common/scsi.c
@@ -480,13 +480,13 @@ 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, int lun)
+static int scsi_detect_dev(ccb *pccb, struct blk_desc *dev_desc)
 {
        unsigned char perq, modi;
        lbaint_t capacity;
        unsigned long blksz;
 
-       pccb->lun = lun;
+       pccb->lun = dev_desc->lun;
        pccb->pdata = (unsigned char *)&tempbuff;
        pccb->datalen = 512;
        scsi_setup_inquiry(pccb);
@@ -564,9 +564,9 @@ void scsi_scan(int mode)
        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],
-                                             lun);
+                                             &scsi_dev_desc[scsi_max_devs]);
                        if (ret)
                                continue;
 
-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to