aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/r8a66597-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/r8a66597-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/r8a66597-hcd.c')
-rw-r--r--drivers/usb/host/r8a66597-hcd.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index a004a1220848..6db57ab6079d 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -1018,10 +1018,10 @@ static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port,
1018 rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; 1018 rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST;
1019 rh->scount = R8A66597_MAX_SAMPLING; 1019 rh->scount = R8A66597_MAX_SAMPLING;
1020 if (connect) 1020 if (connect)
1021 rh->port |= 1 << USB_PORT_FEAT_CONNECTION; 1021 rh->port |= USB_PORT_STAT_CONNECTION;
1022 else 1022 else
1023 rh->port &= ~(1 << USB_PORT_FEAT_CONNECTION); 1023 rh->port &= ~USB_PORT_STAT_CONNECTION;
1024 rh->port |= 1 << USB_PORT_FEAT_C_CONNECTION; 1024 rh->port |= USB_PORT_STAT_C_CONNECTION << 16;
1025 1025
1026 r8a66597_root_hub_start_polling(r8a66597); 1026 r8a66597_root_hub_start_polling(r8a66597);
1027} 1027}
@@ -1065,8 +1065,8 @@ static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port)
1065 else if (speed == LSMODE) 1065 else if (speed == LSMODE)
1066 rh->port |= USB_PORT_STAT_LOW_SPEED; 1066 rh->port |= USB_PORT_STAT_LOW_SPEED;
1067 1067
1068 rh->port &= ~(1 << USB_PORT_FEAT_RESET); 1068 rh->port &= USB_PORT_STAT_RESET;
1069 rh->port |= 1 << USB_PORT_FEAT_ENABLE; 1069 rh->port |= USB_PORT_STAT_ENABLE;
1070} 1070}
1071 1071
1072/* this function must be called with interrupt disabled */ 1072/* this function must be called with interrupt disabled */
@@ -1705,7 +1705,7 @@ static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port)
1705 u16 tmp; 1705 u16 tmp;
1706 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 1706 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
1707 1707
1708 if (rh->port & (1 << USB_PORT_FEAT_RESET)) { 1708 if (rh->port & USB_PORT_STAT_RESET) {
1709 unsigned long dvstctr_reg = get_dvstctr_reg(port); 1709 unsigned long dvstctr_reg = get_dvstctr_reg(port);
1710 1710
1711 tmp = r8a66597_read(r8a66597, dvstctr_reg); 1711 tmp = r8a66597_read(r8a66597, dvstctr_reg);
@@ -1717,7 +1717,7 @@ static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port)
1717 r8a66597_usb_connect(r8a66597, port); 1717 r8a66597_usb_connect(r8a66597, port);
1718 } 1718 }
1719 1719
1720 if (!(rh->port & (1 << USB_PORT_FEAT_CONNECTION))) { 1720 if (!(rh->port & USB_PORT_STAT_CONNECTION)) {
1721 r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port)); 1721 r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port));
1722 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); 1722 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port));
1723 } 1723 }
@@ -2185,7 +2185,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
2185 2185
2186 switch (wValue) { 2186 switch (wValue) {
2187 case USB_PORT_FEAT_ENABLE: 2187 case USB_PORT_FEAT_ENABLE:
2188 rh->port &= ~(1 << USB_PORT_FEAT_POWER); 2188 rh->port &= ~USB_PORT_STAT_POWER;
2189 break; 2189 break;
2190 case USB_PORT_FEAT_SUSPEND: 2190 case USB_PORT_FEAT_SUSPEND:
2191 break; 2191 break;
@@ -2226,12 +2226,12 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
2226 break; 2226 break;
2227 case USB_PORT_FEAT_POWER: 2227 case USB_PORT_FEAT_POWER:
2228 r8a66597_port_power(r8a66597, port, 1); 2228 r8a66597_port_power(r8a66597, port, 1);
2229 rh->port |= (1 << USB_PORT_FEAT_POWER); 2229 rh->port |= USB_PORT_STAT_POWER;
2230 break; 2230 break;
2231 case USB_PORT_FEAT_RESET: { 2231 case USB_PORT_FEAT_RESET: {
2232 struct r8a66597_device *dev = rh->dev; 2232 struct r8a66597_device *dev = rh->dev;
2233 2233
2234 rh->port |= (1 << USB_PORT_FEAT_RESET); 2234 rh->port |= USB_PORT_STAT_RESET;
2235 2235
2236 disable_r8a66597_pipe_all(r8a66597, dev); 2236 disable_r8a66597_pipe_all(r8a66597, dev);
2237 free_usb_address(r8a66597, dev, 1); 2237 free_usb_address(r8a66597, dev, 1);
@@ -2269,12 +2269,12 @@ static int r8a66597_bus_suspend(struct usb_hcd *hcd)
2269 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 2269 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
2270 unsigned long dvstctr_reg = get_dvstctr_reg(port); 2270 unsigned long dvstctr_reg = get_dvstctr_reg(port);
2271 2271
2272 if (!(rh->port & (1 << USB_PORT_FEAT_ENABLE))) 2272 if (!(rh->port & USB_PORT_STAT_ENABLE))
2273 continue; 2273 continue;
2274 2274
2275 dbg("suspend port = %d", port); 2275 dbg("suspend port = %d", port);
2276 r8a66597_bclr(r8a66597, UACT, dvstctr_reg); /* suspend */ 2276 r8a66597_bclr(r8a66597, UACT, dvstctr_reg); /* suspend */
2277 rh->port |= 1 << USB_PORT_FEAT_SUSPEND; 2277 rh->port |= USB_PORT_STAT_SUSPEND;
2278 2278
2279 if (rh->dev->udev->do_remote_wakeup) { 2279 if (rh->dev->udev->do_remote_wakeup) {
2280 msleep(3); /* waiting last SOF */ 2280 msleep(3); /* waiting last SOF */
@@ -2300,12 +2300,12 @@ static int r8a66597_bus_resume(struct usb_hcd *hcd)
2300 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 2300 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
2301 unsigned long dvstctr_reg = get_dvstctr_reg(port); 2301 unsigned long dvstctr_reg = get_dvstctr_reg(port);
2302 2302
2303 if (!(rh->port & (1 << USB_PORT_FEAT_SUSPEND))) 2303 if (!(rh->port & USB_PORT_STAT_SUSPEND))
2304 continue; 2304 continue;
2305 2305
2306 dbg("resume port = %d", port); 2306 dbg("resume port = %d", port);
2307 rh->port &= ~(1 << USB_PORT_FEAT_SUSPEND); 2307 rh->port &= ~USB_PORT_STAT_SUSPEND;
2308 rh->port |= 1 << USB_PORT_FEAT_C_SUSPEND; 2308 rh->port |= USB_PORT_STAT_C_SUSPEND < 16;
2309 r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg); 2309 r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg);
2310 msleep(50); 2310 msleep(50);
2311 r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg); 2311 r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg);