summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2016-11-18 16:14:24 +0100
committerMichal Simek <michal.simek@xilinx.com>2016-12-02 14:37:21 +0100
commitbccfd9e9675fffa95e370b3fb02b14832c4f4bf7 (patch)
tree4d12260c34332bb0ebc5a8132473f35d6addd96c /common
parent4dbee176f80e98f4925c7e67e7bb42f896f8798e (diff)
scsi: Move pccb buffer initalization directly to scsi_detect_dev
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@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/scsi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/scsi.c b/common/scsi.c
index e8f102a8a4..5a925bafda 100644
--- a/common/scsi.c
+++ b/common/scsi.c
@@ -480,10 +480,11 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum)
#endif
}
+
/**
* scsi_detect_dev - Detect scsi device
*
- * @pccb: pointer to temporary SCSI command block
+ * @target: target id
* @dev_desc: block device description
*
* The scsi_detect_dev detects and fills a dev_desc structure when the device is
@@ -491,12 +492,14 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum)
*
* Return: 0 on success, error value otherwise
*/
-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;
@@ -561,7 +564,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");
@@ -570,11 +572,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;