public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Remove unnecessary addition operations from usb/core/hub.c
@ 2005-02-19 19:03 Telemaque Ndizihiwe
  2005-02-19 22:40 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Telemaque Ndizihiwe @ 2005-02-19 19:03 UTC (permalink / raw)
  To: rddunlap, bhards; +Cc: torvalds, akpm, trivial, linux-kernel

This Patch removes unnecessary addition operations from
usb/core/hub.c in kernel 2.6.10.

	usb_disable_endpoint(udev, 0 + USB_DIR_IN);   //replaced by
	usb_disable_endpoint(udev, USB_DIR_IN);

	usb_disable_endpoint(udev, 0 + USB_DIR_OUT);  //replaced by	
	usb_disable_endpoint(udev, USB_DIR_OUT);


Signed-off-by: Telemaque Ndizihiwe <telendiz@eircom.net>


--- linux-2.6.10/drivers/usb/core/hub.c.orig	2005-02-19
12:26:28.682067480 +0000
+++ linux-2.6.10/drivers/usb/core/hub.c	2005-02-19 12:38:55.059600848
+0000
@@ -2044,8 +2044,8 @@ static int hub_set_address(struct usb_de
 		int m = udev->epmaxpacketin[0];
 
 		usb_set_device_state(udev, USB_STATE_ADDRESS);
-		usb_disable_endpoint(udev, 0 + USB_DIR_IN);
-		usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
+		usb_disable_endpoint(udev, USB_DIR_IN);
+		usb_disable_endpoint(udev, USB_DIR_OUT);
 		udev->epmaxpacketin[0] = udev->epmaxpacketout[0] = m;
 	}
 	return retval;
@@ -2244,8 +2244,8 @@ hub_port_init (struct usb_device *hdev, 
 	i = udev->descriptor.bMaxPacketSize0;
 	if (udev->epmaxpacketin[0] != i) {
 		dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i);
-		usb_disable_endpoint(udev, 0 + USB_DIR_IN);
-		usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
+		usb_disable_endpoint(udev, USB_DIR_IN);
+		usb_disable_endpoint(udev, USB_DIR_OUT);
 		udev->epmaxpacketin[0] = udev->epmaxpacketout[0] = i;
 	}
   
@@ -2508,8 +2508,8 @@ static void hub_port_connect_change(stru
 
 loop:
 		hub_port_disable(hdev, port);
-		usb_disable_endpoint(udev, 0 + USB_DIR_IN);
-		usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
+		usb_disable_endpoint(udev, USB_DIR_IN);
+		usb_disable_endpoint(udev, USB_DIR_OUT);
 		release_address(udev);
 		usb_put_dev(udev);
 		if (status == -ENOTCONN)
@@ -2893,8 +2893,8 @@ int usb_reset_device(struct usb_device *
 
 		/* ep0 maxpacket size may change; let the HCD know about it.
 		 * Other endpoints will be handled by re-enumeration. */
-		usb_disable_endpoint(udev, 0 + USB_DIR_IN);
-		usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
+		usb_disable_endpoint(udev, USB_DIR_IN);
+		usb_disable_endpoint(udev, USB_DIR_OUT);
 		ret = hub_port_init(parent, udev, port, i);
 		if (ret >= 0)
 			break;



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

* Re: [PATCH] Remove unnecessary addition operations from usb/core/hub.c
  2005-02-19 19:03 [PATCH] Remove unnecessary addition operations from usb/core/hub.c Telemaque Ndizihiwe
@ 2005-02-19 22:40 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2005-02-19 22:40 UTC (permalink / raw)
  To: Telemaque Ndizihiwe
  Cc: rddunlap, bhards, torvalds, akpm, trivial, linux-kernel

On Sat, Feb 19, 2005 at 07:03:27PM +0000, Telemaque Ndizihiwe wrote:
> This Patch removes unnecessary addition operations from
> usb/core/hub.c in kernel 2.6.10.
> 
> 	usb_disable_endpoint(udev, 0 + USB_DIR_IN);   //replaced by
> 	usb_disable_endpoint(udev, USB_DIR_IN);
> 
> 	usb_disable_endpoint(udev, 0 + USB_DIR_OUT);  //replaced by	
> 	usb_disable_endpoint(udev, USB_DIR_OUT);
> 
> 
> Signed-off-by: Telemaque Ndizihiwe <telendiz@eircom.net>

No, I'll say to leave these "0 +" in the code.  It doesn't hurt anything
(the compiler takes care of it in preprocessing) and it instantly tells
you exactly what the code is really doing (disabling endpoint 0).
Without the 0 in there, you would have to take a bit to think about
which endpoint is actually being disabled.

So, sorry, I'm not going to apply this.

Oh, and next time, please CC: the linux usb maintainer, and the
linux-usb-devel mailing list when you post USB patches.

thanks,

greg k-h

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

end of thread, other threads:[~2005-02-19 22:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-19 19:03 [PATCH] Remove unnecessary addition operations from usb/core/hub.c Telemaque Ndizihiwe
2005-02-19 22:40 ` Greg KH

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