Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / usb / class / cdc-acm.c
index 387dc6c8ad25b0d43a7d954ce71d877618fcb63d..9b1cbcf8fb7fcfbd0f3b576d207a90dd4421c62f 100644 (file)
@@ -292,7 +292,6 @@ static void acm_ctrl_irq(struct urb *urb)
 {
        struct acm *acm = urb->context;
        struct usb_cdc_notification *dr = urb->transfer_buffer;
-       struct tty_struct *tty;
        unsigned char *data;
        int newctrl;
        int retval;
@@ -327,17 +326,12 @@ static void acm_ctrl_irq(struct urb *urb)
                break;
 
        case USB_CDC_NOTIFY_SERIAL_STATE:
-               tty = tty_port_tty_get(&acm->port);
                newctrl = get_unaligned_le16(data);
 
-               if (tty) {
-                       if (!acm->clocal &&
-                               (acm->ctrlin & ~newctrl & ACM_CTRL_DCD)) {
-                               dev_dbg(&acm->control->dev,
-                                       "%s - calling hangup\n", __func__);
-                               tty_hangup(tty);
-                       }
-                       tty_kref_put(tty);
+               if (!acm->clocal && (acm->ctrlin & ~newctrl & ACM_CTRL_DCD)) {
+                       dev_dbg(&acm->control->dev, "%s - calling hangup\n",
+                                       __func__);
+                       tty_port_tty_hangup(&acm->port, false);
                }
 
                acm->ctrlin = newctrl;
@@ -475,15 +469,10 @@ static void acm_write_bulk(struct urb *urb)
 static void acm_softint(struct work_struct *work)
 {
        struct acm *acm = container_of(work, struct acm, work);
-       struct tty_struct *tty;
 
        dev_vdbg(&acm->data->dev, "%s\n", __func__);
 
-       tty = tty_port_tty_get(&acm->port);
-       if (!tty)
-               return;
-       tty_wakeup(tty);
-       tty_kref_put(tty);
+       tty_port_tty_wakeup(&acm->port);
 }
 
 /*
@@ -839,14 +828,6 @@ static int acm_tty_ioctl(struct tty_struct *tty,
        return rv;
 }
 
-static const __u32 acm_tty_speed[] = {
-       0, 50, 75, 110, 134, 150, 200, 300, 600,
-       1200, 1800, 2400, 4800, 9600, 19200, 38400,
-       57600, 115200, 230400, 460800, 500000, 576000,
-       921600, 1000000, 1152000, 1500000, 2000000,
-       2500000, 3000000, 3500000, 4000000
-};
-
 static void acm_tty_set_termios(struct tty_struct *tty,
                                                struct ktermios *termios_old)
 {
@@ -981,6 +962,10 @@ static int acm_probe(struct usb_interface *intf,
 
        /* normal quirks */
        quirks = (unsigned long)id->driver_info;
+
+       if (quirks == IGNORE_DEVICE)
+               return -ENODEV;
+
        num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR;
 
        /* handle quirks deadly to normal probing*/
@@ -1519,15 +1504,9 @@ err_out:
 static int acm_reset_resume(struct usb_interface *intf)
 {
        struct acm *acm = usb_get_intfdata(intf);
-       struct tty_struct *tty;
 
-       if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags)) {
-               tty = tty_port_tty_get(&acm->port);
-               if (tty) {
-                       tty_hangup(tty);
-                       tty_kref_put(tty);
-               }
-       }
+       if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags))
+               tty_port_tty_hangup(&acm->port, false);
 
        return acm_resume(intf);
 }
@@ -1700,6 +1679,15 @@ static const struct usb_device_id acm_ids[] = {
        .driver_info = NO_DATA_INTERFACE,
        },
 
+#if IS_ENABLED(CONFIG_INPUT_IMS_PCU)
+       { USB_DEVICE(0x04d8, 0x0082),   /* Application mode */
+       .driver_info = IGNORE_DEVICE,
+       },
+       { USB_DEVICE(0x04d8, 0x0083),   /* Bootloader mode */
+       .driver_info = IGNORE_DEVICE,
+       },
+#endif
+
        /* control interfaces without any protocol set */
        { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
                USB_CDC_PROTO_NONE) },