aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-06-21 00:15:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 19:47:42 -0400
commit74ad9bd2fcf0fa203655e0d904809b06c4202bf8 (patch)
tree28cf74beab3fcf7f29c4d88bd704f4abfa235601 /drivers/usb/core
parent22efcf4adec4262e0f49e6225f6cd070e4a85d20 (diff)
[PATCH] USB: make wHubCharacteristics __le16 to match other usb descriptor fields
Also has the nice benefit of making sparc alignment issues go away. Thanks to David Miller for pointing out the problems here. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> drivers/usb/core/hub.c | 22 ++++++++++++---------- drivers/usb/core/hub.h | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-)
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/hub.c22
-rw-r--r--drivers/usb/core/hub.h2
2 files changed, 13 insertions, 11 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 15db5e490aa2..e2802bf18095 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -436,9 +436,10 @@ static void hub_power_on(struct usb_hub *hub)
436{ 436{
437 int port1; 437 int port1;
438 unsigned pgood_delay = hub->descriptor->bPwrOn2PwrGood * 2; 438 unsigned pgood_delay = hub->descriptor->bPwrOn2PwrGood * 2;
439 u16 wHubCharacteristics = le16_to_cpu(hub->descriptor->wHubCharacteristics);
439 440
440 /* if hub supports power switching, enable power on each port */ 441 /* if hub supports power switching, enable power on each port */
441 if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) < 2) { 442 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2) {
442 dev_dbg(hub->intfdev, "enabling power on all ports\n"); 443 dev_dbg(hub->intfdev, "enabling power on all ports\n");
443 for (port1 = 1; port1 <= hub->descriptor->bNbrPorts; port1++) 444 for (port1 = 1; port1 <= hub->descriptor->bNbrPorts; port1++)
444 set_port_feature(hub->hdev, port1, 445 set_port_feature(hub->hdev, port1,
@@ -525,6 +526,7 @@ static int hub_configure(struct usb_hub *hub,
525 struct usb_device *hdev = hub->hdev; 526 struct usb_device *hdev = hub->hdev;
526 struct device *hub_dev = hub->intfdev; 527 struct device *hub_dev = hub->intfdev;
527 u16 hubstatus, hubchange; 528 u16 hubstatus, hubchange;
529 u16 wHubCharacteristics;
528 unsigned int pipe; 530 unsigned int pipe;
529 int maxp, ret; 531 int maxp, ret;
530 char *message; 532 char *message;
@@ -570,9 +572,9 @@ static int hub_configure(struct usb_hub *hub,
570 dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild, 572 dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild,
571 (hdev->maxchild == 1) ? "" : "s"); 573 (hdev->maxchild == 1) ? "" : "s");
572 574
573 le16_to_cpus(&hub->descriptor->wHubCharacteristics); 575 wHubCharacteristics = le16_to_cpu(hub->descriptor->wHubCharacteristics);
574 576
575 if (hub->descriptor->wHubCharacteristics & HUB_CHAR_COMPOUND) { 577 if (wHubCharacteristics & HUB_CHAR_COMPOUND) {
576 int i; 578 int i;
577 char portstr [USB_MAXCHILDREN + 1]; 579 char portstr [USB_MAXCHILDREN + 1];
578 580
@@ -585,7 +587,7 @@ static int hub_configure(struct usb_hub *hub,
585 } else 587 } else
586 dev_dbg(hub_dev, "standalone hub\n"); 588 dev_dbg(hub_dev, "standalone hub\n");
587 589
588 switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) { 590 switch (wHubCharacteristics & HUB_CHAR_LPSM) {
589 case 0x00: 591 case 0x00:
590 dev_dbg(hub_dev, "ganged power switching\n"); 592 dev_dbg(hub_dev, "ganged power switching\n");
591 break; 593 break;
@@ -598,7 +600,7 @@ static int hub_configure(struct usb_hub *hub,
598 break; 600 break;
599 } 601 }
600 602
601 switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_OCPM) { 603 switch (wHubCharacteristics & HUB_CHAR_OCPM) {
602 case 0x00: 604 case 0x00:
603 dev_dbg(hub_dev, "global over-current protection\n"); 605 dev_dbg(hub_dev, "global over-current protection\n");
604 break; 606 break;
@@ -638,7 +640,7 @@ static int hub_configure(struct usb_hub *hub,
638 } 640 }
639 641
640 /* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */ 642 /* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */
641 switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) { 643 switch (wHubCharacteristics & HUB_CHAR_TTTT) {
642 case HUB_TTTT_8_BITS: 644 case HUB_TTTT_8_BITS:
643 if (hdev->descriptor.bDeviceProtocol != 0) { 645 if (hdev->descriptor.bDeviceProtocol != 0) {
644 hub->tt.think_time = 666; 646 hub->tt.think_time = 666;
@@ -668,7 +670,7 @@ static int hub_configure(struct usb_hub *hub,
668 } 670 }
669 671
670 /* probe() zeroes hub->indicator[] */ 672 /* probe() zeroes hub->indicator[] */
671 if (hub->descriptor->wHubCharacteristics & HUB_CHAR_PORTIND) { 673 if (wHubCharacteristics & HUB_CHAR_PORTIND) {
672 hub->has_indicators = 1; 674 hub->has_indicators = 1;
673 dev_dbg(hub_dev, "Port indicators are supported\n"); 675 dev_dbg(hub_dev, "Port indicators are supported\n");
674 } 676 }
@@ -713,7 +715,7 @@ static int hub_configure(struct usb_hub *hub,
713 (hubstatus & HUB_STATUS_LOCAL_POWER) 715 (hubstatus & HUB_STATUS_LOCAL_POWER)
714 ? "lost (inactive)" : "good"); 716 ? "lost (inactive)" : "good");
715 717
716 if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_OCPM) == 0) 718 if ((wHubCharacteristics & HUB_CHAR_OCPM) == 0)
717 dev_dbg(hub_dev, "%sover-current condition exists\n", 719 dev_dbg(hub_dev, "%sover-current condition exists\n",
718 (hubstatus & HUB_STATUS_OVERCURRENT) ? "" : "no "); 720 (hubstatus & HUB_STATUS_OVERCURRENT) ? "" : "no ");
719 721
@@ -2432,6 +2434,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2432{ 2434{
2433 struct usb_device *hdev = hub->hdev; 2435 struct usb_device *hdev = hub->hdev;
2434 struct device *hub_dev = hub->intfdev; 2436 struct device *hub_dev = hub->intfdev;
2437 u16 wHubCharacteristics = le16_to_cpu(hub->descriptor->wHubCharacteristics);
2435 int status, i; 2438 int status, i;
2436 2439
2437 dev_dbg (hub_dev, 2440 dev_dbg (hub_dev,
@@ -2469,8 +2472,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2469 if (!(portstatus & USB_PORT_STAT_CONNECTION)) { 2472 if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
2470 2473
2471 /* maybe switch power back on (e.g. root hub was reset) */ 2474 /* maybe switch power back on (e.g. root hub was reset) */
2472 if ((hub->descriptor->wHubCharacteristics 2475 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
2473 & HUB_CHAR_LPSM) < 2
2474 && !(portstatus & (1 << USB_PORT_FEAT_POWER))) 2476 && !(portstatus & (1 << USB_PORT_FEAT_POWER)))
2475 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); 2477 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
2476 2478
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
index e7fa9b5a521e..bf23f8978024 100644
--- a/drivers/usb/core/hub.h
+++ b/drivers/usb/core/hub.h
@@ -131,7 +131,7 @@ struct usb_hub_descriptor {
131 __u8 bDescLength; 131 __u8 bDescLength;
132 __u8 bDescriptorType; 132 __u8 bDescriptorType;
133 __u8 bNbrPorts; 133 __u8 bNbrPorts;
134 __u16 wHubCharacteristics; 134 __le16 wHubCharacteristics;
135 __u8 bPwrOn2PwrGood; 135 __u8 bPwrOn2PwrGood;
136 __u8 bHubContrCurrent; 136 __u8 bHubContrCurrent;
137 /* add 1 bit for hub status change; round to bytes */ 137 /* add 1 bit for hub status change; round to bytes */