aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class/cdc-acm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r--drivers/usb/class/cdc-acm.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 38bfdb0f6660..2bfc41ece0e1 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -462,11 +462,18 @@ urbs:
462 462
463 rcv->buffer = buf; 463 rcv->buffer = buf;
464 464
465 usb_fill_bulk_urb(rcv->urb, acm->dev, 465 if (acm->is_int_ep)
466 acm->rx_endpoint, 466 usb_fill_int_urb(rcv->urb, acm->dev,
467 buf->base, 467 acm->rx_endpoint,
468 acm->readsize, 468 buf->base,
469 acm_read_bulk, rcv); 469 acm->readsize,
470 acm_read_bulk, rcv, acm->bInterval);
471 else
472 usb_fill_bulk_urb(rcv->urb, acm->dev,
473 acm->rx_endpoint,
474 buf->base,
475 acm->readsize,
476 acm_read_bulk, rcv);
470 rcv->urb->transfer_dma = buf->dma; 477 rcv->urb->transfer_dma = buf->dma;
471 rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 478 rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
472 479
@@ -550,7 +557,7 @@ static void acm_waker(struct work_struct *waker)
550static int acm_tty_open(struct tty_struct *tty, struct file *filp) 557static int acm_tty_open(struct tty_struct *tty, struct file *filp)
551{ 558{
552 struct acm *acm; 559 struct acm *acm;
553 int rv = -EINVAL; 560 int rv = -ENODEV;
554 int i; 561 int i;
555 dbg("Entering acm_tty_open."); 562 dbg("Entering acm_tty_open.");
556 563
@@ -677,7 +684,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
677 684
678 /* Perform the closing process and see if we need to do the hardware 685 /* Perform the closing process and see if we need to do the hardware
679 shutdown */ 686 shutdown */
680 if (tty_port_close_start(&acm->port, tty, filp) == 0) 687 if (!acm || tty_port_close_start(&acm->port, tty, filp) == 0)
681 return; 688 return;
682 acm_port_down(acm, 0); 689 acm_port_down(acm, 0);
683 tty_port_close_end(&acm->port, tty); 690 tty_port_close_end(&acm->port, tty);
@@ -740,7 +747,7 @@ static int acm_tty_chars_in_buffer(struct tty_struct *tty)
740{ 747{
741 struct acm *acm = tty->driver_data; 748 struct acm *acm = tty->driver_data;
742 if (!ACM_READY(acm)) 749 if (!ACM_READY(acm))
743 return -EINVAL; 750 return 0;
744 /* 751 /*
745 * This is inaccurate (overcounts), but it works. 752 * This is inaccurate (overcounts), but it works.
746 */ 753 */
@@ -1173,6 +1180,9 @@ made_compressed_probe:
1173 spin_lock_init(&acm->read_lock); 1180 spin_lock_init(&acm->read_lock);
1174 mutex_init(&acm->mutex); 1181 mutex_init(&acm->mutex);
1175 acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress); 1182 acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress);
1183 acm->is_int_ep = usb_endpoint_xfer_int(epread);
1184 if (acm->is_int_ep)
1185 acm->bInterval = epread->bInterval;
1176 tty_port_init(&acm->port); 1186 tty_port_init(&acm->port);
1177 acm->port.ops = &acm_port_ops; 1187 acm->port.ops = &acm_port_ops;
1178 1188
@@ -1227,9 +1237,14 @@ made_compressed_probe:
1227 goto alloc_fail7; 1237 goto alloc_fail7;
1228 } 1238 }
1229 1239
1230 usb_fill_bulk_urb(snd->urb, usb_dev, 1240 if (usb_endpoint_xfer_int(epwrite))
1231 usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), 1241 usb_fill_int_urb(snd->urb, usb_dev,
1232 NULL, acm->writesize, acm_write_bulk, snd); 1242 usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress),
1243 NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval);
1244 else
1245 usb_fill_bulk_urb(snd->urb, usb_dev,
1246 usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress),
1247 NULL, acm->writesize, acm_write_bulk, snd);
1233 snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 1248 snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1234 snd->instance = acm; 1249 snd->instance = acm;
1235 } 1250 }