Commit 37329036 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

USB: cdc-acm: cleanup of data structures

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: default avatarOliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20200917110235.11854-1-oneukum@suse.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c56150c1
...@@ -173,7 +173,7 @@ static int acm_wb_alloc(struct acm *acm) ...@@ -173,7 +173,7 @@ static int acm_wb_alloc(struct acm *acm)
for (;;) { for (;;) {
wb = &acm->wb[wbn]; wb = &acm->wb[wbn];
if (!wb->use) { if (!wb->use) {
wb->use = 1; wb->use = true;
wb->len = 0; wb->len = 0;
return wbn; return wbn;
} }
...@@ -191,7 +191,8 @@ static int acm_wb_is_avail(struct acm *acm) ...@@ -191,7 +191,8 @@ static int acm_wb_is_avail(struct acm *acm)
n = ACM_NW; n = ACM_NW;
spin_lock_irqsave(&acm->write_lock, flags); spin_lock_irqsave(&acm->write_lock, flags);
for (i = 0; i < ACM_NW; i++) 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); spin_unlock_irqrestore(&acm->write_lock, flags);
return n; return n;
} }
...@@ -201,7 +202,7 @@ static int acm_wb_is_avail(struct acm *acm) ...@@ -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) static void acm_write_done(struct acm *acm, struct acm_wb *wb)
{ {
wb->use = 0; wb->use = false;
acm->transmitting--; acm->transmitting--;
usb_autopm_put_interface_async(acm->control); usb_autopm_put_interface_async(acm->control);
} }
...@@ -741,7 +742,7 @@ static void acm_port_shutdown(struct tty_port *port) ...@@ -741,7 +742,7 @@ static void acm_port_shutdown(struct tty_port *port)
if (!urb) if (!urb)
break; break;
wb = urb->context; wb = urb->context;
wb->use = 0; wb->use = false;
usb_autopm_put_interface_async(acm->control); usb_autopm_put_interface_async(acm->control);
} }
...@@ -792,7 +793,7 @@ static int acm_tty_write(struct tty_struct *tty, ...@@ -792,7 +793,7 @@ static int acm_tty_write(struct tty_struct *tty,
wb = &acm->wb[wbn]; wb = &acm->wb[wbn];
if (!acm->dev) { if (!acm->dev) {
wb->use = 0; wb->use = false;
spin_unlock_irqrestore(&acm->write_lock, flags); spin_unlock_irqrestore(&acm->write_lock, flags);
return -ENODEV; return -ENODEV;
} }
...@@ -804,7 +805,7 @@ static int acm_tty_write(struct tty_struct *tty, ...@@ -804,7 +805,7 @@ static int acm_tty_write(struct tty_struct *tty,
stat = usb_autopm_get_interface_async(acm->control); stat = usb_autopm_get_interface_async(acm->control);
if (stat) { if (stat) {
wb->use = 0; wb->use = false;
spin_unlock_irqrestore(&acm->write_lock, flags); spin_unlock_irqrestore(&acm->write_lock, flags);
return stat; return stat;
} }
......
...@@ -64,12 +64,12 @@ ...@@ -64,12 +64,12 @@
#define ACM_NR 16 #define ACM_NR 16
struct acm_wb { struct acm_wb {
unsigned char *buf; u8 *buf;
dma_addr_t dmah; dma_addr_t dmah;
int len; unsigned int len;
int use;
struct urb *urb; struct urb *urb;
struct acm *instance; struct acm *instance;
bool use;
}; };
struct acm_rb { struct acm_rb {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment