Re: [PATCH] Remove unnecessary addition operations from usb/core/hub.c

2005-02-19 Thread Greg KH
On Sat, Feb 19, 2005 at 07:03:27PM +, 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 <[EMAIL PROTECTED]>

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Remove unnecessary addition operations from usb/core/hub.c

2005-02-19 Thread Telemaque Ndizihiwe
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 <[EMAIL PROTECTED]>


--- linux-2.6.10/drivers/usb/core/hub.c.orig2005-02-19
12:26:28.682067480 +
+++ linux-2.6.10/drivers/usb/core/hub.c 2005-02-19 12:38:55.059600848
+
@@ -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(>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;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Remove unnecessary addition operations from usb/core/hub.c

2005-02-19 Thread Telemaque Ndizihiwe
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 [EMAIL PROTECTED]


--- linux-2.6.10/drivers/usb/core/hub.c.orig2005-02-19
12:26:28.682067480 +
+++ linux-2.6.10/drivers/usb/core/hub.c 2005-02-19 12:38:55.059600848
+
@@ -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;


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Remove unnecessary addition operations from usb/core/hub.c

2005-02-19 Thread Greg KH
On Sat, Feb 19, 2005 at 07:03:27PM +, 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 [EMAIL PROTECTED]

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
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/