From patchwork Fri Nov 25 15:00:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 699264 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tQK5T6xtLz9t2C for ; Sat, 26 Nov 2016 02:01:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="okPtGBm9"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A1478B3844; Fri, 25 Nov 2016 16:00:53 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LiEoEwyFq30W; Fri, 25 Nov 2016 16:00:53 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B7D42B3846; Fri, 25 Nov 2016 16:00:45 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D1F694BA16 for ; Fri, 25 Nov 2016 16:00:33 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6GguSu_AQ_nT for ; Fri, 25 Nov 2016 16:00:33 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by theia.denx.de (Postfix) with ESMTPS id 8662A4B98B for ; Fri, 25 Nov 2016 16:00:30 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id u144so8033217wmu.0 for ; Fri, 25 Nov 2016 07:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=ZbEUwF+FnfKRqLvHHOa6t916B/1LyymAG9aleDqIRXY=; b=okPtGBm9/5Rs4AwrRkjd8dSK3wePgGdrsHQj6IYGPh3u3KFYPdQy/mbtaA95podPAf hS5O7DKJPtZxzHAYzs2SXhvq9se0ViF6ryWnrfud08Y3bA5/Hru6y1GtQTzuDjXuSedM WEvflIpod/HjihJQwj6IqLk8amxsl8Zw0fQeGOl1ctbyA1cbAHiHs4ssTbYFHaDTcZSZ flHiI5lkUxIyOdh178JWas4H5k2dvfO27BBAEX/6IVJt5LWCeIgQA3I+pu6rH3CdU9Ou vyG4X3Wt3YVvy4jN/5ilXuZxBgPDGTbnQq1rH6qdqCXhq8/teYvhf4n0xuxPXoI5FmSQ bnwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=ZbEUwF+FnfKRqLvHHOa6t916B/1LyymAG9aleDqIRXY=; b=boD+1uDGKtmCQWEVBfKfW/pdUZ+zj4grGPwB6tjRT/qBLYv3fS1zTN+jchpcIJr7oN Qe3jjdmCQ1oNTIBQc0rv/aQWcCqtQuFz3n5O/LGLU1XnmwswWjC3Ezj6HrmIS3t1Q6Pw mMmIWF2DKIicDMK0AM5czp0yQls3YpaG4CDqJILFbcQswyH93dDutO6qaT4RXOQfSfyC N0jPRyR7mFS9YLwXpVossqtvuQ0b81ZC/Hyhtnpm/9GI02mj2EbWk0/sjsSRoRb73xF2 nFc7KrJhEuTiBEWwLjOwmzdtY5Bvp9XLTpRYkGJLZ93oULvE3vriZS9TugP53hJ/PSY6 98Lg== X-Gm-Message-State: AKaTC01m7uiizV/5NsmY26g5IrNYzGXTPZh7mRfqL6ogkbnwdkPCWYcAdbhwXKPUkCRjtQ== X-Received: by 10.28.214.84 with SMTP id n81mr7594993wmg.120.1480086030015; Fri, 25 Nov 2016 07:00:30 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id a13sm13912734wma.18.2016.11.25.07.00.29 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 25 Nov 2016 07:00:29 -0800 (PST) From: Michal Simek To: Simon Glass , agraf@suse.de Date: Fri, 25 Nov 2016 16:00:16 +0100 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Cc: Stephen Warren , u-boot@lists.denx.de, Ed Swarthout , Stefan Roese Subject: [U-Boot] [PATCH v2 3/7] scsi: Take lun from device block description X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Prepare LUN(Logical unit number) directly in block description structure and reuse it. Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- Changes in v2: None common/scsi.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/common/scsi.c b/common/scsi.c index 89926e7a68ae..e8f102a8a4b5 100644 --- a/common/scsi.c +++ b/common/scsi.c @@ -485,20 +485,19 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum) * * @pccb: pointer to temporary SCSI command block * @dev_desc: block device description - * @lun: Logical unit number * * The scsi_detect_dev detects and fills a dev_desc structure when the device is - * detected. + * detected. The LUN number is taken from the struct blk_desc *dev_desc. * * Return: 0 on success, error value otherwise */ -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); @@ -573,9 +572,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;