Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6:
USB: EHCI: fix obscure race in ehci_endpoint_disable
USB: gadget: AT91: fix typo in atmel_usba_udc driver
USB: isp1362-hcd - fix section mismatch warning
USB: EHCI: AMD periodic frame list table quirk
USB: OTG: langwell_otg: fix up some sysfs attribute permissions
USB: misc: usbsevseg: fix up some sysfs attribute permissions
USB: misc: usbled: fix up some sysfs attribute permissions
USB: misc: trancevibrator: fix up a sysfs attribute permission
USB: misc: cypress_cy7c63: fix up some sysfs attribute permissions
USB: storage: sierra_ms: fix sysfs file attribute
USB: ehci: fix debugfs 'lpm' permissions
USB: atm: ueagle-atm: fix up some permissions on the sysfs files
xhci: Fix command ring replay after resume.
xHCI: fix wMaxPacketSize mask
xHCI: release spinlock when setup interrupt
xhci: Remove excessive printks with shared IRQs.

+151 -48
+3 -4
drivers/usb/atm/ueagle-atm.c
··· 2301 2301 return ret; 2302 2302 } 2303 2303 2304 - static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); 2304 + static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot); 2305 2305 2306 2306 static ssize_t read_human_status(struct device *dev, 2307 2307 struct device_attribute *attr, char *buf) ··· 2364 2364 return ret; 2365 2365 } 2366 2366 2367 - static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, 2368 - read_human_status, NULL); 2367 + static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL); 2369 2368 2370 2369 static ssize_t read_delin(struct device *dev, struct device_attribute *attr, 2371 2370 char *buf) ··· 2396 2397 return ret; 2397 2398 } 2398 2399 2399 - static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); 2400 + static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL); 2400 2401 2401 2402 #define UEA_ATTR(name, reset) \ 2402 2403 \
+1 -1
drivers/usb/gadget/atmel_usba_udc.c
··· 2017 2017 } 2018 2018 } else { 2019 2019 /* gpio_request fail so use -EINVAL for gpio_is_valid */ 2020 - ubc->vbus_pin = -EINVAL; 2020 + udc->vbus_pin = -EINVAL; 2021 2021 } 2022 2022 } 2023 2023
+1 -1
drivers/usb/host/ehci-dbg.c
··· 1067 1067 &debug_registers_fops)) 1068 1068 goto file_error; 1069 1069 1070 - if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus, 1070 + if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus, 1071 1071 &debug_lpm_fops)) 1072 1072 goto file_error; 1073 1073
+5 -5
drivers/usb/host/ehci-hcd.c
··· 1063 1063 tmp && tmp != qh; 1064 1064 tmp = tmp->qh_next.qh) 1065 1065 continue; 1066 - /* periodic qh self-unlinks on empty */ 1067 - if (!tmp) 1068 - goto nogood; 1069 - unlink_async (ehci, qh); 1066 + /* periodic qh self-unlinks on empty, and a COMPLETING qh 1067 + * may already be unlinked. 1068 + */ 1069 + if (tmp) 1070 + unlink_async(ehci, qh); 1070 1071 /* FALL THROUGH */ 1071 1072 case QH_STATE_UNLINK: /* wait for hw to finish? */ 1072 1073 case QH_STATE_UNLINK_WAIT: ··· 1084 1083 } 1085 1084 /* else FALL THROUGH */ 1086 1085 default: 1087 - nogood: 1088 1086 /* caller was supposed to have unlinked any requests; 1089 1087 * that's not our job. just leak this memory. 1090 1088 */
+24 -2
drivers/usb/host/ehci-mem.c
··· 141 141 qh_put (ehci->async); 142 142 ehci->async = NULL; 143 143 144 + if (ehci->dummy) 145 + qh_put(ehci->dummy); 146 + ehci->dummy = NULL; 147 + 144 148 /* DMA consistent memory and pools */ 145 149 if (ehci->qtd_pool) 146 150 dma_pool_destroy (ehci->qtd_pool); ··· 231 227 if (ehci->periodic == NULL) { 232 228 goto fail; 233 229 } 234 - for (i = 0; i < ehci->periodic_size; i++) 235 - ehci->periodic [i] = EHCI_LIST_END(ehci); 230 + 231 + if (ehci->use_dummy_qh) { 232 + struct ehci_qh_hw *hw; 233 + ehci->dummy = ehci_qh_alloc(ehci, flags); 234 + if (!ehci->dummy) 235 + goto fail; 236 + 237 + hw = ehci->dummy->hw; 238 + hw->hw_next = EHCI_LIST_END(ehci); 239 + hw->hw_qtd_next = EHCI_LIST_END(ehci); 240 + hw->hw_alt_next = EHCI_LIST_END(ehci); 241 + hw->hw_token &= ~QTD_STS_ACTIVE; 242 + ehci->dummy->hw = hw; 243 + 244 + for (i = 0; i < ehci->periodic_size; i++) 245 + ehci->periodic[i] = ehci->dummy->qh_dma; 246 + } else { 247 + for (i = 0; i < ehci->periodic_size; i++) 248 + ehci->periodic[i] = EHCI_LIST_END(ehci); 249 + } 236 250 237 251 /* software shadow of hardware table */ 238 252 ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags);
+13
drivers/usb/host/ehci-pci.c
··· 103 103 if (retval) 104 104 return retval; 105 105 106 + if ((pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x7808) || 107 + (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x4396)) { 108 + /* EHCI controller on AMD SB700/SB800/Hudson-2/3 platforms may 109 + * read/write memory space which does not belong to it when 110 + * there is NULL pointer with T-bit set to 1 in the frame list 111 + * table. To avoid the issue, the frame list link pointer 112 + * should always contain a valid pointer to a inactive qh. 113 + */ 114 + ehci->use_dummy_qh = 1; 115 + ehci_info(ehci, "applying AMD SB700/SB800/Hudson-2/3 EHCI " 116 + "dummy qh workaround\n"); 117 + } 118 + 106 119 /* data structure init */ 107 120 retval = ehci_init(hcd); 108 121 if (retval)
+18 -3
drivers/usb/host/ehci-sched.c
··· 98 98 */ 99 99 *prev_p = *periodic_next_shadow(ehci, &here, 100 100 Q_NEXT_TYPE(ehci, *hw_p)); 101 - *hw_p = *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)); 101 + 102 + if (!ehci->use_dummy_qh || 103 + *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)) 104 + != EHCI_LIST_END(ehci)) 105 + *hw_p = *shadow_next_periodic(ehci, &here, 106 + Q_NEXT_TYPE(ehci, *hw_p)); 107 + else 108 + *hw_p = ehci->dummy->qh_dma; 102 109 } 103 110 104 111 /* how many of the uframe's 125 usecs are allocated? */ ··· 2342 2335 * pointer for much longer, if at all. 2343 2336 */ 2344 2337 *q_p = q.itd->itd_next; 2345 - *hw_p = q.itd->hw_next; 2338 + if (!ehci->use_dummy_qh || 2339 + q.itd->hw_next != EHCI_LIST_END(ehci)) 2340 + *hw_p = q.itd->hw_next; 2341 + else 2342 + *hw_p = ehci->dummy->qh_dma; 2346 2343 type = Q_NEXT_TYPE(ehci, q.itd->hw_next); 2347 2344 wmb(); 2348 2345 modified = itd_complete (ehci, q.itd); ··· 2379 2368 * URB completion. 2380 2369 */ 2381 2370 *q_p = q.sitd->sitd_next; 2382 - *hw_p = q.sitd->hw_next; 2371 + if (!ehci->use_dummy_qh || 2372 + q.sitd->hw_next != EHCI_LIST_END(ehci)) 2373 + *hw_p = q.sitd->hw_next; 2374 + else 2375 + *hw_p = ehci->dummy->qh_dma; 2383 2376 type = Q_NEXT_TYPE(ehci, q.sitd->hw_next); 2384 2377 wmb(); 2385 2378 modified = sitd_complete (ehci, q.sitd);
+2
drivers/usb/host/ehci.h
··· 73 73 74 74 /* async schedule support */ 75 75 struct ehci_qh *async; 76 + struct ehci_qh *dummy; /* For AMD quirk use */ 76 77 struct ehci_qh *reclaim; 77 78 unsigned scanning : 1; 78 79 ··· 132 131 unsigned need_io_watchdog:1; 133 132 unsigned broken_periodic:1; 134 133 unsigned fs_i_thresh:1; /* Intel iso scheduling */ 134 + unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ 135 135 136 136 /* required for usb32 quirk */ 137 137 #define OHCI_CTRL_HCFS (3 << 6)
+1 -1
drivers/usb/host/isp1362-hcd.c
··· 2683 2683 return 0; 2684 2684 } 2685 2685 2686 - static int __init isp1362_probe(struct platform_device *pdev) 2686 + static int __devinit isp1362_probe(struct platform_device *pdev) 2687 2687 { 2688 2688 struct usb_hcd *hcd; 2689 2689 struct isp1362_hcd *isp1362_hcd;
+2 -2
drivers/usb/host/xhci-mem.c
··· 1045 1045 if (udev->speed == USB_SPEED_SUPER) 1046 1046 return ep->ss_ep_comp.wBytesPerInterval; 1047 1047 1048 - max_packet = ep->desc.wMaxPacketSize & 0x3ff; 1048 + max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); 1049 1049 max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; 1050 1050 /* A 0 in max burst means 1 transfer per ESIT */ 1051 1051 return max_packet * (max_burst + 1); ··· 1135 1135 /* Fall through */ 1136 1136 case USB_SPEED_FULL: 1137 1137 case USB_SPEED_LOW: 1138 - max_packet = ep->desc.wMaxPacketSize & 0x3ff; 1138 + max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); 1139 1139 ep_ctx->ep_info2 |= MAX_PACKET(max_packet); 1140 1140 break; 1141 1141 default:
-1
drivers/usb/host/xhci-ring.c
··· 2104 2104 2105 2105 if (!(status & STS_EINT)) { 2106 2106 spin_unlock(&xhci->lock); 2107 - xhci_warn(xhci, "Spurious interrupt.\n"); 2108 2107 return IRQ_NONE; 2109 2108 } 2110 2109 xhci_dbg(xhci, "op reg status = %08x\n", status);
+63 -10
drivers/usb/host/xhci.c
··· 577 577 xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); 578 578 } 579 579 580 + static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) 581 + { 582 + u64 val_64; 583 + 584 + /* step 2: initialize command ring buffer */ 585 + val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); 586 + val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) | 587 + (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, 588 + xhci->cmd_ring->dequeue) & 589 + (u64) ~CMD_RING_RSVD_BITS) | 590 + xhci->cmd_ring->cycle_state; 591 + xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", 592 + (long unsigned long) val_64); 593 + xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); 594 + } 595 + 596 + /* 597 + * The whole command ring must be cleared to zero when we suspend the host. 598 + * 599 + * The host doesn't save the command ring pointer in the suspend well, so we 600 + * need to re-program it on resume. Unfortunately, the pointer must be 64-byte 601 + * aligned, because of the reserved bits in the command ring dequeue pointer 602 + * register. Therefore, we can't just set the dequeue pointer back in the 603 + * middle of the ring (TRBs are 16-byte aligned). 604 + */ 605 + static void xhci_clear_command_ring(struct xhci_hcd *xhci) 606 + { 607 + struct xhci_ring *ring; 608 + struct xhci_segment *seg; 609 + 610 + ring = xhci->cmd_ring; 611 + seg = ring->deq_seg; 612 + do { 613 + memset(seg->trbs, 0, SEGMENT_SIZE); 614 + seg = seg->next; 615 + } while (seg != ring->deq_seg); 616 + 617 + /* Reset the software enqueue and dequeue pointers */ 618 + ring->deq_seg = ring->first_seg; 619 + ring->dequeue = ring->first_seg->trbs; 620 + ring->enq_seg = ring->deq_seg; 621 + ring->enqueue = ring->dequeue; 622 + 623 + /* 624 + * Ring is now zeroed, so the HW should look for change of ownership 625 + * when the cycle bit is set to 1. 626 + */ 627 + ring->cycle_state = 1; 628 + 629 + /* 630 + * Reset the hardware dequeue pointer. 631 + * Yes, this will need to be re-written after resume, but we're paranoid 632 + * and want to make sure the hardware doesn't access bogus memory 633 + * because, say, the BIOS or an SMI started the host without changing 634 + * the command ring pointers. 635 + */ 636 + xhci_set_cmd_ring_deq(xhci); 637 + } 638 + 580 639 /* 581 640 * Stop HC (not bus-specific) 582 641 * ··· 663 604 spin_unlock_irq(&xhci->lock); 664 605 return -ETIMEDOUT; 665 606 } 607 + xhci_clear_command_ring(xhci); 666 608 667 609 /* step 3: save registers */ 668 610 xhci_save_registers(xhci); ··· 695 635 u32 command, temp = 0; 696 636 struct usb_hcd *hcd = xhci_to_hcd(xhci); 697 637 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 698 - u64 val_64; 699 638 int old_state, retval; 700 639 701 640 old_state = hcd->state; ··· 707 648 /* step 1: restore register */ 708 649 xhci_restore_registers(xhci); 709 650 /* step 2: initialize command ring buffer */ 710 - val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); 711 - val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) | 712 - (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, 713 - xhci->cmd_ring->dequeue) & 714 - (u64) ~CMD_RING_RSVD_BITS) | 715 - xhci->cmd_ring->cycle_state; 716 - xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", 717 - (long unsigned long) val_64); 718 - xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); 651 + xhci_set_cmd_ring_deq(xhci); 719 652 /* step 3: restore state and start state*/ 720 653 /* step 3: set CRS flag */ 721 654 command = xhci_readl(xhci, &xhci->op_regs->command); ··· 765 714 return retval; 766 715 } 767 716 717 + spin_unlock_irq(&xhci->lock); 768 718 /* Re-setup MSI-X */ 769 719 if (hcd->irq) 770 720 free_irq(hcd->irq, hcd); ··· 788 736 hcd->irq = pdev->irq; 789 737 } 790 738 739 + spin_lock_irq(&xhci->lock); 791 740 /* step 4: set Run/Stop bit */ 792 741 command = xhci_readl(xhci, &xhci->op_regs->command); 793 742 command |= CMD_RUN;
+5
drivers/usb/host/xhci.h
··· 621 621 #define MAX_PACKET_MASK (0xffff << 16) 622 622 #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) 623 623 624 + /* Get max packet size from ep desc. Bit 10..0 specify the max packet size. 625 + * USB2.0 spec 9.6.6. 626 + */ 627 + #define GET_MAX_PACKET(p) ((p) & 0x7ff) 628 + 624 629 /* tx_info bitmasks */ 625 630 #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) 626 631 #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)
+2 -4
drivers/usb/misc/cypress_cy7c63.c
··· 196 196 return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); 197 197 } 198 198 199 - static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, 200 - get_port0_handler, set_port0_handler); 199 + static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); 201 200 202 - static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, 203 - get_port1_handler, set_port1_handler); 201 + static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); 204 202 205 203 206 204 static int cypress_probe(struct usb_interface *interface,
+1 -1
drivers/usb/misc/trancevibrator.c
··· 86 86 return count; 87 87 } 88 88 89 - static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); 89 + static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed); 90 90 91 91 static int tv_probe(struct usb_interface *interface, 92 92 const struct usb_device_id *id)
+1 -1
drivers/usb/misc/usbled.c
··· 94 94 change_color(led); \ 95 95 return count; \ 96 96 } \ 97 - static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); 97 + static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value); 98 98 show_set(blue); 99 99 show_set(red); 100 100 show_set(green);
+4 -6
drivers/usb/misc/usbsevseg.c
··· 192 192 \ 193 193 return count; \ 194 194 } \ 195 - static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); 195 + static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); 196 196 197 197 static ssize_t show_attr_text(struct device *dev, 198 198 struct device_attribute *attr, char *buf) ··· 223 223 return count; 224 224 } 225 225 226 - static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); 226 + static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text); 227 227 228 228 static ssize_t show_attr_decimals(struct device *dev, 229 229 struct device_attribute *attr, char *buf) ··· 272 272 return count; 273 273 } 274 274 275 - static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, 276 - show_attr_decimals, set_attr_decimals); 275 + static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals); 277 276 278 277 static ssize_t show_attr_textmode(struct device *dev, 279 278 struct device_attribute *attr, char *buf) ··· 318 319 return -EINVAL; 319 320 } 320 321 321 - static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, 322 - show_attr_textmode, set_attr_textmode); 322 + static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode); 323 323 324 324 325 325 MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered);
+4 -5
drivers/usb/otg/langwell_otg.c
··· 1896 1896 } 1897 1897 return count; 1898 1898 } 1899 - static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUGO, get_a_bus_req, set_a_bus_req); 1899 + static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, set_a_bus_req); 1900 1900 1901 1901 static ssize_t 1902 1902 get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) ··· 1942 1942 } 1943 1943 return count; 1944 1944 } 1945 - static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUGO, 1946 - get_a_bus_drop, set_a_bus_drop); 1945 + static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, set_a_bus_drop); 1947 1946 1948 1947 static ssize_t 1949 1948 get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) ··· 1987 1988 } 1988 1989 return count; 1989 1990 } 1990 - static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUGO, get_b_bus_req, set_b_bus_req); 1991 + static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUSR, get_b_bus_req, set_b_bus_req); 1991 1992 1992 1993 static ssize_t 1993 1994 set_a_clr_err(struct device *dev, struct device_attribute *attr, ··· 2011 2012 } 2012 2013 return count; 2013 2014 } 2014 - static DEVICE_ATTR(a_clr_err, S_IWUGO, NULL, set_a_clr_err); 2015 + static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err); 2015 2016 2016 2017 static struct attribute *inputs_attrs[] = { 2017 2018 &dev_attr_a_bus_req.attr,
+1 -1
drivers/usb/storage/sierra_ms.c
··· 121 121 } 122 122 return result; 123 123 } 124 - static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); 124 + static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL); 125 125 126 126 int sierra_ms_init(struct us_data *us) 127 127 {