aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/sl811-hcd.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-03-04 17:05:08 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:31 -0400
commit749da5f82fe33ff68dd4aa1a5e35cd9aa6246dab (patch)
tree2c0a7c689ab6a58f3a799ae51e41ac885e212194 /drivers/usb/host/sl811-hcd.c
parent288ead45fa6637e959015d055304f521cbbc0575 (diff)
USB: straighten out port feature vs. port status usage
This patch (as1349b) clears up the confusion in many USB host controller drivers between port features and port statuses. In mosty cases it's true that the status bit is in the position given by the corresponding feature value, but that's not always true and it's not guaranteed in the USB spec. There's no functional change, just replacing expressions of the form (1 << USB_PORT_FEAT_x) with USB_PORT_STAT_x, which has the same value. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/sl811-hcd.c')
-rw-r--r--drivers/usb/host/sl811-hcd.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index dcd7fab7179c..bcf9f0e809de 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -90,10 +90,10 @@ static void port_power(struct sl811 *sl811, int is_on)
90 90
91 /* hub is inactive unless the port is powered */ 91 /* hub is inactive unless the port is powered */
92 if (is_on) { 92 if (is_on) {
93 if (sl811->port1 & (1 << USB_PORT_FEAT_POWER)) 93 if (sl811->port1 & USB_PORT_STAT_POWER)
94 return; 94 return;
95 95
96 sl811->port1 = (1 << USB_PORT_FEAT_POWER); 96 sl811->port1 = USB_PORT_STAT_POWER;
97 sl811->irq_enable = SL11H_INTMASK_INSRMV; 97 sl811->irq_enable = SL11H_INTMASK_INSRMV;
98 } else { 98 } else {
99 sl811->port1 = 0; 99 sl811->port1 = 0;
@@ -407,7 +407,7 @@ static struct sl811h_ep *start(struct sl811 *sl811, u8 bank)
407 407
408static inline void start_transfer(struct sl811 *sl811) 408static inline void start_transfer(struct sl811 *sl811)
409{ 409{
410 if (sl811->port1 & (1 << USB_PORT_FEAT_SUSPEND)) 410 if (sl811->port1 & USB_PORT_STAT_SUSPEND)
411 return; 411 return;
412 if (sl811->active_a == NULL) { 412 if (sl811->active_a == NULL) {
413 sl811->active_a = start(sl811, SL811_EP_A(SL811_HOST_BUF)); 413 sl811->active_a = start(sl811, SL811_EP_A(SL811_HOST_BUF));
@@ -721,23 +721,23 @@ retry:
721 * force the reset and make khubd clean up later. 721 * force the reset and make khubd clean up later.
722 */ 722 */
723 if (irqstat & SL11H_INTMASK_RD) 723 if (irqstat & SL11H_INTMASK_RD)
724 sl811->port1 &= ~(1 << USB_PORT_FEAT_CONNECTION); 724 sl811->port1 &= ~USB_PORT_STAT_CONNECTION;
725 else 725 else
726 sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION; 726 sl811->port1 |= USB_PORT_STAT_CONNECTION;
727 727
728 sl811->port1 |= 1 << USB_PORT_FEAT_C_CONNECTION; 728 sl811->port1 |= USB_PORT_STAT_C_CONNECTION << 16;
729 729
730 } else if (irqstat & SL11H_INTMASK_RD) { 730 } else if (irqstat & SL11H_INTMASK_RD) {
731 if (sl811->port1 & (1 << USB_PORT_FEAT_SUSPEND)) { 731 if (sl811->port1 & USB_PORT_STAT_SUSPEND) {
732 DBG("wakeup\n"); 732 DBG("wakeup\n");
733 sl811->port1 |= 1 << USB_PORT_FEAT_C_SUSPEND; 733 sl811->port1 |= USB_PORT_STAT_C_SUSPEND << 16;
734 sl811->stat_wake++; 734 sl811->stat_wake++;
735 } else 735 } else
736 irqstat &= ~SL11H_INTMASK_RD; 736 irqstat &= ~SL11H_INTMASK_RD;
737 } 737 }
738 738
739 if (irqstat) { 739 if (irqstat) {
740 if (sl811->port1 & (1 << USB_PORT_FEAT_ENABLE)) 740 if (sl811->port1 & USB_PORT_STAT_ENABLE)
741 start_transfer(sl811); 741 start_transfer(sl811);
742 ret = IRQ_HANDLED; 742 ret = IRQ_HANDLED;
743 if (retries--) 743 if (retries--)
@@ -819,7 +819,7 @@ static int sl811h_urb_enqueue(
819 spin_lock_irqsave(&sl811->lock, flags); 819 spin_lock_irqsave(&sl811->lock, flags);
820 820
821 /* don't submit to a dead or disabled port */ 821 /* don't submit to a dead or disabled port */
822 if (!(sl811->port1 & (1 << USB_PORT_FEAT_ENABLE)) 822 if (!(sl811->port1 & USB_PORT_STAT_ENABLE)
823 || !HC_IS_RUNNING(hcd->state)) { 823 || !HC_IS_RUNNING(hcd->state)) {
824 retval = -ENODEV; 824 retval = -ENODEV;
825 kfree(ep); 825 kfree(ep);
@@ -1119,8 +1119,8 @@ sl811h_timer(unsigned long _sl811)
1119 unsigned long flags; 1119 unsigned long flags;
1120 u8 irqstat; 1120 u8 irqstat;
1121 u8 signaling = sl811->ctrl1 & SL11H_CTL1MASK_FORCE; 1121 u8 signaling = sl811->ctrl1 & SL11H_CTL1MASK_FORCE;
1122 const u32 mask = (1 << USB_PORT_FEAT_CONNECTION) 1122 const u32 mask = USB_PORT_STAT_CONNECTION
1123 | (1 << USB_PORT_FEAT_ENABLE) 1123 | USB_PORT_STAT_ENABLE
1124 | USB_PORT_STAT_LOW_SPEED; 1124 | USB_PORT_STAT_LOW_SPEED;
1125 1125
1126 spin_lock_irqsave(&sl811->lock, flags); 1126 spin_lock_irqsave(&sl811->lock, flags);
@@ -1135,8 +1135,8 @@ sl811h_timer(unsigned long _sl811)
1135 switch (signaling) { 1135 switch (signaling) {
1136 case SL11H_CTL1MASK_SE0: 1136 case SL11H_CTL1MASK_SE0:
1137 DBG("end reset\n"); 1137 DBG("end reset\n");
1138 sl811->port1 = (1 << USB_PORT_FEAT_C_RESET) 1138 sl811->port1 = (USB_PORT_STAT_C_RESET << 16)
1139 | (1 << USB_PORT_FEAT_POWER); 1139 | USB_PORT_STAT_POWER;
1140 sl811->ctrl1 = 0; 1140 sl811->ctrl1 = 0;
1141 /* don't wrongly ack RD */ 1141 /* don't wrongly ack RD */
1142 if (irqstat & SL11H_INTMASK_INSRMV) 1142 if (irqstat & SL11H_INTMASK_INSRMV)
@@ -1144,7 +1144,7 @@ sl811h_timer(unsigned long _sl811)
1144 break; 1144 break;
1145 case SL11H_CTL1MASK_K: 1145 case SL11H_CTL1MASK_K:
1146 DBG("end resume\n"); 1146 DBG("end resume\n");
1147 sl811->port1 &= ~(1 << USB_PORT_FEAT_SUSPEND); 1147 sl811->port1 &= ~USB_PORT_STAT_SUSPEND;
1148 break; 1148 break;
1149 default: 1149 default:
1150 DBG("odd timer signaling: %02x\n", signaling); 1150 DBG("odd timer signaling: %02x\n", signaling);
@@ -1154,9 +1154,9 @@ sl811h_timer(unsigned long _sl811)
1154 1154
1155 if (irqstat & SL11H_INTMASK_RD) { 1155 if (irqstat & SL11H_INTMASK_RD) {
1156 /* usbcore nukes all pending transactions on disconnect */ 1156 /* usbcore nukes all pending transactions on disconnect */
1157 if (sl811->port1 & (1 << USB_PORT_FEAT_CONNECTION)) 1157 if (sl811->port1 & USB_PORT_STAT_CONNECTION)
1158 sl811->port1 |= (1 << USB_PORT_FEAT_C_CONNECTION) 1158 sl811->port1 |= (USB_PORT_STAT_C_CONNECTION << 16)
1159 | (1 << USB_PORT_FEAT_C_ENABLE); 1159 | (USB_PORT_STAT_C_ENABLE << 16);
1160 sl811->port1 &= ~mask; 1160 sl811->port1 &= ~mask;
1161 sl811->irq_enable = SL11H_INTMASK_INSRMV; 1161 sl811->irq_enable = SL11H_INTMASK_INSRMV;
1162 } else { 1162 } else {
@@ -1166,7 +1166,7 @@ sl811h_timer(unsigned long _sl811)
1166 sl811->irq_enable = SL11H_INTMASK_INSRMV | SL11H_INTMASK_RD; 1166 sl811->irq_enable = SL11H_INTMASK_INSRMV | SL11H_INTMASK_RD;
1167 } 1167 }
1168 1168
1169 if (sl811->port1 & (1 << USB_PORT_FEAT_CONNECTION)) { 1169 if (sl811->port1 & USB_PORT_STAT_CONNECTION) {
1170 u8 ctrl2 = SL811HS_CTL2_INIT; 1170 u8 ctrl2 = SL811HS_CTL2_INIT;
1171 1171
1172 sl811->irq_enable |= SL11H_INTMASK_DONE_A; 1172 sl811->irq_enable |= SL11H_INTMASK_DONE_A;
@@ -1233,7 +1233,7 @@ sl811h_hub_control(
1233 1233
1234 switch (wValue) { 1234 switch (wValue) {
1235 case USB_PORT_FEAT_ENABLE: 1235 case USB_PORT_FEAT_ENABLE:
1236 sl811->port1 &= (1 << USB_PORT_FEAT_POWER); 1236 sl811->port1 &= USB_PORT_STAT_POWER;
1237 sl811->ctrl1 = 0; 1237 sl811->ctrl1 = 0;
1238 sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1); 1238 sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1);
1239 sl811->irq_enable = SL11H_INTMASK_INSRMV; 1239 sl811->irq_enable = SL11H_INTMASK_INSRMV;
@@ -1241,7 +1241,7 @@ sl811h_hub_control(
1241 sl811->irq_enable); 1241 sl811->irq_enable);
1242 break; 1242 break;
1243 case USB_PORT_FEAT_SUSPEND: 1243 case USB_PORT_FEAT_SUSPEND:
1244 if (!(sl811->port1 & (1 << USB_PORT_FEAT_SUSPEND))) 1244 if (!(sl811->port1 & USB_PORT_STAT_SUSPEND))
1245 break; 1245 break;
1246 1246
1247 /* 20 msec of resume/K signaling, other irqs blocked */ 1247 /* 20 msec of resume/K signaling, other irqs blocked */
@@ -1290,9 +1290,9 @@ sl811h_hub_control(
1290 goto error; 1290 goto error;
1291 switch (wValue) { 1291 switch (wValue) {
1292 case USB_PORT_FEAT_SUSPEND: 1292 case USB_PORT_FEAT_SUSPEND:
1293 if (sl811->port1 & (1 << USB_PORT_FEAT_RESET)) 1293 if (sl811->port1 & USB_PORT_STAT_RESET)
1294 goto error; 1294 goto error;
1295 if (!(sl811->port1 & (1 << USB_PORT_FEAT_ENABLE))) 1295 if (!(sl811->port1 & USB_PORT_STAT_ENABLE))
1296 goto error; 1296 goto error;
1297 1297
1298 DBG("suspend...\n"); 1298 DBG("suspend...\n");
@@ -1303,9 +1303,9 @@ sl811h_hub_control(
1303 port_power(sl811, 1); 1303 port_power(sl811, 1);
1304 break; 1304 break;
1305 case USB_PORT_FEAT_RESET: 1305 case USB_PORT_FEAT_RESET:
1306 if (sl811->port1 & (1 << USB_PORT_FEAT_SUSPEND)) 1306 if (sl811->port1 & USB_PORT_STAT_SUSPEND)
1307 goto error; 1307 goto error;
1308 if (!(sl811->port1 & (1 << USB_PORT_FEAT_POWER))) 1308 if (!(sl811->port1 & USB_PORT_STAT_POWER))
1309 break; 1309 break;
1310 1310
1311 /* 50 msec of reset/SE0 signaling, irqs blocked */ 1311 /* 50 msec of reset/SE0 signaling, irqs blocked */
@@ -1314,7 +1314,7 @@ sl811h_hub_control(
1314 sl811->irq_enable); 1314 sl811->irq_enable);
1315 sl811->ctrl1 = SL11H_CTL1MASK_SE0; 1315 sl811->ctrl1 = SL11H_CTL1MASK_SE0;
1316 sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1); 1316 sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1);
1317 sl811->port1 |= (1 << USB_PORT_FEAT_RESET); 1317 sl811->port1 |= USB_PORT_STAT_RESET;
1318 mod_timer(&sl811->timer, jiffies 1318 mod_timer(&sl811->timer, jiffies
1319 + msecs_to_jiffies(50)); 1319 + msecs_to_jiffies(50));
1320 break; 1320 break;