ChangeSet 1.1608.24.36, 2004/03/03 12:52:13-08:00, stern@rowland.harvard.edu [PATCH] USB: Convert usbcore to use cur_altsetting This patch continues the work of as209 by converting the rest of usbcore to use cur_altsetting in place of act_altsetting. The changes required are fairly small, just in the sysfs attributes and hub configuration. drivers/usb/core/driverfs.c | 8 ++------ drivers/usb/core/hub.c | 12 ++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff -Nru a/drivers/usb/core/driverfs.c b/drivers/usb/core/driverfs.c --- a/drivers/usb/core/driverfs.c Tue Mar 16 15:04:36 2004 +++ b/drivers/usb/core/driverfs.c Tue Mar 16 15:04:36 2004 @@ -166,13 +166,9 @@ static ssize_t \ show_##field (struct device *dev, char *buf) \ { \ - struct usb_interface *intf; \ - int alt; \ + struct usb_interface *intf = to_usb_interface (dev); \ \ - intf = to_usb_interface (dev); \ - alt = intf->act_altsetting; \ - \ - return sprintf (buf, format_string, intf->altsetting[alt].desc.field); \ + return sprintf (buf, format_string, intf->cur_altsetting->desc.field); \ } \ static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c --- a/drivers/usb/core/hub.c Tue Mar 16 15:04:36 2004 +++ b/drivers/usb/core/hub.c Tue Mar 16 15:04:36 2004 @@ -560,7 +560,7 @@ struct usb_hub *hub; unsigned long flags; - desc = intf->altsetting + intf->act_altsetting; + desc = intf->cur_altsetting; dev = interface_to_usbdev(intf); /* Some hubs have a subclass of 1, which AFAICT according to the */ @@ -1344,15 +1344,15 @@ for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { struct usb_interface *intf = dev->actconfig->interface[i]; - struct usb_interface_descriptor *as; + struct usb_interface_descriptor *desc; - as = &intf->altsetting[intf->act_altsetting].desc; - ret = usb_set_interface(dev, as->bInterfaceNumber, - as->bAlternateSetting); + desc = &intf->cur_altsetting->desc; + ret = usb_set_interface(dev, desc->bInterfaceNumber, + desc->bAlternateSetting); if (ret < 0) { err("failed to set active alternate setting " "for dev %s interface %d (error=%d)", - dev->devpath, i, ret); + dev->devpath, desc->bInterfaceNumber, ret); return ret; } }