Skip to content

Commit b635ace

Browse files
committed
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: (47 commits) usb: musb: pass configuration specifics via pdata usb: musb: fix hanging when rmmod gadget driver USB: Add MUSB and TUSB support USB: serial: remove CONFIG_USB_DEBUG from sierra and option drivers USB: Add vendor/product id of ZTE MF628 to option USB: quirk PLL power down mode USB: omap_udc: fix compilation with debug enabled usb: cdc-acm: drain writes on close usb: cdc-acm: stop dropping tx buffers usb: cdc-acm: bugfix release() usb gadget: issue notifications from ACM function usb gadget: remove needless struct members USB: sh: r8a66597-hcd: fix disconnect regression USB: isp1301: fix compilation USB: fix compiler warning fix usb-storage: unusual_devs entry for Nokia 5300 USB: cdc-acm.c: Fix compile warnings USB: BandRich BandLuxe C150/C250 HSPA Data Card Driver USB: ftdi_sio: add support for PHI Fisco data cable (FT232BM based, VID/PID 0403:e40b) usb: isp1760: don't be noisy about short packets. ...
2 parents 9921b25 + ca6d1b1 commit b635ace

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+16723
-2548
lines changed

Documentation/devices.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,9 +2560,6 @@ Your cooperation is appreciated.
25602560
96 = /dev/usb/hiddev0 1st USB HID device
25612561
...
25622562
111 = /dev/usb/hiddev15 16th USB HID device
2563-
112 = /dev/usb/auer0 1st auerswald ISDN device
2564-
...
2565-
127 = /dev/usb/auer15 16th auerswald ISDN device
25662563
128 = /dev/usb/brlvgr0 First Braille Voyager device
25672564
...
25682565
131 = /dev/usb/brlvgr3 Fourth Braille Voyager device

Documentation/ioctl-number.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ Code Seq# Include File Comments
105105
'T' all linux/soundcard.h conflict!
106106
'T' all asm-i386/ioctls.h conflict!
107107
'U' 00-EF linux/drivers/usb/usb.h
108-
'U' F0-FF drivers/usb/auerswald.c
109108
'V' all linux/vt.h
110109
'W' 00-1F linux/watchdog.h conflict!
111110
'W' 00-1F linux/wanrouter.h conflict!

Documentation/usb/auerswald.txt

Lines changed: 0 additions & 30 deletions
This file was deleted.

Documentation/usb/power-management.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,12 @@ post_reset; the USB core guarantees that this is true of internal
436436
suspend/resume events as well.
437437

438438
If a driver wants to block all suspend/resume calls during some
439-
critical section, it can simply acquire udev->pm_mutex.
439+
critical section, it can simply acquire udev->pm_mutex. Note that
440+
calls to resume may be triggered indirectly. Block IO due to memory
441+
allocations can make the vm subsystem resume a device. Thus while
442+
holding this lock you must not allocate memory with GFP_KERNEL or
443+
GFP_NOFS.
444+
440445
Alternatively, if the critical section might call some of the
441446
usb_autopm_* routines, the driver can avoid deadlock by doing:
442447

MAINTAINERS

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,6 +2928,12 @@ M: [email protected]
29282928
29292929
S: Maintained
29302930

2931+
MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
2932+
P: Felipe Balbi
2933+
2934+
2935+
S: Maintained
2936+
29312937
MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
29322938
P: Andrew Gallatin
29332939
@@ -4196,12 +4202,6 @@ M: [email protected]
41964202
41974203
S: Maintained
41984204

4199-
USB AUERSWALD DRIVER
4200-
P: Wolfgang Muees
4201-
4202-
4203-
S: Maintained
4204-
42054205
USB BLOCK DRIVER (UB ub)
42064206
P: Pete Zaitcev
42074207

arch/arm/mach-omap2/usb-tusb6010.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
317317
printk(error, 6, status);
318318
return -ENODEV;
319319
}
320-
data->multipoint = 1;
321320
tusb_device.dev.platform_data = data;
322321

323322
/* REVISIT let the driver know what DMA channels work */

drivers/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/
5757
obj-$(CONFIG_PARIDE) += block/paride/
5858
obj-$(CONFIG_TC) += tc/
5959
obj-$(CONFIG_USB) += usb/
60+
obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/
6061
obj-$(CONFIG_PCI) += usb/
6162
obj-$(CONFIG_USB_GADGET) += usb/gadget/
6263
obj-$(CONFIG_SERIO) += input/serio/

drivers/i2c/chips/isp1301_omap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,7 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind)
15931593
if (machine_is_omap_h2()) {
15941594
/* full speed signaling by default */
15951595
isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1,
1596-
MC1_SPEED_REG);
1596+
MC1_SPEED);
15971597
isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2,
15981598
MC2_SPD_SUSP_CTRL);
15991599

drivers/usb/Kconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,18 @@ config USB
9595

9696
source "drivers/usb/core/Kconfig"
9797

98+
source "drivers/usb/mon/Kconfig"
99+
98100
source "drivers/usb/host/Kconfig"
99101

102+
source "drivers/usb/musb/Kconfig"
103+
100104
source "drivers/usb/class/Kconfig"
101105

102106
source "drivers/usb/storage/Kconfig"
103107

104108
source "drivers/usb/image/Kconfig"
105109

106-
source "drivers/usb/mon/Kconfig"
107-
108110
comment "USB port drivers"
109111
depends on USB
110112

drivers/usb/atm/cxacru.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ
602602
offd = le32_to_cpu(buf[offb++]);
603603
if (offd >= size) {
604604
if (printk_ratelimit())
605-
usb_err(instance->usbatm, "wrong index #%x in response to cm #%x\n",
605+
usb_err(instance->usbatm, "wrong index %#x in response to cm %#x\n",
606606
offd, cm);
607607
ret = -EIO;
608608
goto cleanup;

drivers/usb/class/cdc-acm.c

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
*/
5252

5353
#undef DEBUG
54+
#undef VERBOSE_DEBUG
5455

5556
#include <linux/kernel.h>
5657
#include <linux/errno.h>
@@ -70,6 +71,9 @@
7071

7172
#include "cdc-acm.h"
7273

74+
75+
#define ACM_CLOSE_TIMEOUT 15 /* seconds to let writes drain */
76+
7377
/*
7478
* Version Information
7579
*/
@@ -85,6 +89,12 @@ static DEFINE_MUTEX(open_mutex);
8589

8690
#define ACM_READY(acm) (acm && acm->dev && acm->used)
8791

92+
#ifdef VERBOSE_DEBUG
93+
#define verbose 1
94+
#else
95+
#define verbose 0
96+
#endif
97+
8898
/*
8999
* Functions for ACM control messages.
90100
*/
@@ -136,19 +146,17 @@ static int acm_wb_alloc(struct acm *acm)
136146
static int acm_wb_is_avail(struct acm *acm)
137147
{
138148
int i, n;
149+
unsigned long flags;
139150

140151
n = ACM_NW;
152+
spin_lock_irqsave(&acm->write_lock, flags);
141153
for (i = 0; i < ACM_NW; i++) {
142154
n -= acm->wb[i].use;
143155
}
156+
spin_unlock_irqrestore(&acm->write_lock, flags);
144157
return n;
145158
}
146159

147-
static inline int acm_wb_is_used(struct acm *acm, int wbn)
148-
{
149-
return acm->wb[wbn].use;
150-
}
151-
152160
/*
153161
* Finish write.
154162
*/
@@ -157,7 +165,6 @@ static void acm_write_done(struct acm *acm, struct acm_wb *wb)
157165
unsigned long flags;
158166

159167
spin_lock_irqsave(&acm->write_lock, flags);
160-
acm->write_ready = 1;
161168
wb->use = 0;
162169
acm->transmitting--;
163170
spin_unlock_irqrestore(&acm->write_lock, flags);
@@ -190,40 +197,25 @@ static int acm_start_wb(struct acm *acm, struct acm_wb *wb)
190197
static int acm_write_start(struct acm *acm, int wbn)
191198
{
192199
unsigned long flags;
193-
struct acm_wb *wb;
200+
struct acm_wb *wb = &acm->wb[wbn];
194201
int rc;
195202

196203
spin_lock_irqsave(&acm->write_lock, flags);
197204
if (!acm->dev) {
205+
wb->use = 0;
198206
spin_unlock_irqrestore(&acm->write_lock, flags);
199207
return -ENODEV;
200208
}
201209

202-
if (!acm->write_ready) {
203-
spin_unlock_irqrestore(&acm->write_lock, flags);
204-
return 0; /* A white lie */
205-
}
206-
207-
wb = &acm->wb[wbn];
208-
if(acm_wb_is_avail(acm) <= 1)
209-
acm->write_ready = 0;
210-
211210
dbg("%s susp_count: %d", __func__, acm->susp_count);
212211
if (acm->susp_count) {
213-
acm->old_ready = acm->write_ready;
214212
acm->delayed_wb = wb;
215-
acm->write_ready = 0;
216213
schedule_work(&acm->waker);
217214
spin_unlock_irqrestore(&acm->write_lock, flags);
218215
return 0; /* A white lie */
219216
}
220217
usb_mark_last_busy(acm->dev);
221218

222-
if (!acm_wb_is_used(acm, wbn)) {
223-
spin_unlock_irqrestore(&acm->write_lock, flags);
224-
return 0;
225-
}
226-
227219
rc = acm_start_wb(acm, wb);
228220
spin_unlock_irqrestore(&acm->write_lock, flags);
229221

@@ -488,22 +480,28 @@ static void acm_rx_tasklet(unsigned long _acm)
488480
/* data interface wrote those outgoing bytes */
489481
static void acm_write_bulk(struct urb *urb)
490482
{
491-
struct acm *acm;
492483
struct acm_wb *wb = urb->context;
484+
struct acm *acm = wb->instance;
493485

494-
dbg("Entering acm_write_bulk with status %d", urb->status);
486+
if (verbose || urb->status
487+
|| (urb->actual_length != urb->transfer_buffer_length))
488+
dev_dbg(&acm->data->dev, "tx %d/%d bytes -- > %d\n",
489+
urb->actual_length,
490+
urb->transfer_buffer_length,
491+
urb->status);
495492

496-
acm = wb->instance;
497493
acm_write_done(acm, wb);
498494
if (ACM_READY(acm))
499495
schedule_work(&acm->work);
496+
else
497+
wake_up_interruptible(&acm->drain_wait);
500498
}
501499

502500
static void acm_softint(struct work_struct *work)
503501
{
504502
struct acm *acm = container_of(work, struct acm, work);
505-
dbg("Entering acm_softint.");
506-
503+
504+
dev_vdbg(&acm->data->dev, "tx work\n");
507505
if (!ACM_READY(acm))
508506
return;
509507
tty_wakeup(acm->tty);
@@ -512,7 +510,6 @@ static void acm_softint(struct work_struct *work)
512510
static void acm_waker(struct work_struct *waker)
513511
{
514512
struct acm *acm = container_of(waker, struct acm, waker);
515-
long flags;
516513
int rv;
517514

518515
rv = usb_autopm_get_interface(acm->control);
@@ -524,9 +521,6 @@ static void acm_waker(struct work_struct *waker)
524521
acm_start_wb(acm, acm->delayed_wb);
525522
acm->delayed_wb = NULL;
526523
}
527-
spin_lock_irqsave(&acm->write_lock, flags);
528-
acm->write_ready = acm->old_ready;
529-
spin_unlock_irqrestore(&acm->write_lock, flags);
530524
usb_autopm_put_interface(acm->control);
531525
}
532526

@@ -628,6 +622,8 @@ static void acm_tty_unregister(struct acm *acm)
628622
kfree(acm);
629623
}
630624

625+
static int acm_tty_chars_in_buffer(struct tty_struct *tty);
626+
631627
static void acm_tty_close(struct tty_struct *tty, struct file *filp)
632628
{
633629
struct acm *acm = tty->driver_data;
@@ -642,6 +638,13 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
642638
if (acm->dev) {
643639
usb_autopm_get_interface(acm->control);
644640
acm_set_control(acm, acm->ctrlout = 0);
641+
642+
/* try letting the last writes drain naturally */
643+
wait_event_interruptible_timeout(acm->drain_wait,
644+
(ACM_NW == acm_wb_is_avail(acm))
645+
|| !acm->dev,
646+
ACM_CLOSE_TIMEOUT * HZ);
647+
645648
usb_kill_urb(acm->ctrlurb);
646649
for (i = 0; i < ACM_NW; i++)
647650
usb_kill_urb(acm->wb[i].urb);
@@ -697,7 +700,7 @@ static int acm_tty_write_room(struct tty_struct *tty)
697700
* Do not let the line discipline to know that we have a reserve,
698701
* or it might get too enthusiastic.
699702
*/
700-
return (acm->write_ready && acm_wb_is_avail(acm)) ? acm->writesize : 0;
703+
return acm_wb_is_avail(acm) ? acm->writesize : 0;
701704
}
702705

703706
static int acm_tty_chars_in_buffer(struct tty_struct *tty)
@@ -1072,11 +1075,11 @@ static int acm_probe (struct usb_interface *intf,
10721075
acm->urb_task.data = (unsigned long) acm;
10731076
INIT_WORK(&acm->work, acm_softint);
10741077
INIT_WORK(&acm->waker, acm_waker);
1078+
init_waitqueue_head(&acm->drain_wait);
10751079
spin_lock_init(&acm->throttle_lock);
10761080
spin_lock_init(&acm->write_lock);
10771081
spin_lock_init(&acm->read_lock);
10781082
mutex_init(&acm->mutex);
1079-
acm->write_ready = 1;
10801083
acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress);
10811084

10821085
buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma);
@@ -1108,9 +1111,11 @@ static int acm_probe (struct usb_interface *intf,
11081111
rcv->instance = acm;
11091112
}
11101113
for (i = 0; i < num_rx_buf; i++) {
1111-
struct acm_rb *buf = &(acm->rb[i]);
1114+
struct acm_rb *rb = &(acm->rb[i]);
11121115

1113-
if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) {
1116+
rb->base = usb_buffer_alloc(acm->dev, readsize,
1117+
GFP_KERNEL, &rb->dma);
1118+
if (!rb->base) {
11141119
dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)\n");
11151120
goto alloc_fail7;
11161121
}
@@ -1172,6 +1177,7 @@ static int acm_probe (struct usb_interface *intf,
11721177
acm_set_line(acm, &acm->line);
11731178

11741179
usb_driver_claim_interface(&acm_driver, data_interface, acm);
1180+
usb_set_intfdata(data_interface, acm);
11751181

11761182
usb_get_intf(control_interface);
11771183
tty_register_device(acm_tty_driver, minor, &control_interface->dev);
@@ -1221,11 +1227,11 @@ static void acm_disconnect(struct usb_interface *intf)
12211227
struct acm *acm = usb_get_intfdata(intf);
12221228
struct usb_device *usb_dev = interface_to_usbdev(intf);
12231229

1224-
mutex_lock(&open_mutex);
1225-
if (!acm || !acm->dev) {
1226-
mutex_unlock(&open_mutex);
1230+
/* sibling interface is already cleaning up */
1231+
if (!acm)
12271232
return;
1228-
}
1233+
1234+
mutex_lock(&open_mutex);
12291235
if (acm->country_codes){
12301236
device_remove_file(&acm->control->dev,
12311237
&dev_attr_wCountryCodes);

0 commit comments

Comments
 (0)