Greg:
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.
Alan Stern
diff -Nru a/drivers/usb/core/driverfs.c b/drivers/usb/core/driverfs.c
--- a/drivers/usb/core/driverfs.c Mon Mar 1 11:40:11 2004
+++ b/drivers/usb/core/driverfs.c Mon Mar 1 11:40:11 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 Mon Mar 1 11:40:11 2004
+++ b/drivers/usb/core/hub.c Mon Mar 1 11:40:11 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;
}
}
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel