From patchwork Mon Apr 8 10:35:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 15965 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 664FC23900 for ; Mon, 8 Apr 2013 10:38:13 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id p12sf7376270vbe.4 for ; Mon, 08 Apr 2013 03:37:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-brightmail-tracker:x-brightmail-tracker :dlp-filter:x-mtr:x-cfilter-loop:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=hNMQwlF6FPHyAzg+ANR8YnkUgaGRrdDDPEdak/eagSM=; b=GwB4FOG5hk8Tjl/NTlFqjmMtRJCuz9J66tSic75Nho/eRVo4NDw3BRmh9hjLdGGuxa arsZVlwqb+0qXbaxF6uxg9PAIgIUww7ZZyl65rFxTeqN9UoxIVQCHZJHjP471lT+ZPVP i8+CdvEUT66JOUn+We239bhJTQ4GUoAC+rL3eu2qX8VLZpQ9c88TxhMkT1LZFpAs9oB/ IcV/NGz/SeXYuANyissz3w0tAyfvzbBVrBPHuEZhPkWu08yZ22rv2h65PXMuY0NkU2QQ A43A7TBafd/7DrxPlYscSi7j3XZxg0hb/sNsNLbY/t57WiGcedsmROyHX2Kj6+A9QfjJ qsVg== X-Received: by 10.224.207.2 with SMTP id fw2mr5611921qab.6.1365417479162; Mon, 08 Apr 2013 03:37:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.66 with SMTP id a2ls3160868qeo.30.gmail; Mon, 08 Apr 2013 03:37:59 -0700 (PDT) X-Received: by 10.220.228.74 with SMTP id jd10mr7708910vcb.65.1365417479075; Mon, 08 Apr 2013 03:37:59 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id c9si18003241vcw.73.2013.04.08.03.37.59 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 03:37:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id 15so5234217vea.15 for ; Mon, 08 Apr 2013 03:37:59 -0700 (PDT) X-Received: by 10.52.21.212 with SMTP id x20mr12913395vde.106.1365417478817; Mon, 08 Apr 2013 03:37:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.85.136 with SMTP id h8csp12560vez; Mon, 8 Apr 2013 03:37:58 -0700 (PDT) X-Received: by 10.66.154.76 with SMTP id vm12mr35690021pab.106.1365417477797; Mon, 08 Apr 2013 03:37:57 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id zh8si29000657pac.274.2013.04.08.03.37.56; Mon, 08 Apr 2013 03:37:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of gautam.vivek@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKX00A7PMU51V11@mailout4.samsung.com> for patches@linaro.org; Mon, 08 Apr 2013 19:37:56 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 7A.49.20872.30E92615; Mon, 08 Apr 2013 19:37:56 +0900 (KST) X-AuditID: cbfee68d-b7f786d000005188-43-51629e03bf47 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id EF.1E.17838.30E92615; Mon, 08 Apr 2013 19:37:55 +0900 (KST) Received: from vivekkumarg-linuxpc.sisodomain.com ([107.108.214.169]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MKX008PGMUQGH60@mmp1.samsung.com>; Mon, 08 Apr 2013 19:37:55 +0900 (KST) From: Vivek Gautam To: u-boot@lists.denx.de Cc: patches@linaro.org, u-boot-review@google.com, marex@denx.de, sjg@chromium.org, rajeshwari.s@samsung.com, vikas.sajjan@samsung.com, amarendra.xt@samsung.com Subject: [PATCH v2 1/5] USB: Some cleanup prior to USB 3.0 interface addition Date: Mon, 08 Apr 2013 16:05:54 +0530 Message-id: <1365417358-31921-2-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <1365417358-31921-1-git-send-email-gautam.vivek@samsung.com> References: <1365417358-31921-1-git-send-email-gautam.vivek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeLIzCtJLcpLzFFi42JZI2JSq8syLynQYOdjZosvCzrZLd60NTJa TDn8hcWiZe0BVotvW7YxWix/vZHd4u1eoOzNZ9uZHDg8ZjdcZPGYN+sEi8eCTaUed67tYfM4 e2cHo0ffllWMAWxRXDYpqTmZZalF+nYJXBm7XkxlKWhTr3i4cSFrA+MruS5GTg4JAROJ1Tdu skPYYhIX7q1n62Lk4hASWMoocePLIzaYoldTnj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CjAwajEwyv5IzFQiDWxrLgy9xCjBAezkgiv+MykQCHe lMTKqtSi/Pii0pzU4kOMyUBHTWSWEk3OB0Z9Xkm8obGJuamxqaWJhYmZJWnCSuK8B1qtA4UE 0hNLUrNTUwtSi2C2MHFwSjUwnlvG4fqFq3PTiSnfHlua3pvGOyP7Y9lp8WOygksEv6XHcAY+ e7fsnGbg/YsvHuybl68yb06b2HdHKT0uPfmqzfdPPP7+8tHikhVrwz6pcAXXWm5fn3WF9W49 +7xdxdluf1Yac3Rt8WUPnLH9+yHmJxunWL4xy9ofZad7w1tPOZXfI3XZytQHT5RYijMSDbWY i4oTAW4rpgnwAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQkhVd5NkF78RPNUbXBYwtm4AybslV8+KtCYTTvck+d1G6+esHULt4CN3fs3QKlQTRpzVmrs X-Original-Sender: gautam.vivek@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Some cleanup in usb framework, nothing much on feature side. Signed-off-by: Vikas C Sajjan Signed-off-by: Vivek Gautam --- common/usb.c | 21 +++++++++++++-------- common/usb_storage.c | 30 ++++++++++++++++-------------- include/usb_defs.h | 2 +- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/common/usb.c b/common/usb.c index 6fc0fc1..872d62f 100644 --- a/common/usb.c +++ b/common/usb.c @@ -360,6 +360,7 @@ static int usb_parse_config(struct usb_device *dev, int index, ifno, epno, curr_if_num; int i; u16 ep_wMaxPacketSize; + struct usb_interface *if_desc = NULL; ifno = -1; epno = -1; @@ -387,23 +388,27 @@ static int usb_parse_config(struct usb_device *dev, &buffer[index])->bInterfaceNumber != curr_if_num) { /* this is a new interface, copy new desc */ ifno = dev->config.no_of_if; + if_desc = &dev->config.if_desc[ifno]; dev->config.no_of_if++; - memcpy(&dev->config.if_desc[ifno], - &buffer[index], buffer[index]); - dev->config.if_desc[ifno].no_of_ep = 0; - dev->config.if_desc[ifno].num_altsetting = 1; + memcpy(if_desc, &buffer[index], buffer[index]); + if_desc->no_of_ep = 0; + if_desc->num_altsetting = 1; curr_if_num = - dev->config.if_desc[ifno].desc.bInterfaceNumber; + if_desc->desc.bInterfaceNumber; } else { /* found alternate setting for the interface */ - dev->config.if_desc[ifno].num_altsetting++; + if (ifno >= 0) { + if_desc = &dev->config.if_desc[ifno]; + if_desc->num_altsetting++; + } } break; case USB_DT_ENDPOINT: epno = dev->config.if_desc[ifno].no_of_ep; + if_desc = &dev->config.if_desc[ifno]; /* found an endpoint */ - dev->config.if_desc[ifno].no_of_ep++; - memcpy(&dev->config.if_desc[ifno].ep_desc[epno], + if_desc->no_of_ep++; + memcpy(&if_desc->ep_desc[epno], &buffer[index], buffer[index]); ep_wMaxPacketSize = get_unaligned(&dev->config.\ if_desc[ifno].\ diff --git a/common/usb_storage.c b/common/usb_storage.c index fb322b4..7115992 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -278,9 +278,9 @@ int usb_stor_scan(int mode) lun++) { usb_dev_desc[usb_max_devs].lun = lun; if (usb_stor_get_info(dev, &usb_stor[start], - &usb_dev_desc[usb_max_devs]) == 1) { - usb_max_devs++; - } + &usb_dev_desc[usb_max_devs]) == 1) { + usb_max_devs++; + } } } /* if storage device */ @@ -511,7 +511,7 @@ static int usb_stor_BBB_comdat(ccb *srb, struct us_data *us) dir_in = US_DIRECTION(srb->cmd[0]); #ifdef BBB_COMDAT_TRACE - printf("dir %d lun %d cmdlen %d cmd %p datalen %d pdata %p\n", + printf("dir %d lun %d cmdlen %d cmd %p datalen %lu pdata %p\n", dir_in, srb->lun, srb->cmdlen, srb->cmd, srb->datalen, srb->pdata); if (srb->cmdlen) { @@ -1218,6 +1218,7 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, { struct usb_interface *iface; int i; + struct usb_endpoint_descriptor *ep_desc; unsigned int flags = 0; int protocol = 0; @@ -1300,24 +1301,25 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, * We will ignore any others. */ for (i = 0; i < iface->desc.bNumEndpoints; i++) { + ep_desc = &iface->ep_desc[i]; /* is it an BULK endpoint? */ - if ((iface->ep_desc[i].bmAttributes & + if ((ep_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) { - if (iface->ep_desc[i].bEndpointAddress & USB_DIR_IN) - ss->ep_in = iface->ep_desc[i].bEndpointAddress & - USB_ENDPOINT_NUMBER_MASK; + if (ep_desc->bEndpointAddress & USB_DIR_IN) + ss->ep_in = ep_desc->bEndpointAddress & + USB_ENDPOINT_NUMBER_MASK; else ss->ep_out = - iface->ep_desc[i].bEndpointAddress & + ep_desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; } /* is it an interrupt endpoint? */ - if ((iface->ep_desc[i].bmAttributes & - USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) { - ss->ep_int = iface->ep_desc[i].bEndpointAddress & - USB_ENDPOINT_NUMBER_MASK; - ss->irqinterval = iface->ep_desc[i].bInterval; + if ((ep_desc->bmAttributes & + USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) { + ss->ep_int = ep_desc->bEndpointAddress & + USB_ENDPOINT_NUMBER_MASK; + ss->irqinterval = ep_desc->bInterval; } } USB_STOR_PRINTF("Endpoints In %d Out %d Int %d\n", diff --git a/include/usb_defs.h b/include/usb_defs.h index 9502544..0c78d9d 100644 --- a/include/usb_defs.h +++ b/include/usb_defs.h @@ -234,7 +234,7 @@ #define HUB_CHAR_OCPM 0x0018 /* - *Hub Status & Hub Change bit masks + * Hub Status & Hub Change bit masks */ #define HUB_STATUS_LOCAL_POWER 0x0001 #define HUB_STATUS_OVERCURRENT 0x0002