diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/c67x00/c67x00-ll-hpi.c | 12 | ||||
-rw-r--r-- | drivers/usb/class/cdc-wdm.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 46 | ||||
-rw-r--r-- | drivers/usb/host/Kconfig | 8 | ||||
-rw-r--r-- | drivers/usb/host/isp1760-hcd.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/isp1760-if.c | 4 | ||||
-rw-r--r-- | drivers/usb/misc/Kconfig | 1 | ||||
-rw-r--r-- | drivers/usb/misc/isight_firmware.c | 23 |
8 files changed, 79 insertions, 27 deletions
diff --git a/drivers/usb/c67x00/c67x00-ll-hpi.c b/drivers/usb/c67x00/c67x00-ll-hpi.c index 5100fbbf6cb0..a9636f43bca2 100644 --- a/drivers/usb/c67x00/c67x00-ll-hpi.c +++ b/drivers/usb/c67x00/c67x00-ll-hpi.c | |||
@@ -120,7 +120,7 @@ static void hpi_write_word(struct c67x00_device *dev, u16 reg, u16 value) | |||
120 | * Only data is little endian, addr has cpu endianess | 120 | * Only data is little endian, addr has cpu endianess |
121 | */ | 121 | */ |
122 | static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr, | 122 | static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr, |
123 | u16 *data, u16 count) | 123 | __le16 *data, u16 count) |
124 | { | 124 | { |
125 | unsigned long flags; | 125 | unsigned long flags; |
126 | int i; | 126 | int i; |
@@ -129,7 +129,7 @@ static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr, | |||
129 | 129 | ||
130 | hpi_write_reg(dev, HPI_ADDR, addr); | 130 | hpi_write_reg(dev, HPI_ADDR, addr); |
131 | for (i = 0; i < count; i++) | 131 | for (i = 0; i < count; i++) |
132 | hpi_write_reg(dev, HPI_DATA, cpu_to_le16(*data++)); | 132 | hpi_write_reg(dev, HPI_DATA, le16_to_cpu(*data++)); |
133 | 133 | ||
134 | spin_unlock_irqrestore(&dev->hpi.lock, flags); | 134 | spin_unlock_irqrestore(&dev->hpi.lock, flags); |
135 | } | 135 | } |
@@ -138,7 +138,7 @@ static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr, | |||
138 | * Only data is little endian, addr has cpu endianess | 138 | * Only data is little endian, addr has cpu endianess |
139 | */ | 139 | */ |
140 | static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr, | 140 | static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr, |
141 | u16 *data, u16 count) | 141 | __le16 *data, u16 count) |
142 | { | 142 | { |
143 | unsigned long flags; | 143 | unsigned long flags; |
144 | int i; | 144 | int i; |
@@ -146,7 +146,7 @@ static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr, | |||
146 | spin_lock_irqsave(&dev->hpi.lock, flags); | 146 | spin_lock_irqsave(&dev->hpi.lock, flags); |
147 | hpi_write_reg(dev, HPI_ADDR, addr); | 147 | hpi_write_reg(dev, HPI_ADDR, addr); |
148 | for (i = 0; i < count; i++) | 148 | for (i = 0; i < count; i++) |
149 | *data++ = le16_to_cpu(hpi_read_reg(dev, HPI_DATA)); | 149 | *data++ = cpu_to_le16(hpi_read_reg(dev, HPI_DATA)); |
150 | 150 | ||
151 | spin_unlock_irqrestore(&dev->hpi.lock, flags); | 151 | spin_unlock_irqrestore(&dev->hpi.lock, flags); |
152 | } | 152 | } |
@@ -425,7 +425,7 @@ void c67x00_ll_write_mem_le16(struct c67x00_device *dev, u16 addr, | |||
425 | len--; | 425 | len--; |
426 | } | 426 | } |
427 | 427 | ||
428 | hpi_write_words_le16(dev, addr, (u16 *)buf, len / 2); | 428 | hpi_write_words_le16(dev, addr, (__le16 *)buf, len / 2); |
429 | buf += len & ~0x01; | 429 | buf += len & ~0x01; |
430 | addr += len & ~0x01; | 430 | addr += len & ~0x01; |
431 | len &= 0x01; | 431 | len &= 0x01; |
@@ -456,7 +456,7 @@ void c67x00_ll_read_mem_le16(struct c67x00_device *dev, u16 addr, | |||
456 | len--; | 456 | len--; |
457 | } | 457 | } |
458 | 458 | ||
459 | hpi_read_words_le16(dev, addr, (u16 *)buf, len / 2); | 459 | hpi_read_words_le16(dev, addr, (__le16 *)buf, len / 2); |
460 | buf += len & ~0x01; | 460 | buf += len & ~0x01; |
461 | addr += len & ~0x01; | 461 | addr += len & ~0x01; |
462 | len &= 0x01; | 462 | len &= 0x01; |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 107666d4e2ec..731db051070a 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -611,8 +611,8 @@ next_desc: | |||
611 | goto err; | 611 | goto err; |
612 | } | 612 | } |
613 | 613 | ||
614 | desc->wMaxPacketSize = ep->wMaxPacketSize; | 614 | desc->wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize); |
615 | desc->bMaxPacketSize0 = cpu_to_le16(udev->descriptor.bMaxPacketSize0); | 615 | desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0; |
616 | 616 | ||
617 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | 617 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); |
618 | if (!desc->orq) | 618 | if (!desc->orq) |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 8eb4da332f56..94789be54ca3 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -644,6 +644,48 @@ static void hub_stop(struct usb_hub *hub) | |||
644 | 644 | ||
645 | #ifdef CONFIG_PM | 645 | #ifdef CONFIG_PM |
646 | 646 | ||
647 | /* Try to identify which devices need USB-PERSIST handling */ | ||
648 | static int persistent_device(struct usb_device *udev) | ||
649 | { | ||
650 | int i; | ||
651 | int retval; | ||
652 | struct usb_host_config *actconfig; | ||
653 | |||
654 | /* Explicitly not marked persistent? */ | ||
655 | if (!udev->persist_enabled) | ||
656 | return 0; | ||
657 | |||
658 | /* No active config? */ | ||
659 | actconfig = udev->actconfig; | ||
660 | if (!actconfig) | ||
661 | return 0; | ||
662 | |||
663 | /* FIXME! We should check whether it's open here or not! */ | ||
664 | |||
665 | /* | ||
666 | * Check that all the interface drivers have a | ||
667 | * 'reset_resume' entrypoint | ||
668 | */ | ||
669 | retval = 0; | ||
670 | for (i = 0; i < actconfig->desc.bNumInterfaces; i++) { | ||
671 | struct usb_interface *intf; | ||
672 | struct usb_driver *driver; | ||
673 | |||
674 | intf = actconfig->interface[i]; | ||
675 | if (!intf->dev.driver) | ||
676 | continue; | ||
677 | driver = to_usb_driver(intf->dev.driver); | ||
678 | if (!driver->reset_resume) | ||
679 | return 0; | ||
680 | /* | ||
681 | * We have at least one driver, and that one | ||
682 | * has a reset_resume method. | ||
683 | */ | ||
684 | retval = 1; | ||
685 | } | ||
686 | return retval; | ||
687 | } | ||
688 | |||
647 | static void hub_restart(struct usb_hub *hub, int type) | 689 | static void hub_restart(struct usb_hub *hub, int type) |
648 | { | 690 | { |
649 | struct usb_device *hdev = hub->hdev; | 691 | struct usb_device *hdev = hub->hdev; |
@@ -689,8 +731,8 @@ static void hub_restart(struct usb_hub *hub, int type) | |||
689 | * turn off the various status changes to prevent | 731 | * turn off the various status changes to prevent |
690 | * khubd from disconnecting it later. | 732 | * khubd from disconnecting it later. |
691 | */ | 733 | */ |
692 | if (udev->persist_enabled && status == 0 && | 734 | if (status == 0 && !(portstatus & USB_PORT_STAT_ENABLE) && |
693 | !(portstatus & USB_PORT_STAT_ENABLE)) { | 735 | persistent_device(udev)) { |
694 | if (portchange & USB_PORT_STAT_C_ENABLE) | 736 | if (portchange & USB_PORT_STAT_C_ENABLE) |
695 | clear_port_feature(hub->hdev, port1, | 737 | clear_port_feature(hub->hdev, port1, |
696 | USB_PORT_FEAT_C_ENABLE); | 738 | USB_PORT_FEAT_C_ENABLE); |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1ef6df395e0c..228797e54f9c 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -300,8 +300,8 @@ config USB_R8A66597_HCD | |||
300 | module will be called r8a66597-hcd. | 300 | module will be called r8a66597-hcd. |
301 | 301 | ||
302 | config SUPERH_ON_CHIP_R8A66597 | 302 | config SUPERH_ON_CHIP_R8A66597 |
303 | boolean "Enable SuperH on-chip USB like the R8A66597" | 303 | boolean "Enable SuperH on-chip R8A66597 USB" |
304 | depends on USB_R8A66597_HCD && CPU_SUBTYPE_SH7366 | 304 | depends on USB_R8A66597_HCD && (CPU_SUBTYPE_SH7366 || CPU_SUBTYPE_SH7723) |
305 | help | 305 | help |
306 | Renesas SuperH processor has USB like the R8A66597. | 306 | This driver enables support for the on-chip R8A66597 in the |
307 | This driver supported processor is SH7366. | 307 | SH7366 and SH7723 processors. |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index c9cec8738261..65aa5ecf569a 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -2207,14 +2207,14 @@ struct usb_hcd *isp1760_register(u64 res_start, u64 res_len, int irq, | |||
2207 | goto err_put; | 2207 | goto err_put; |
2208 | } | 2208 | } |
2209 | 2209 | ||
2210 | ret = usb_add_hcd(hcd, irq, irqflags); | ||
2211 | if (ret) | ||
2212 | goto err_unmap; | ||
2213 | |||
2214 | hcd->irq = irq; | 2210 | hcd->irq = irq; |
2215 | hcd->rsrc_start = res_start; | 2211 | hcd->rsrc_start = res_start; |
2216 | hcd->rsrc_len = res_len; | 2212 | hcd->rsrc_len = res_len; |
2217 | 2213 | ||
2214 | ret = usb_add_hcd(hcd, irq, irqflags); | ||
2215 | if (ret) | ||
2216 | goto err_unmap; | ||
2217 | |||
2218 | return hcd; | 2218 | return hcd; |
2219 | 2219 | ||
2220 | err_unmap: | 2220 | err_unmap: |
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index 440bf94f0d4c..c9db3fe98726 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -104,8 +104,8 @@ static u32 nxp_pci_io_base; | |||
104 | static u32 iolength; | 104 | static u32 iolength; |
105 | static u32 pci_mem_phy0; | 105 | static u32 pci_mem_phy0; |
106 | static u32 length; | 106 | static u32 length; |
107 | static u8 *chip_addr; | 107 | static u8 __iomem *chip_addr; |
108 | static u8 *iobase; | 108 | static u8 __iomem *iobase; |
109 | 109 | ||
110 | static int __devinit isp1761_pci_probe(struct pci_dev *dev, | 110 | static int __devinit isp1761_pci_probe(struct pci_dev *dev, |
111 | const struct pci_device_id *id) | 111 | const struct pci_device_id *id) |
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index eb6c06979f3b..001789c9a11a 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig | |||
@@ -272,6 +272,7 @@ config USB_TEST | |||
272 | config USB_ISIGHTFW | 272 | config USB_ISIGHTFW |
273 | tristate "iSight firmware loading support" | 273 | tristate "iSight firmware loading support" |
274 | depends on USB | 274 | depends on USB |
275 | select FW_LOADER | ||
275 | help | 276 | help |
276 | This driver loads firmware for USB Apple iSight cameras, allowing | 277 | This driver loads firmware for USB Apple iSight cameras, allowing |
277 | them to be driven by the USB video class driver available at | 278 | them to be driven by the USB video class driver available at |
diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c index 390e04885536..9f30aa1f8a5d 100644 --- a/drivers/usb/misc/isight_firmware.c +++ b/drivers/usb/misc/isight_firmware.c | |||
@@ -39,9 +39,12 @@ static int isight_firmware_load(struct usb_interface *intf, | |||
39 | struct usb_device *dev = interface_to_usbdev(intf); | 39 | struct usb_device *dev = interface_to_usbdev(intf); |
40 | int llen, len, req, ret = 0; | 40 | int llen, len, req, ret = 0; |
41 | const struct firmware *firmware; | 41 | const struct firmware *firmware; |
42 | unsigned char *buf; | 42 | unsigned char *buf = kmalloc(50, GFP_KERNEL); |
43 | unsigned char data[4]; | 43 | unsigned char data[4]; |
44 | char *ptr; | 44 | u8 *ptr; |
45 | |||
46 | if (!buf) | ||
47 | return -ENOMEM; | ||
45 | 48 | ||
46 | if (request_firmware(&firmware, "isight.fw", &dev->dev) != 0) { | 49 | if (request_firmware(&firmware, "isight.fw", &dev->dev) != 0) { |
47 | printk(KERN_ERR "Unable to load isight firmware\n"); | 50 | printk(KERN_ERR "Unable to load isight firmware\n"); |
@@ -59,7 +62,7 @@ static int isight_firmware_load(struct usb_interface *intf, | |||
59 | goto out; | 62 | goto out; |
60 | } | 63 | } |
61 | 64 | ||
62 | while (1) { | 65 | while (ptr+4 <= firmware->data+firmware->size) { |
63 | memcpy(data, ptr, 4); | 66 | memcpy(data, ptr, 4); |
64 | len = (data[0] << 8 | data[1]); | 67 | len = (data[0] << 8 | data[1]); |
65 | req = (data[2] << 8 | data[3]); | 68 | req = (data[2] << 8 | data[3]); |
@@ -71,10 +74,14 @@ static int isight_firmware_load(struct usb_interface *intf, | |||
71 | continue; | 74 | continue; |
72 | 75 | ||
73 | for (; len > 0; req += 50) { | 76 | for (; len > 0; req += 50) { |
74 | llen = len > 50 ? 50 : len; | 77 | llen = min(len, 50); |
75 | len -= llen; | 78 | len -= llen; |
76 | 79 | if (ptr+llen > firmware->data+firmware->size) { | |
77 | buf = kmalloc(llen, GFP_KERNEL); | 80 | printk(KERN_ERR |
81 | "Malformed isight firmware"); | ||
82 | ret = -ENODEV; | ||
83 | goto out; | ||
84 | } | ||
78 | memcpy(buf, ptr, llen); | 85 | memcpy(buf, ptr, llen); |
79 | 86 | ||
80 | ptr += llen; | 87 | ptr += llen; |
@@ -89,16 +96,18 @@ static int isight_firmware_load(struct usb_interface *intf, | |||
89 | goto out; | 96 | goto out; |
90 | } | 97 | } |
91 | 98 | ||
92 | kfree(buf); | ||
93 | } | 99 | } |
94 | } | 100 | } |
101 | |||
95 | if (usb_control_msg | 102 | if (usb_control_msg |
96 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1, | 103 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1, |
97 | 300) != 1) { | 104 | 300) != 1) { |
98 | printk(KERN_ERR "isight firmware loading completion failed\n"); | 105 | printk(KERN_ERR "isight firmware loading completion failed\n"); |
99 | ret = -ENODEV; | 106 | ret = -ENODEV; |
100 | } | 107 | } |
108 | |||
101 | out: | 109 | out: |
110 | kfree(buf); | ||
102 | release_firmware(firmware); | 111 | release_firmware(firmware); |
103 | return ret; | 112 | return ret; |
104 | } | 113 | } |