diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 23:30:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 23:30:48 -0400 |
commit | 5cc103506289de7ee0a0b526ae0381541990cad4 (patch) | |
tree | ae8a4958e70c6d1295030b40e333dcc007b3c074 /drivers/usb/core | |
parent | 73ecf3a6e3f0206bf56a0fefe3b3eda042fb7034 (diff) | |
parent | 92ca0dc5ee022e4c0e488177e1d8865a0778c6c2 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (141 commits)
USB: mct_u232: fix broken close
USB: gadget: amd5536udc.c: fix error path
USB: imx21-hcd - fix off by one resource size calculation
usb: gadget: fix Kconfig warning
usb: r8a66597-udc: Add processing when USB was removed.
mxc_udc: add workaround for ENGcm09152 for i.MX35
USB: ftdi_sio: add device ids for ScienceScope
USB: musb: AM35x: Workaround for fifo read issue
USB: musb: add musb support for AM35x
USB: AM35x: Add musb support
usb: Fix linker errors with CONFIG_PM=n
USB: ohci-sh - use resource_size instead of defining its own resource_len macro
USB: isp1362-hcd - use resource_size instead of defining its own resource_len macro
USB: isp116x-hcd - use resource_size instead of defining its own resource_len macro
USB: xhci: Fix compile error when CONFIG_PM=n
USB: accept some invalid ep0-maxpacket values
USB: xHCI: PCI power management implementation
USB: xHCI: bus power management implementation
USB: xHCI: port remote wakeup implementation
USB: xHCI: port power management implementation
...
Manually fix up (non-data) conflict: the SCSI merge gad renamed the
'hw_sector_size' member to 'physical_block_size', and the USB tree
brought a new use of it.
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/Makefile | 21 | ||||
-rw-r--r-- | drivers/usb/core/devices.c | 11 | ||||
-rw-r--r-- | drivers/usb/core/driver.c | 2 | ||||
-rw-r--r-- | drivers/usb/core/endpoint.c | 2 | ||||
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/hcd.c | 19 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 41 | ||||
-rw-r--r-- | drivers/usb/core/message.c | 14 | ||||
-rw-r--r-- | drivers/usb/core/urb.c | 5 |
9 files changed, 67 insertions, 52 deletions
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile index ec16e6029905..507a4e1b6360 100644 --- a/drivers/usb/core/Makefile +++ b/drivers/usb/core/Makefile | |||
@@ -2,20 +2,13 @@ | |||
2 | # Makefile for USB Core files and filesystem | 2 | # Makefile for USB Core files and filesystem |
3 | # | 3 | # |
4 | 4 | ||
5 | usbcore-objs := usb.o hub.o hcd.o urb.o message.o driver.o \ | 5 | ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG |
6 | config.o file.o buffer.o sysfs.o endpoint.o \ | ||
7 | devio.o notify.o generic.o quirks.o devices.o | ||
8 | 6 | ||
9 | ifeq ($(CONFIG_PCI),y) | 7 | usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o |
10 | usbcore-objs += hcd-pci.o | 8 | usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o |
11 | endif | 9 | usbcore-y += devio.o notify.o generic.o quirks.o devices.o |
12 | 10 | ||
13 | ifeq ($(CONFIG_USB_DEVICEFS),y) | 11 | usbcore-$(CONFIG_PCI) += hcd-pci.o |
14 | usbcore-objs += inode.o | 12 | usbcore-$(CONFIG_USB_DEVICEFS) += inode.o |
15 | endif | ||
16 | 13 | ||
17 | obj-$(CONFIG_USB) += usbcore.o | 14 | obj-$(CONFIG_USB) += usbcore.o |
18 | |||
19 | ifeq ($(CONFIG_USB_DEBUG),y) | ||
20 | EXTRA_CFLAGS += -DDEBUG | ||
21 | endif | ||
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 3449742c00e1..ddb4dc980923 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -66,8 +66,8 @@ | |||
66 | #define ALLOW_SERIAL_NUMBER | 66 | #define ALLOW_SERIAL_NUMBER |
67 | 67 | ||
68 | static const char *format_topo = | 68 | static const char *format_topo = |
69 | /* T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=ddd MxCh=dd */ | 69 | /* T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd */ |
70 | "\nT: Bus=%2.2d Lev=%2.2d Prnt=%2.2d Port=%2.2d Cnt=%2.2d Dev#=%3d Spd=%3s MxCh=%2d\n"; | 70 | "\nT: Bus=%2.2d Lev=%2.2d Prnt=%2.2d Port=%2.2d Cnt=%2.2d Dev#=%3d Spd=%-4s MxCh=%2d\n"; |
71 | 71 | ||
72 | static const char *format_string_manufacturer = | 72 | static const char *format_string_manufacturer = |
73 | /* S: Manufacturer=xxxx */ | 73 | /* S: Manufacturer=xxxx */ |
@@ -520,11 +520,14 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, | |||
520 | speed = "1.5"; break; | 520 | speed = "1.5"; break; |
521 | case USB_SPEED_UNKNOWN: /* usb 1.1 root hub code */ | 521 | case USB_SPEED_UNKNOWN: /* usb 1.1 root hub code */ |
522 | case USB_SPEED_FULL: | 522 | case USB_SPEED_FULL: |
523 | speed = "12 "; break; | 523 | speed = "12"; break; |
524 | case USB_SPEED_WIRELESS: /* Wireless has no real fixed speed */ | ||
524 | case USB_SPEED_HIGH: | 525 | case USB_SPEED_HIGH: |
525 | speed = "480"; break; | 526 | speed = "480"; break; |
527 | case USB_SPEED_SUPER: | ||
528 | speed = "5000"; break; | ||
526 | default: | 529 | default: |
527 | speed = "?? "; | 530 | speed = "??"; |
528 | } | 531 | } |
529 | data_end = pages_start + sprintf(pages_start, format_topo, | 532 | data_end = pages_start + sprintf(pages_start, format_topo, |
530 | bus->busnum, level, parent_devnum, | 533 | bus->busnum, level, parent_devnum, |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index d7a4401ef019..c0e60fbcb048 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1337,7 +1337,7 @@ int usb_resume(struct device *dev, pm_message_t msg) | |||
1337 | /* Avoid PM error messages for devices disconnected while suspended | 1337 | /* Avoid PM error messages for devices disconnected while suspended |
1338 | * as we'll display regular disconnect messages just a bit later. | 1338 | * as we'll display regular disconnect messages just a bit later. |
1339 | */ | 1339 | */ |
1340 | if (status == -ENODEV) | 1340 | if (status == -ENODEV || status == -ESHUTDOWN) |
1341 | status = 0; | 1341 | status = 0; |
1342 | return status; | 1342 | return status; |
1343 | } | 1343 | } |
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 3788e738e265..9da250563027 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c | |||
@@ -202,7 +202,7 @@ int usb_create_ep_devs(struct device *parent, | |||
202 | return retval; | 202 | return retval; |
203 | 203 | ||
204 | error_register: | 204 | error_register: |
205 | kfree(ep_dev); | 205 | put_device(&ep_dev->dev); |
206 | exit: | 206 | exit: |
207 | return retval; | 207 | return retval; |
208 | } | 208 | } |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index c3f98543caaf..3799573bd385 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -329,8 +329,10 @@ void usb_hcd_pci_shutdown(struct pci_dev *dev) | |||
329 | return; | 329 | return; |
330 | 330 | ||
331 | if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) && | 331 | if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags) && |
332 | hcd->driver->shutdown) | 332 | hcd->driver->shutdown) { |
333 | hcd->driver->shutdown(hcd); | 333 | hcd->driver->shutdown(hcd); |
334 | pci_disable_device(dev); | ||
335 | } | ||
334 | } | 336 | } |
335 | EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown); | 337 | EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown); |
336 | 338 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 5cca00a6d09d..61800f77dac8 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1263,10 +1263,8 @@ static void hcd_free_coherent(struct usb_bus *bus, dma_addr_t *dma_handle, | |||
1263 | *dma_handle = 0; | 1263 | *dma_handle = 0; |
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | static void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | 1266 | void unmap_urb_setup_for_dma(struct usb_hcd *hcd, struct urb *urb) |
1267 | { | 1267 | { |
1268 | enum dma_data_direction dir; | ||
1269 | |||
1270 | if (urb->transfer_flags & URB_SETUP_MAP_SINGLE) | 1268 | if (urb->transfer_flags & URB_SETUP_MAP_SINGLE) |
1271 | dma_unmap_single(hcd->self.controller, | 1269 | dma_unmap_single(hcd->self.controller, |
1272 | urb->setup_dma, | 1270 | urb->setup_dma, |
@@ -1279,6 +1277,17 @@ static void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | |||
1279 | sizeof(struct usb_ctrlrequest), | 1277 | sizeof(struct usb_ctrlrequest), |
1280 | DMA_TO_DEVICE); | 1278 | DMA_TO_DEVICE); |
1281 | 1279 | ||
1280 | /* Make it safe to call this routine more than once */ | ||
1281 | urb->transfer_flags &= ~(URB_SETUP_MAP_SINGLE | URB_SETUP_MAP_LOCAL); | ||
1282 | } | ||
1283 | EXPORT_SYMBOL_GPL(unmap_urb_setup_for_dma); | ||
1284 | |||
1285 | void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | ||
1286 | { | ||
1287 | enum dma_data_direction dir; | ||
1288 | |||
1289 | unmap_urb_setup_for_dma(hcd, urb); | ||
1290 | |||
1282 | dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | 1291 | dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; |
1283 | if (urb->transfer_flags & URB_DMA_MAP_SG) | 1292 | if (urb->transfer_flags & URB_DMA_MAP_SG) |
1284 | dma_unmap_sg(hcd->self.controller, | 1293 | dma_unmap_sg(hcd->self.controller, |
@@ -1303,10 +1312,10 @@ static void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) | |||
1303 | dir); | 1312 | dir); |
1304 | 1313 | ||
1305 | /* Make it safe to call this routine more than once */ | 1314 | /* Make it safe to call this routine more than once */ |
1306 | urb->transfer_flags &= ~(URB_SETUP_MAP_SINGLE | URB_SETUP_MAP_LOCAL | | 1315 | urb->transfer_flags &= ~(URB_DMA_MAP_SG | URB_DMA_MAP_PAGE | |
1307 | URB_DMA_MAP_SG | URB_DMA_MAP_PAGE | | ||
1308 | URB_DMA_MAP_SINGLE | URB_MAP_LOCAL); | 1316 | URB_DMA_MAP_SINGLE | URB_MAP_LOCAL); |
1309 | } | 1317 | } |
1318 | EXPORT_SYMBOL_GPL(unmap_urb_for_dma); | ||
1310 | 1319 | ||
1311 | static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, | 1320 | static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, |
1312 | gfp_t mem_flags) | 1321 | gfp_t mem_flags) |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 84c1897188d2..27115b45edc5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -758,6 +758,9 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
758 | clear_port_feature(hdev, port1, | 758 | clear_port_feature(hdev, port1, |
759 | USB_PORT_FEAT_ENABLE); | 759 | USB_PORT_FEAT_ENABLE); |
760 | portstatus &= ~USB_PORT_STAT_ENABLE; | 760 | portstatus &= ~USB_PORT_STAT_ENABLE; |
761 | } else { | ||
762 | /* Pretend that power was lost for USB3 devs */ | ||
763 | portstatus &= ~USB_PORT_STAT_ENABLE; | ||
761 | } | 764 | } |
762 | } | 765 | } |
763 | 766 | ||
@@ -2594,16 +2597,14 @@ static int hub_set_address(struct usb_device *udev, int devnum) | |||
2594 | return 0; | 2597 | return 0; |
2595 | if (udev->state != USB_STATE_DEFAULT) | 2598 | if (udev->state != USB_STATE_DEFAULT) |
2596 | return -EINVAL; | 2599 | return -EINVAL; |
2597 | if (hcd->driver->address_device) { | 2600 | if (hcd->driver->address_device) |
2598 | retval = hcd->driver->address_device(hcd, udev); | 2601 | retval = hcd->driver->address_device(hcd, udev); |
2599 | } else { | 2602 | else |
2600 | retval = usb_control_msg(udev, usb_sndaddr0pipe(), | 2603 | retval = usb_control_msg(udev, usb_sndaddr0pipe(), |
2601 | USB_REQ_SET_ADDRESS, 0, devnum, 0, | 2604 | USB_REQ_SET_ADDRESS, 0, devnum, 0, |
2602 | NULL, 0, USB_CTRL_SET_TIMEOUT); | 2605 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
2603 | if (retval == 0) | ||
2604 | update_address(udev, devnum); | ||
2605 | } | ||
2606 | if (retval == 0) { | 2606 | if (retval == 0) { |
2607 | update_address(udev, devnum); | ||
2607 | /* Device now using proper address. */ | 2608 | /* Device now using proper address. */ |
2608 | usb_set_device_state(udev, USB_STATE_ADDRESS); | 2609 | usb_set_device_state(udev, USB_STATE_ADDRESS); |
2609 | usb_ep0_reinit(udev); | 2610 | usb_ep0_reinit(udev); |
@@ -2860,13 +2861,16 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
2860 | else | 2861 | else |
2861 | i = udev->descriptor.bMaxPacketSize0; | 2862 | i = udev->descriptor.bMaxPacketSize0; |
2862 | if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) { | 2863 | if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) { |
2863 | if (udev->speed != USB_SPEED_FULL || | 2864 | if (udev->speed == USB_SPEED_LOW || |
2864 | !(i == 8 || i == 16 || i == 32 || i == 64)) { | 2865 | !(i == 8 || i == 16 || i == 32 || i == 64)) { |
2865 | dev_err(&udev->dev, "ep0 maxpacket = %d\n", i); | 2866 | dev_err(&udev->dev, "Invalid ep0 maxpacket: %d\n", i); |
2866 | retval = -EMSGSIZE; | 2867 | retval = -EMSGSIZE; |
2867 | goto fail; | 2868 | goto fail; |
2868 | } | 2869 | } |
2869 | dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); | 2870 | if (udev->speed == USB_SPEED_FULL) |
2871 | dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); | ||
2872 | else | ||
2873 | dev_warn(&udev->dev, "Using ep0 maxpacket: %d\n", i); | ||
2870 | udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); | 2874 | udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); |
2871 | usb_ep0_reinit(udev); | 2875 | usb_ep0_reinit(udev); |
2872 | } | 2876 | } |
@@ -3097,16 +3101,17 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
3097 | udev->speed = USB_SPEED_UNKNOWN; | 3101 | udev->speed = USB_SPEED_UNKNOWN; |
3098 | 3102 | ||
3099 | /* | 3103 | /* |
3100 | * xHCI needs to issue an address device command later | 3104 | * Set the address. |
3101 | * in the hub_port_init sequence for SS/HS/FS/LS devices. | 3105 | * Note xHCI needs to issue an address device command later |
3106 | * in the hub_port_init sequence for SS/HS/FS/LS devices, | ||
3107 | * and xHC will assign an address to the device. But use | ||
3108 | * kernel assigned address here, to avoid any address conflict | ||
3109 | * issue. | ||
3102 | */ | 3110 | */ |
3103 | if (!(hcd->driver->flags & HCD_USB3)) { | 3111 | choose_address(udev); |
3104 | /* set the address */ | 3112 | if (udev->devnum <= 0) { |
3105 | choose_address(udev); | 3113 | status = -ENOTCONN; /* Don't retry */ |
3106 | if (udev->devnum <= 0) { | 3114 | goto loop; |
3107 | status = -ENOTCONN; /* Don't retry */ | ||
3108 | goto loop; | ||
3109 | } | ||
3110 | } | 3115 | } |
3111 | 3116 | ||
3112 | /* reset (non-USB 3.0 devices) and get descriptor */ | 3117 | /* reset (non-USB 3.0 devices) and get descriptor */ |
@@ -3629,7 +3634,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev) | |||
3629 | } | 3634 | } |
3630 | 3635 | ||
3631 | if (!parent_hdev) { | 3636 | if (!parent_hdev) { |
3632 | /* this requires hcd-specific logic; see OHCI hc_restart() */ | 3637 | /* this requires hcd-specific logic; see ohci_restart() */ |
3633 | dev_dbg(&udev->dev, "%s for root hub!\n", __func__); | 3638 | dev_dbg(&udev->dev, "%s for root hub!\n", __func__); |
3634 | return -EISDIR; | 3639 | return -EISDIR; |
3635 | } | 3640 | } |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 9f0ce7de0e36..d6e3e410477e 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1140,13 +1140,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1140 | { | 1140 | { |
1141 | int i; | 1141 | int i; |
1142 | 1142 | ||
1143 | dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, | ||
1144 | skip_ep0 ? "non-ep0" : "all"); | ||
1145 | for (i = skip_ep0; i < 16; ++i) { | ||
1146 | usb_disable_endpoint(dev, i, true); | ||
1147 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); | ||
1148 | } | ||
1149 | |||
1150 | /* getting rid of interfaces will disconnect | 1143 | /* getting rid of interfaces will disconnect |
1151 | * any drivers bound to them (a key side effect) | 1144 | * any drivers bound to them (a key side effect) |
1152 | */ | 1145 | */ |
@@ -1176,6 +1169,13 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1176 | if (dev->state == USB_STATE_CONFIGURED) | 1169 | if (dev->state == USB_STATE_CONFIGURED) |
1177 | usb_set_device_state(dev, USB_STATE_ADDRESS); | 1170 | usb_set_device_state(dev, USB_STATE_ADDRESS); |
1178 | } | 1171 | } |
1172 | |||
1173 | dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, | ||
1174 | skip_ep0 ? "non-ep0" : "all"); | ||
1175 | for (i = skip_ep0; i < 16; ++i) { | ||
1176 | usb_disable_endpoint(dev, i, true); | ||
1177 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); | ||
1178 | } | ||
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | /** | 1181 | /** |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 419e6b34e2fe..c14fc082864f 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -401,8 +401,11 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
401 | }; | 401 | }; |
402 | 402 | ||
403 | /* Check that the pipe's type matches the endpoint's type */ | 403 | /* Check that the pipe's type matches the endpoint's type */ |
404 | if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) | 404 | if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) { |
405 | dev_err(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", | ||
406 | usb_pipetype(urb->pipe), pipetypes[xfertype]); | ||
405 | return -EPIPE; /* The most suitable error code :-) */ | 407 | return -EPIPE; /* The most suitable error code :-) */ |
408 | } | ||
406 | 409 | ||
407 | /* enforce simple/standard policy */ | 410 | /* enforce simple/standard policy */ |
408 | allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK | | 411 | allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK | |