From patchwork Tue Feb 14 04:58:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 141046 X-Patchwork-Delegate: marek.vasut@gmail.com 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 D68E7B6FBB for ; Tue, 14 Feb 2012 15:59:15 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A16482809B; Tue, 14 Feb 2012 05:58:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 iTI6cfgEs+qF; Tue, 14 Feb 2012 05:58:58 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C8E672809C; Tue, 14 Feb 2012 05:58:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 805972807F for ; Tue, 14 Feb 2012 05:58:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 pa2K13dp30+o for ; Tue, 14 Feb 2012 05:58: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-ey0-f172.google.com (mail-ey0-f172.google.com [209.85.215.172]) by theia.denx.de (Postfix) with ESMTPS id 143CD28080 for ; Tue, 14 Feb 2012 05:58:33 +0100 (CET) Received: by mail-ey0-f172.google.com with SMTP id l12so3174791eaa.3 for ; Mon, 13 Feb 2012 20:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=ZnkfUnA0QP/lkcV4rWPuHn+YiMB9vnFwsURzSEZbYCo=; b=vYNBrtBh96eaCJLZkM7a3RlT8ZXmEKKFjJ/GOjnXDGRyaQIh7MBzFbzgrZ64rSF/1D YA8YHjCayhD97hNGRf4ZR8Hg2SXVXf6LdsDacWhCXznogeaBAmmtH0uZjUVFpBn2E+mt lqCMJPV3fdUZenbGq/0bAkKJ/aujf6DDqhceA= Received: by 10.213.7.20 with SMTP id b20mr159609ebb.73.1329195512878; Mon, 13 Feb 2012 20:58:32 -0800 (PST) Received: from mashiro.kolej.mff.cuni.cz (vasut.kolej.mff.cuni.cz. [78.128.198.52]) by mx.google.com with ESMTPS id o49sm69014354eei.0.2012.02.13.20.58.32 (version=SSLv3 cipher=OTHER); Mon, 13 Feb 2012 20:58:32 -0800 (PST) From: Marek Vasut To: u-boot@lists.denx.de Date: Tue, 14 Feb 2012 05:58:19 +0100 Message-Id: <1329195499-20414-5-git-send-email-marek.vasut@gmail.com> X-Mailer: git-send-email 1.7.8.3 In-Reply-To: <1329195499-20414-1-git-send-email-marek.vasut@gmail.com> References: <1329195499-20414-1-git-send-email-marek.vasut@gmail.com> Subject: [U-Boot] [PATCH 4/4] USB: Staticize usb_storage.c X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Also, make usb_stor_buf local. Signed-off-by: Marek Vasut Cc: Remy Bohmer --- common/usb_storage.c | 39 +++++++++++++++++++-------------------- 1 files changed, 19 insertions(+), 20 deletions(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index de84c8d..1446fb0 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -79,7 +79,6 @@ static const unsigned char us_direction[256/8] = { }; #define US_DIRECTION(x) ((us_direction[x>>3] >> (x & 7)) & 1) -static unsigned char usb_stor_buf[512]; static ccb usb_ccb; /* @@ -164,15 +163,14 @@ static struct us_data usb_stor[USB_MAX_STOR_DEV]; #define USB_STOR_TRANSPORT_FAILED -1 #define USB_STOR_TRANSPORT_ERROR -2 -int usb_stor_get_info(struct usb_device *dev, struct us_data *us, +static int usb_stor_get_info(struct usb_device *dev, struct us_data *us, block_dev_desc_t *dev_desc); -int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, +static int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, struct us_data *ss); -unsigned long usb_stor_read(int device, unsigned long blknr, +static unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer); -unsigned long usb_stor_write(int device, unsigned long blknr, +static unsigned long usb_stor_write(int device, unsigned long blknr, unsigned long blkcnt, const void *buffer); -struct usb_device * usb_get_dev_index(int index); void uhci_show_temp_int_td(void); #ifdef CONFIG_PARTITIONS @@ -182,7 +180,7 @@ block_dev_desc_t *usb_stor_get_dev(int index) } #endif -void usb_show_progress(void) +static void usb_show_progress(void) { debug("."); } @@ -233,9 +231,6 @@ int usb_stor_scan(int mode) unsigned char i; struct usb_device *dev; - /* GJ */ - memset(usb_stor_buf, 0, sizeof(usb_stor_buf)); - if (mode == 1) printf(" scanning bus for storage devices... "); @@ -493,7 +488,7 @@ static int usb_stor_CB_reset(struct us_data *us) * Set up the command for a BBB device. Note that the actual SCSI * command is copied into cbw.CBWCDB. */ -int usb_stor_BBB_comdat(ccb *srb, struct us_data *us) +static int usb_stor_BBB_comdat(ccb *srb, struct us_data *us) { int result; int actlen; @@ -541,7 +536,7 @@ int usb_stor_BBB_comdat(ccb *srb, struct us_data *us) /* FIXME: we also need a CBI_command which sets up the completion * interrupt, and waits for it */ -int usb_stor_CB_comdat(ccb *srb, struct us_data *us) +static int usb_stor_CB_comdat(ccb *srb, struct us_data *us) { int result = 0; int dir_in, retry; @@ -610,7 +605,7 @@ int usb_stor_CB_comdat(ccb *srb, struct us_data *us) } -int usb_stor_CBI_get_status(ccb *srb, struct us_data *us) +static int usb_stor_CBI_get_status(ccb *srb, struct us_data *us) { int timeout; @@ -658,7 +653,7 @@ int usb_stor_CBI_get_status(ccb *srb, struct us_data *us) #define USB_TRANSPORT_NOT_READY_RETRY 10 /* clear a stall on an endpoint - special for BBB devices */ -int usb_stor_BBB_clear_endpt_stall(struct us_data *us, __u8 endpt) +static int usb_stor_BBB_clear_endpt_stall(struct us_data *us, __u8 endpt) { int result; @@ -669,7 +664,7 @@ int usb_stor_BBB_clear_endpt_stall(struct us_data *us, __u8 endpt) return result; } -int usb_stor_BBB_transport(ccb *srb, struct us_data *us) +static int usb_stor_BBB_transport(ccb *srb, struct us_data *us) { int result, retry; int dir_in; @@ -790,7 +785,7 @@ again: return result; } -int usb_stor_CB_transport(ccb *srb, struct us_data *us) +static int usb_stor_CB_transport(ccb *srb, struct us_data *us) { int result, status; ccb *psrb; @@ -1042,7 +1037,7 @@ static void usb_bin_fixup(struct usb_device_descriptor descriptor, } #endif /* CONFIG_USB_BIN_FIXUP */ -unsigned long usb_stor_read(int device, unsigned long blknr, +static unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer) { unsigned long start, blks, buf_addr; @@ -1118,7 +1113,7 @@ retry_it: return blkcnt; } -unsigned long usb_stor_write(int device, unsigned long blknr, +static unsigned long usb_stor_write(int device, unsigned long blknr, unsigned long blkcnt, const void *buffer) { unsigned long start, blks, buf_addr; @@ -1199,7 +1194,7 @@ retry_it: } /* Probe to see if a new device is actually a Storage device */ -int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, +static int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, struct us_data *ss) { struct usb_interface *iface; @@ -1339,13 +1334,17 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, return 1; } -int usb_stor_get_info(struct usb_device *dev, struct us_data *ss, +static int usb_stor_get_info(struct usb_device *dev, struct us_data *ss, block_dev_desc_t *dev_desc) { unsigned char perq, modi; unsigned long cap[2]; unsigned long *capacity, *blksz; ccb *pccb = &usb_ccb; + unsigned char usb_stor_buf[512]; + + /* GJ */ + memset(usb_stor_buf, 0, sizeof(usb_stor_buf)); pccb->pdata = usb_stor_buf;