diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-05-11 08:44:27 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-11 08:44:31 -0400 |
commit | 41fb454ebe6024f5c1e3b3cbc0abc0da762e7b51 (patch) | |
tree | 51c50bcb67a5039448ddfa1869d7948cab1217e9 /drivers/usb/core/message.c | |
parent | 19c1a6f5764d787113fa323ffb18be7991208f82 (diff) | |
parent | 091bf7624d1c90cec9e578a18529f615213ff847 (diff) |
Merge commit 'v2.6.30-rc5' into core/iommu
Merge reason: core/iommu was on an .30-rc1 base,
update it to .30-rc5 to refresh.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r-- | drivers/usb/core/message.c | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 30a0690f3683..b62628377654 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1002,8 +1002,7 @@ int usb_clear_halt(struct usb_device *dev, int pipe) | |||
1002 | * the copy in usb-storage, for as long as we need two copies. | 1002 | * the copy in usb-storage, for as long as we need two copies. |
1003 | */ | 1003 | */ |
1004 | 1004 | ||
1005 | /* toggle was reset by the clear */ | 1005 | usb_reset_endpoint(dev, endp); |
1006 | usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), 0); | ||
1007 | 1006 | ||
1008 | return 0; | 1007 | return 0; |
1009 | } | 1008 | } |
@@ -1076,6 +1075,30 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, | |||
1076 | } | 1075 | } |
1077 | 1076 | ||
1078 | /** | 1077 | /** |
1078 | * usb_reset_endpoint - Reset an endpoint's state. | ||
1079 | * @dev: the device whose endpoint is to be reset | ||
1080 | * @epaddr: the endpoint's address. Endpoint number for output, | ||
1081 | * endpoint number + USB_DIR_IN for input | ||
1082 | * | ||
1083 | * Resets any host-side endpoint state such as the toggle bit, | ||
1084 | * sequence number or current window. | ||
1085 | */ | ||
1086 | void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr) | ||
1087 | { | ||
1088 | unsigned int epnum = epaddr & USB_ENDPOINT_NUMBER_MASK; | ||
1089 | struct usb_host_endpoint *ep; | ||
1090 | |||
1091 | if (usb_endpoint_out(epaddr)) | ||
1092 | ep = dev->ep_out[epnum]; | ||
1093 | else | ||
1094 | ep = dev->ep_in[epnum]; | ||
1095 | if (ep) | ||
1096 | usb_hcd_reset_endpoint(dev, ep); | ||
1097 | } | ||
1098 | EXPORT_SYMBOL_GPL(usb_reset_endpoint); | ||
1099 | |||
1100 | |||
1101 | /** | ||
1079 | * usb_disable_interface -- Disable all endpoints for an interface | 1102 | * usb_disable_interface -- Disable all endpoints for an interface |
1080 | * @dev: the device whose interface is being disabled | 1103 | * @dev: the device whose interface is being disabled |
1081 | * @intf: pointer to the interface descriptor | 1104 | * @intf: pointer to the interface descriptor |
@@ -1117,7 +1140,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1117 | usb_disable_endpoint(dev, i, true); | 1140 | usb_disable_endpoint(dev, i, true); |
1118 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); | 1141 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); |
1119 | } | 1142 | } |
1120 | dev->toggle[0] = dev->toggle[1] = 0; | ||
1121 | 1143 | ||
1122 | /* getting rid of interfaces will disconnect | 1144 | /* getting rid of interfaces will disconnect |
1123 | * any drivers bound to them (a key side effect) | 1145 | * any drivers bound to them (a key side effect) |
@@ -1154,28 +1176,24 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1154 | * usb_enable_endpoint - Enable an endpoint for USB communications | 1176 | * usb_enable_endpoint - Enable an endpoint for USB communications |
1155 | * @dev: the device whose interface is being enabled | 1177 | * @dev: the device whose interface is being enabled |
1156 | * @ep: the endpoint | 1178 | * @ep: the endpoint |
1157 | * @reset_toggle: flag to set the endpoint's toggle back to 0 | 1179 | * @reset_ep: flag to reset the endpoint state |
1158 | * | 1180 | * |
1159 | * Resets the endpoint toggle if asked, and sets dev->ep_{in,out} pointers. | 1181 | * Resets the endpoint state if asked, and sets dev->ep_{in,out} pointers. |
1160 | * For control endpoints, both the input and output sides are handled. | 1182 | * For control endpoints, both the input and output sides are handled. |
1161 | */ | 1183 | */ |
1162 | void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep, | 1184 | void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep, |
1163 | bool reset_toggle) | 1185 | bool reset_ep) |
1164 | { | 1186 | { |
1165 | int epnum = usb_endpoint_num(&ep->desc); | 1187 | int epnum = usb_endpoint_num(&ep->desc); |
1166 | int is_out = usb_endpoint_dir_out(&ep->desc); | 1188 | int is_out = usb_endpoint_dir_out(&ep->desc); |
1167 | int is_control = usb_endpoint_xfer_control(&ep->desc); | 1189 | int is_control = usb_endpoint_xfer_control(&ep->desc); |
1168 | 1190 | ||
1169 | if (is_out || is_control) { | 1191 | if (reset_ep) |
1170 | if (reset_toggle) | 1192 | usb_hcd_reset_endpoint(dev, ep); |
1171 | usb_settoggle(dev, epnum, 1, 0); | 1193 | if (is_out || is_control) |
1172 | dev->ep_out[epnum] = ep; | 1194 | dev->ep_out[epnum] = ep; |
1173 | } | 1195 | if (!is_out || is_control) |
1174 | if (!is_out || is_control) { | ||
1175 | if (reset_toggle) | ||
1176 | usb_settoggle(dev, epnum, 0, 0); | ||
1177 | dev->ep_in[epnum] = ep; | 1196 | dev->ep_in[epnum] = ep; |
1178 | } | ||
1179 | ep->enabled = 1; | 1197 | ep->enabled = 1; |
1180 | } | 1198 | } |
1181 | 1199 | ||
@@ -1183,18 +1201,18 @@ void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep, | |||
1183 | * usb_enable_interface - Enable all the endpoints for an interface | 1201 | * usb_enable_interface - Enable all the endpoints for an interface |
1184 | * @dev: the device whose interface is being enabled | 1202 | * @dev: the device whose interface is being enabled |
1185 | * @intf: pointer to the interface descriptor | 1203 | * @intf: pointer to the interface descriptor |
1186 | * @reset_toggles: flag to set the endpoints' toggles back to 0 | 1204 | * @reset_eps: flag to reset the endpoints' state |
1187 | * | 1205 | * |
1188 | * Enables all the endpoints for the interface's current altsetting. | 1206 | * Enables all the endpoints for the interface's current altsetting. |
1189 | */ | 1207 | */ |
1190 | void usb_enable_interface(struct usb_device *dev, | 1208 | void usb_enable_interface(struct usb_device *dev, |
1191 | struct usb_interface *intf, bool reset_toggles) | 1209 | struct usb_interface *intf, bool reset_eps) |
1192 | { | 1210 | { |
1193 | struct usb_host_interface *alt = intf->cur_altsetting; | 1211 | struct usb_host_interface *alt = intf->cur_altsetting; |
1194 | int i; | 1212 | int i; |
1195 | 1213 | ||
1196 | for (i = 0; i < alt->desc.bNumEndpoints; ++i) | 1214 | for (i = 0; i < alt->desc.bNumEndpoints; ++i) |
1197 | usb_enable_endpoint(dev, &alt->endpoint[i], reset_toggles); | 1215 | usb_enable_endpoint(dev, &alt->endpoint[i], reset_eps); |
1198 | } | 1216 | } |
1199 | 1217 | ||
1200 | /** | 1218 | /** |
@@ -1335,7 +1353,7 @@ EXPORT_SYMBOL_GPL(usb_set_interface); | |||
1335 | * This issues a standard SET_CONFIGURATION request to the device using | 1353 | * This issues a standard SET_CONFIGURATION request to the device using |
1336 | * the current configuration. The effect is to reset most USB-related | 1354 | * the current configuration. The effect is to reset most USB-related |
1337 | * state in the device, including interface altsettings (reset to zero), | 1355 | * state in the device, including interface altsettings (reset to zero), |
1338 | * endpoint halts (cleared), and data toggle (only for bulk and interrupt | 1356 | * endpoint halts (cleared), and endpoint state (only for bulk and interrupt |
1339 | * endpoints). Other usbcore state is unchanged, including bindings of | 1357 | * endpoints). Other usbcore state is unchanged, including bindings of |
1340 | * usb device drivers to interfaces. | 1358 | * usb device drivers to interfaces. |
1341 | * | 1359 | * |
@@ -1343,7 +1361,7 @@ EXPORT_SYMBOL_GPL(usb_set_interface); | |||
1343 | * (multi-interface) devices. Instead, the driver for each interface may | 1361 | * (multi-interface) devices. Instead, the driver for each interface may |
1344 | * use usb_set_interface() on the interfaces it claims. Be careful though; | 1362 | * use usb_set_interface() on the interfaces it claims. Be careful though; |
1345 | * some devices don't support the SET_INTERFACE request, and others won't | 1363 | * some devices don't support the SET_INTERFACE request, and others won't |
1346 | * reset all the interface state (notably data toggles). Resetting the whole | 1364 | * reset all the interface state (notably endpoint state). Resetting the whole |
1347 | * configuration would affect other drivers' interfaces. | 1365 | * configuration would affect other drivers' interfaces. |
1348 | * | 1366 | * |
1349 | * The caller must own the device lock. | 1367 | * The caller must own the device lock. |
@@ -1376,8 +1394,6 @@ int usb_reset_configuration(struct usb_device *dev) | |||
1376 | if (retval < 0) | 1394 | if (retval < 0) |
1377 | return retval; | 1395 | return retval; |
1378 | 1396 | ||
1379 | dev->toggle[0] = dev->toggle[1] = 0; | ||
1380 | |||
1381 | /* re-init hc/hcd interface/endpoint state */ | 1397 | /* re-init hc/hcd interface/endpoint state */ |
1382 | for (i = 0; i < config->desc.bNumInterfaces; i++) { | 1398 | for (i = 0; i < config->desc.bNumInterfaces; i++) { |
1383 | struct usb_interface *intf = config->interface[i]; | 1399 | struct usb_interface *intf = config->interface[i]; |