]> git.baikalelectronics.ru Git - kernel.git/commitdiff
USB: cdc-acm: cleanup of data structures
authorOliver Neukum <oneukum@suse.com>
Thu, 17 Sep 2020 11:02:35 +0000 (13:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Sep 2020 16:52:44 +0000 (18:52 +0200)
Buffers should be u8*, not unsigned char*
Buffers have an unsigned length and using an int
as a boolean is a bit outdated.

No functional change intended.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20200917110235.11854-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-acm.c
drivers/usb/class/cdc-acm.h

index 7f6f3ab5b8a6770060cae81445aecd9e88d1cc48..f3803fa7c0077567a1399f5b56136639d651bd2f 100644 (file)
@@ -173,7 +173,7 @@ static int acm_wb_alloc(struct acm *acm)
        for (;;) {
                wb = &acm->wb[wbn];
                if (!wb->use) {
-                       wb->use = 1;
+                       wb->use = true;
                        wb->len = 0;
                        return wbn;
                }
@@ -191,7 +191,8 @@ static int acm_wb_is_avail(struct acm *acm)
        n = ACM_NW;
        spin_lock_irqsave(&acm->write_lock, flags);
        for (i = 0; i < ACM_NW; i++)
-               n -= acm->wb[i].use;
+               if(acm->wb[i].use)
+                       n--;
        spin_unlock_irqrestore(&acm->write_lock, flags);
        return n;
 }
@@ -201,7 +202,7 @@ static int acm_wb_is_avail(struct acm *acm)
  */
 static void acm_write_done(struct acm *acm, struct acm_wb *wb)
 {
-       wb->use = 0;
+       wb->use = false;
        acm->transmitting--;
        usb_autopm_put_interface_async(acm->control);
 }
@@ -741,7 +742,7 @@ static void acm_port_shutdown(struct tty_port *port)
                if (!urb)
                        break;
                wb = urb->context;
-               wb->use = 0;
+               wb->use = false;
                usb_autopm_put_interface_async(acm->control);
        }
 
@@ -792,7 +793,7 @@ static int acm_tty_write(struct tty_struct *tty,
        wb = &acm->wb[wbn];
 
        if (!acm->dev) {
-               wb->use = 0;
+               wb->use = false;
                spin_unlock_irqrestore(&acm->write_lock, flags);
                return -ENODEV;
        }
@@ -804,7 +805,7 @@ static int acm_tty_write(struct tty_struct *tty,
 
        stat = usb_autopm_get_interface_async(acm->control);
        if (stat) {
-               wb->use = 0;
+               wb->use = false;
                spin_unlock_irqrestore(&acm->write_lock, flags);
                return stat;
        }
index cd5e9d8ab237588bb2aa9cd615b9b1356b59e1cc..a50ea39110424259e2d06f128b2fc95cb550c4d4 100644 (file)
 #define ACM_NR  16
 
 struct acm_wb {
-       unsigned char *buf;
+       u8 *buf;
        dma_addr_t dmah;
-       int len;
-       int use;
+       unsigned int len;
        struct urb              *urb;
        struct acm              *instance;
+       bool use;
 };
 
 struct acm_rb {