public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]  usb/core/hub.c: fix sparse warnings
@ 2009-04-16  1:44 H Hartley Sweeten
  2009-04-22  5:51 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: H Hartley Sweeten @ 2009-04-16  1:44 UTC (permalink / raw)
  To: linux-kernel

Fix sparse warning in drivers/usb/core/hub.c.

	warning: symbol 'temp' shadows an earlier one

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>

---

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index be86ae3..8ab98c9 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -457,13 +457,13 @@ static void hub_tt_kevent (struct work_struct
*work)
 
 	spin_lock_irqsave (&hub->tt.lock, flags);
 	while (--limit && !list_empty (&hub->tt.clear_list)) {
-		struct list_head	*temp;
+		struct list_head	*next;
 		struct usb_tt_clear	*clear;
 		struct usb_device	*hdev = hub->hdev;
 		int			status;
 
-		temp = hub->tt.clear_list.next;
-		clear = list_entry (temp, struct usb_tt_clear,
clear_list);
+		next = hub->tt.clear_list.next;
+		clear = list_entry (next, struct usb_tt_clear,
clear_list);
 		list_del (&clear->clear_list);
 
 		/* drop lock so HCD can concurrently report other TT
errors */
@@ -518,7 +518,7 @@ void usb_hub_tt_clear_buffer (struct usb_device
*udev, int pipe)
 			: (USB_ENDPOINT_XFER_BULK << 11);
 	if (usb_pipein (pipe))
 		clear->devinfo |= 1 << 15;
-	
+
 	/* tell keventd to clear state for this TT */
 	spin_lock_irqsave (&tt->lock, flags);
 	list_add_tail (&clear->clear_list, &tt->clear_list);
@@ -571,7 +571,7 @@ static int hub_hub_status(struct usb_hub *hub,
 			"%s failed (err = %d)\n", __func__, ret);
 	else {
 		*status = le16_to_cpu(hub->status->hub.wHubStatus);
-		*change = le16_to_cpu(hub->status->hub.wHubChange); 
+		*change = le16_to_cpu(hub->status->hub.wHubChange);
 		ret = 0;
 	}
 	mutex_unlock(&hub->status_mutex);
@@ -2330,7 +2330,7 @@ static inline int remote_wakeup(struct usb_device
*udev)
  * Between connect detection and reset signaling there must be a delay
  * of 100ms at least for debounce and power-settling.  The
corresponding
  * timer shall restart whenever the downstream port detects a
disconnect.
- * 
+ *
  * Apparently there are some bluetooth and irda-dongles and a number of
  * low-speed devices for which this debounce period may last over a
second.
  * Not covered by the spec - but easy to deal with.
@@ -2490,7 +2490,7 @@ hub_port_init (struct usb_hub *hub, struct
usb_device *udev, int port1,
 	default:
 		goto fail;
 	}
- 
+
 	type = "";
 	switch (udev->speed) {
 	case USB_SPEED_LOW:	speed = "low";	break;
@@ -2516,7 +2516,7 @@ hub_port_init (struct usb_hub *hub, struct
usb_device *udev, int port1,
 		udev->tt = &hub->tt;
 		udev->ttport = port1;
 	}
- 
+
 	/* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
 	 * Because device hardware and firmware is sometimes buggy in
 	 * this area, and this is how Linux has done it for ages.
@@ -2647,7 +2647,7 @@ hub_port_init (struct usb_hub *hub, struct
usb_device *udev, int port1,
 		udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i);
 		usb_ep0_reinit(udev);
 	}
-  
+
 	retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE);
 	if (retval < (signed)sizeof(udev->descriptor)) {
 		dev_err(&udev->dev, "device descriptor read/all, error
%d\n",
@@ -2894,7 +2894,7 @@ static void hub_port_connect_change(struct usb_hub
*hub, int port1,
 				goto loop_disable;
 			}
 		}
- 
+
 		/* check for devices running slower than they could */
 		if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0200
 				&& udev->speed == USB_SPEED_FULL
@@ -2951,7 +2951,7 @@ loop:
 			!(hcd->driver->port_handed_over)(hcd, port1))
 		dev_err(hub_dev, "unable to enumerate USB device on port
%d\n",
 				port1);
- 
+
 done:
 	hub_port_disable(hub, port1, 1);
 	if (hcd->driver->relinquish_port && !hub->hdev->parent)
@@ -3077,7 +3077,7 @@ static void hub_events(void)
 				 * EM interference sometimes causes
badly
 				 * shielded USB devices to be shutdown
by
 				 * the hub, this hack enables them
again.
-				 * Works at least with mouse driver. 
+				 * Works at least with mouse driver.
 				 */
 				if (!(portstatus & USB_PORT_STAT_ENABLE)
 				    && !connect_change
@@ -3112,7 +3112,7 @@ static void hub_events(void)
 					"resume on port %d, status
%d\n",
 					i, ret);
 			}
-			
+
 			if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
 				dev_err (hub_dev,
 					"over-current change on port
%d\n",
@@ -3386,7 +3386,7 @@ static int usb_reset_and_verify_device(struct
usb_device *udev)
 
 	if (ret < 0)
 		goto re_enumerate;
- 
+
 	/* Device might have changed firmware (DFU or similar) */
 	if (descriptors_changed(udev, &descriptor)) {
 		dev_info(&udev->dev, "device firmware changed\n");
@@ -3440,7 +3440,7 @@ static int usb_reset_and_verify_device(struct
usb_device *udev)
 
 done:
 	return 0;
- 
+
 re_enumerate:
 	hub_port_logical_disconnect(parent_hub, port1);
 	return -ENODEV; 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH]  usb/core/hub.c: fix sparse warnings
  2009-04-16  1:44 [PATCH] usb/core/hub.c: fix sparse warnings H Hartley Sweeten
@ 2009-04-22  5:51 ` Greg KH
  2009-04-22 17:25   ` H Hartley Sweeten
  2009-04-22 20:03   ` H Hartley Sweeten
  0 siblings, 2 replies; 4+ messages in thread
From: Greg KH @ 2009-04-22  5:51 UTC (permalink / raw)
  To: H Hartley Sweeten; +Cc: linux-kernel

On Wed, Apr 15, 2009 at 09:44:44PM -0400, H Hartley Sweeten wrote:
> Fix sparse warning in drivers/usb/core/hub.c.
> 
> 	warning: symbol 'temp' shadows an earlier one

Odd, I'm not seeing that when I run sparse on this file.  What version
of sparse are you using?

Also, the patch is line-wrapped and you delete a lot of trailing spaces.
Deleting trailing spaces is nice, but that's not what you said you were
doing here in this patch, so I'm going to have to drop it.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH]  usb/core/hub.c: fix sparse warnings
  2009-04-22  5:51 ` Greg KH
@ 2009-04-22 17:25   ` H Hartley Sweeten
  2009-04-22 20:03   ` H Hartley Sweeten
  1 sibling, 0 replies; 4+ messages in thread
From: H Hartley Sweeten @ 2009-04-22 17:25 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

On Tuesday, April 21, 2009 10:51 PM, Greg KH wrote:
> On Wed, Apr 15, 2009 at 09:44:44PM -0400, H Hartley Sweeten wrote:
>> Fix sparse warning in drivers/usb/core/hub.c.
>> 
>> 	warning: symbol 'temp' shadows an earlier one
>
> Odd, I'm not seeing that when I run sparse on this file.  What
> version of sparse are you using?

Not sure about the sparse version.  I obtained the most recent version
with git on 15 Apr 2009.

I just rechecked the original file and I do see the warning.

  CHECK   drivers/usb/core/hub.c
drivers/usb/core/hub.c:472:3: warning: symbol 'temp' shadows an earlier
One drivers/usb/core/hub.c:460:20: originally declared here

This was found on a EP93xx ARM platform. It appears the sparse warning 
is caused by the raw_local_irq_save() macro in
arch/arm/include/asm/irqflags.h.

> Also, the patch is line-wrapped and you delete a lot of trailing
> spaces. Deleting trailing spaces is nice, but that's not what you
> said you were doing here in this patch, so I'm going to have to
> drop it.

Sorry about the line-wrapping. I'm still trying to work that out.

I noticed the trailing spaces getting fixed in the patch. I didn't
know I had to mention that in the patch description. Again sorry.

> thanks,
>
> greg k-h

Regards,
Hartley

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH]  usb/core/hub.c: fix sparse warnings
  2009-04-22  5:51 ` Greg KH
  2009-04-22 17:25   ` H Hartley Sweeten
@ 2009-04-22 20:03   ` H Hartley Sweeten
  1 sibling, 0 replies; 4+ messages in thread
From: H Hartley Sweeten @ 2009-04-22 20:03 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]

Fix sparse warning in drivers/usb/core/hub.c.

The following sparse warning is seen when building on ARM due
do the macro raw_local_irq_save():

	warning: symbol 'temp' shadows an earlier one

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>

---

Patch is also attached in case of line-wrapping.


diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index be86ae3..c7a1a1d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -457,13 +457,13 @@ static void hub_tt_kevent (struct work_struct
*work)
 
 	spin_lock_irqsave (&hub->tt.lock, flags);
 	while (--limit && !list_empty (&hub->tt.clear_list)) {
-		struct list_head	*temp;
+		struct list_head	*next;
 		struct usb_tt_clear	*clear;
 		struct usb_device	*hdev = hub->hdev;
 		int			status;
 
-		temp = hub->tt.clear_list.next;
-		clear = list_entry (temp, struct usb_tt_clear,
clear_list);
+		next = hub->tt.clear_list.next;
+		clear = list_entry (next, struct usb_tt_clear,
clear_list);
 		list_del (&clear->clear_list);
 
 		/* drop lock so HCD can concurrently report other TT
errors */ 

[-- Attachment #2: usb_core_hub_c_sparse.patch --]
[-- Type: application/octet-stream, Size: 769 bytes --]

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index be86ae3..c7a1a1d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -457,13 +457,13 @@ static void hub_tt_kevent (struct work_struct *work)
 
 	spin_lock_irqsave (&hub->tt.lock, flags);
 	while (--limit && !list_empty (&hub->tt.clear_list)) {
-		struct list_head	*temp;
+		struct list_head	*next;
 		struct usb_tt_clear	*clear;
 		struct usb_device	*hdev = hub->hdev;
 		int			status;
 
-		temp = hub->tt.clear_list.next;
-		clear = list_entry (temp, struct usb_tt_clear, clear_list);
+		next = hub->tt.clear_list.next;
+		clear = list_entry (next, struct usb_tt_clear, clear_list);
 		list_del (&clear->clear_list);
 
 		/* drop lock so HCD can concurrently report other TT errors */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-22 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-16  1:44 [PATCH] usb/core/hub.c: fix sparse warnings H Hartley Sweeten
2009-04-22  5:51 ` Greg KH
2009-04-22 17:25   ` H Hartley Sweeten
2009-04-22 20:03   ` H Hartley Sweeten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox