ChangeSet 1.1624, 2003/08/01 10:08:22-07:00, stern@rowland.harvard.edu

[PATCH] USB: Remove usb_set_maxpacket()

This is the final part of as66c.  It removes the usb_set_maxpacket()
routine, since the same functionality now exists elsewhere.  The one place
it was used was in the device reset pathway for a device that has changed
somehow since the previous reset.  That code needs to be fixed up anyway;
for now it's enough just to have it call usb_set_configuration().


 drivers/usb/core/hcd.h     |    1 -
 drivers/usb/core/hub.c     |    4 +---
 drivers/usb/core/message.c |   35 -----------------------------------
 3 files changed, 1 insertion(+), 39 deletions(-)


diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
--- a/drivers/usb/core/hcd.h	Fri Aug  1 10:53:30 2003
+++ b/drivers/usb/core/hcd.h	Fri Aug  1 10:53:30 2003
@@ -252,7 +252,6 @@
 
 /* exported to hub driver ONLY to support usb_reset_device () */
 extern int usb_get_configuration(struct usb_device *dev);
-extern void usb_set_maxpacket(struct usb_device *dev);
 extern void usb_destroy_configuration(struct usb_device *dev);
 extern int usb_set_address(struct usb_device *dev);
 
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Fri Aug  1 10:53:30 2003
+++ b/drivers/usb/core/hub.c	Fri Aug  1 10:53:30 2003
@@ -1331,9 +1331,7 @@
 			return 1;
 		}
 
-		dev->actconfig = dev->config;
-		usb_set_maxpacket(dev);
-
+		usb_set_configuration(dev, dev->config[0].desc.bConfigurationValue);
 		return 1;
 	}
 
diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c	Fri Aug  1 10:53:30 2003
+++ b/drivers/usb/core/message.c	Fri Aug  1 10:53:30 2003
@@ -675,41 +675,6 @@
 		HZ * USB_CTRL_GET_TIMEOUT);
 }
 
-
-// hub-only!! ... and only exported for reset/reinit path.
-// otherwise used internally, when setting up a config
-void usb_set_maxpacket(struct usb_device *dev)
-{
-	int i, b;
-
-	/* NOTE:  affects all endpoints _except_ ep0 */
-	for (i=0; i<dev->actconfig->desc.bNumInterfaces; i++) {
-		struct usb_interface *ifp = dev->actconfig->interface[i];
-		struct usb_host_interface *as = ifp->altsetting + ifp->act_altsetting;
-		struct usb_host_endpoint *ep = as->endpoint;
-		int e;
-
-		for (e=0; e<as->desc.bNumEndpoints; e++) {
-			struct usb_endpoint_descriptor	*d;
-			d = &ep [e].desc;
-			b = d->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
-			if ((d->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
-				USB_ENDPOINT_XFER_CONTROL) {	/* Control => bidirectional */
-				dev->epmaxpacketout[b] = d->wMaxPacketSize;
-				dev->epmaxpacketin [b] = d->wMaxPacketSize;
-				}
-			else if (usb_endpoint_out(d->bEndpointAddress)) {
-				if (d->wMaxPacketSize > dev->epmaxpacketout[b])
-					dev->epmaxpacketout[b] = d->wMaxPacketSize;
-			}
-			else {
-				if (d->wMaxPacketSize > dev->epmaxpacketin [b])
-					dev->epmaxpacketin [b] = d->wMaxPacketSize;
-			}
-		}
-	}
-}
-
 /**
  * usb_clear_halt - tells device to clear endpoint halt/stall condition
  * @dev: device whose endpoint is halted
