summaryrefslogtreecommitdiff
path: root/common/usb.c
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-08-09 09:43:40 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:27 -0700
commitdae320288dcda9cae8a98b885e16ba8251294840 (patch)
treee7c7b27e2f95517c536ea210704358738d5a676a /common/usb.c
parent0c8b6583a0a9c23c9041c790a78ec6aaeb7d69dc (diff)
Fix compiler warnings generated by gcc 4.6.
The newer compiler version is more thorough in detecting code inconsistencies, and reports warnings in many cases when building u-boot for kaen and alex. This change modifies the code to get rid of the warnings. There supposed to be no logical changes, so no testing other than building the system is being done. The files not yet upstreamed are excluded and will be submitted separately. BUG=chromium-os:18862 TEST=manual . run the following commands emerge-tegra2_kaen chromeos-u-boot emerge-x86-alex chromeos-u-boot . observe them succeed Change-Id: I4c872d84352539d24a418ba910274d08d02d26a8 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/5706 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/usb.c')
-rw-r--r--common/usb.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/common/usb.c b/common/usb.c
index e099d4715d6..9ae6c292810 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -354,8 +354,6 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
{
struct usb_descriptor_header *head;
int index, ifno, epno, curr_if_num;
- int i;
- unsigned char *ch;
ifno = -1;
epno = -1;
@@ -412,12 +410,15 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)
USB_PRINTF("unknown Description Type : %x\n",
head->bDescriptorType);
+#ifdef USB_DEBUG
{
- ch = (unsigned char *)head;
+ int i;
+ unsigned char *ch = (unsigned char *)head;
for (i = 0; i < head->bLength; i++)
USB_PRINTF("%02X ", *ch++);
USB_PRINTF("\n\n\n");
}
+#endif
break;
}
index += head->bLength;
@@ -1217,7 +1218,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
{
struct usb_device *usb;
struct usb_port_status portsts;
- unsigned short portstatus, portchange;
+ unsigned short portstatus;
/* Check status */
if (usb_get_port_status(dev, port + 1, &portsts) < 0) {
@@ -1226,9 +1227,10 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
}
portstatus = le16_to_cpu(portsts.wPortStatus);
- portchange = le16_to_cpu(portsts.wPortChange);
USB_HUB_PRINTF("portstatus %x, change %x, %s\n",
- portstatus, portchange, portspeed(portstatus));
+ portstatus,
+ le16_to_cpu(portsts.wPortChange),
+ portspeed(portstatus));
/* Clear the connection change status */
usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_CONNECTION);
@@ -1275,7 +1277,6 @@ int usb_hub_configure(struct usb_device *dev)
{
unsigned char buffer[USB_BUFSIZ], *bitmap;
struct usb_hub_descriptor *descriptor;
- struct usb_hub_status *hubsts;
int i;
struct usb_hub_device *hub;
@@ -1379,16 +1380,22 @@ int usb_hub_configure(struct usb_device *dev)
return -1;
}
- hubsts = (struct usb_hub_status *)buffer;
- USB_HUB_PRINTF("get_hub_status returned status %X, change %X\n",
- le16_to_cpu(hubsts->wHubStatus),
- le16_to_cpu(hubsts->wHubChange));
- USB_HUB_PRINTF("local power source is %s\n",
- (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_LOCAL_POWER) ? \
- "lost (inactive)" : "good");
- USB_HUB_PRINTF("%sover-current condition exists\n",
- (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? \
- "" : "no ");
+#ifdef USB_HUB_DEBUG
+ {
+ struct usb_hub_status *hubsts = (struct usb_hub_status *)buffer;
+ USB_HUB_PRINTF("get_hub_status returned status %X, change %X\n",
+ le16_to_cpu(hubsts->wHubStatus),
+ le16_to_cpu(hubsts->wHubChange));
+ USB_HUB_PRINTF("local power source is %s\n",
+ (le16_to_cpu(hubsts->wHubStatus) &
+ HUB_STATUS_LOCAL_POWER) ?
+ "lost (inactive)" : "good");
+ USB_HUB_PRINTF("%sover-current condition exists\n",
+ (le16_to_cpu(hubsts->wHubStatus) &
+ HUB_STATUS_OVERCURRENT) ?
+ "" : "no ");
+ }
+#endif
usb_hub_power_on(hub);
for (i = 0; i < dev->maxchild; i++) {