Skip to content

Commit

Permalink
USB: cdc-acm: cleanup of data structures
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
oneukum authored and gregkh committed Sep 17, 2020
1 parent c56150c commit 3732903
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/class/cdc-acm.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
#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 {
Expand Down

0 comments on commit 3732903

Please sign in to comment.