Skip to content

Commit 3ad2e31

Browse files
committed
Merge tag 'usb-3.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg Kroah-Hartman: "Here are some small USB driver fixes that resolve some reported problems for 3.10-rc6 Nothing major, just 3 USB serial driver fixes, and two chipidea fixes" * tag 'usb-3.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: chipidea: fix id change handling usb: chipidea: fix no transceiver case USB: pl2303: fix device initialisation at open USB: spcp8x5: fix device initialisation at open USB: f81232: fix device initialisation at open
2 parents a2648eb + 0c3f3dc commit 3ad2e31

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

drivers/usb/chipidea/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,9 @@ static void ci_role_work(struct work_struct *work)
276276

277277
ci_role_stop(ci);
278278
ci_role_start(ci, role);
279-
enable_irq(ci->irq);
280279
}
280+
281+
enable_irq(ci->irq);
281282
}
282283

283284
static irqreturn_t ci_irq(int irq, void *data)

drivers/usb/chipidea/udc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,8 +1678,11 @@ static int udc_start(struct ci13xxx *ci)
16781678

16791679
ci->gadget.ep0 = &ci->ep0in->ep;
16801680

1681-
if (ci->global_phy)
1681+
if (ci->global_phy) {
16821682
ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
1683+
if (IS_ERR(ci->transceiver))
1684+
ci->transceiver = NULL;
1685+
}
16831686

16841687
if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
16851688
if (ci->transceiver == NULL) {
@@ -1694,7 +1697,7 @@ static int udc_start(struct ci13xxx *ci)
16941697
goto put_transceiver;
16951698
}
16961699

1697-
if (!IS_ERR_OR_NULL(ci->transceiver)) {
1700+
if (ci->transceiver) {
16981701
retval = otg_set_peripheral(ci->transceiver->otg,
16991702
&ci->gadget);
17001703
if (retval)
@@ -1711,15 +1714,15 @@ static int udc_start(struct ci13xxx *ci)
17111714
return retval;
17121715

17131716
remove_trans:
1714-
if (!IS_ERR_OR_NULL(ci->transceiver)) {
1717+
if (ci->transceiver) {
17151718
otg_set_peripheral(ci->transceiver->otg, NULL);
17161719
if (ci->global_phy)
17171720
usb_put_phy(ci->transceiver);
17181721
}
17191722

17201723
dev_err(dev, "error = %i\n", retval);
17211724
put_transceiver:
1722-
if (!IS_ERR_OR_NULL(ci->transceiver) && ci->global_phy)
1725+
if (ci->transceiver && ci->global_phy)
17231726
usb_put_phy(ci->transceiver);
17241727
destroy_eps:
17251728
destroy_eps(ci);
@@ -1747,7 +1750,7 @@ static void udc_stop(struct ci13xxx *ci)
17471750
dma_pool_destroy(ci->td_pool);
17481751
dma_pool_destroy(ci->qh_pool);
17491752

1750-
if (!IS_ERR_OR_NULL(ci->transceiver)) {
1753+
if (ci->transceiver) {
17511754
otg_set_peripheral(ci->transceiver->otg, NULL);
17521755
if (ci->global_phy)
17531756
usb_put_phy(ci->transceiver);

drivers/usb/serial/f81232.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,12 @@ static void f81232_set_termios(struct tty_struct *tty,
165165
/* FIXME - Stubbed out for now */
166166

167167
/* Don't change anything if nothing has changed */
168-
if (!tty_termios_hw_change(&tty->termios, old_termios))
168+
if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
169169
return;
170170

171171
/* Do the real work here... */
172-
tty_termios_copy_hw(&tty->termios, old_termios);
172+
if (old_termios)
173+
tty_termios_copy_hw(&tty->termios, old_termios);
173174
}
174175

175176
static int f81232_tiocmget(struct tty_struct *tty)
@@ -187,12 +188,11 @@ static int f81232_tiocmset(struct tty_struct *tty,
187188

188189
static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
189190
{
190-
struct ktermios tmp_termios;
191191
int result;
192192

193193
/* Setup termios */
194194
if (tty)
195-
f81232_set_termios(tty, port, &tmp_termios);
195+
f81232_set_termios(tty, port, NULL);
196196

197197
result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
198198
if (result) {

drivers/usb/serial/pl2303.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
284284
serial settings even to the same values as before. Thus
285285
we actually need to filter in this specific case */
286286

287-
if (!tty_termios_hw_change(&tty->termios, old_termios))
287+
if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
288288
return;
289289

290290
cflag = tty->termios.c_cflag;
@@ -293,7 +293,8 @@ static void pl2303_set_termios(struct tty_struct *tty,
293293
if (!buf) {
294294
dev_err(&port->dev, "%s - out of memory.\n", __func__);
295295
/* Report back no change occurred */
296-
tty->termios = *old_termios;
296+
if (old_termios)
297+
tty->termios = *old_termios;
297298
return;
298299
}
299300

@@ -433,7 +434,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
433434
control = priv->line_control;
434435
if ((cflag & CBAUD) == B0)
435436
priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
436-
else if ((old_termios->c_cflag & CBAUD) == B0)
437+
else if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
437438
priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
438439
if (control != priv->line_control) {
439440
control = priv->line_control;
@@ -492,7 +493,6 @@ static void pl2303_close(struct usb_serial_port *port)
492493

493494
static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
494495
{
495-
struct ktermios tmp_termios;
496496
struct usb_serial *serial = port->serial;
497497
struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
498498
int result;
@@ -508,7 +508,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
508508

509509
/* Setup termios */
510510
if (tty)
511-
pl2303_set_termios(tty, port, &tmp_termios);
511+
pl2303_set_termios(tty, port, NULL);
512512

513513
result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
514514
if (result) {

drivers/usb/serial/spcp8x5.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,23 +291,22 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
291291
struct spcp8x5_private *priv = usb_get_serial_port_data(port);
292292
unsigned long flags;
293293
unsigned int cflag = tty->termios.c_cflag;
294-
unsigned int old_cflag = old_termios->c_cflag;
295294
unsigned short uartdata;
296295
unsigned char buf[2] = {0, 0};
297296
int baud;
298297
int i;
299298
u8 control;
300299

301300
/* check that they really want us to change something */
302-
if (!tty_termios_hw_change(&tty->termios, old_termios))
301+
if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
303302
return;
304303

305304
/* set DTR/RTS active */
306305
spin_lock_irqsave(&priv->lock, flags);
307306
control = priv->line_control;
308-
if ((old_cflag & CBAUD) == B0) {
307+
if (old_termios && (old_termios->c_cflag & CBAUD) == B0) {
309308
priv->line_control |= MCR_DTR;
310-
if (!(old_cflag & CRTSCTS))
309+
if (!(old_termios->c_cflag & CRTSCTS))
311310
priv->line_control |= MCR_RTS;
312311
}
313312
if (control != priv->line_control) {
@@ -394,7 +393,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
394393

395394
static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port)
396395
{
397-
struct ktermios tmp_termios;
398396
struct usb_serial *serial = port->serial;
399397
struct spcp8x5_private *priv = usb_get_serial_port_data(port);
400398
int ret;
@@ -411,7 +409,7 @@ static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port)
411409
spcp8x5_set_ctrl_line(port, priv->line_control);
412410

413411
if (tty)
414-
spcp8x5_set_termios(tty, port, &tmp_termios);
412+
spcp8x5_set_termios(tty, port, NULL);
415413

416414
port->port.drain_delay = 256;
417415

0 commit comments

Comments
 (0)