Commit dab54c9f authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: cdc-acm: clean up rx_buflimit references

Clean up references to rx_buflimit.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6fb6b884
...@@ -606,16 +606,15 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) ...@@ -606,16 +606,15 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
static void acm_tty_unregister(struct acm *acm) static void acm_tty_unregister(struct acm *acm)
{ {
int i, nr; int i;
nr = acm->rx_buflimit;
tty_unregister_device(acm_tty_driver, acm->minor); tty_unregister_device(acm_tty_driver, acm->minor);
usb_put_intf(acm->control); usb_put_intf(acm->control);
acm_table[acm->minor] = NULL; acm_table[acm->minor] = NULL;
usb_free_urb(acm->ctrlurb); usb_free_urb(acm->ctrlurb);
for (i = 0; i < ACM_NW; i++) for (i = 0; i < ACM_NW; i++)
usb_free_urb(acm->wb[i].urb); usb_free_urb(acm->wb[i].urb);
for (i = 0; i < nr; i++) for (i = 0; i < acm->rx_buflimit; i++)
usb_free_urb(acm->ru[i].urb); usb_free_urb(acm->ru[i].urb);
kfree(acm->country_codes); kfree(acm->country_codes);
kfree(acm); kfree(acm);
...@@ -623,7 +622,8 @@ static void acm_tty_unregister(struct acm *acm) ...@@ -623,7 +622,8 @@ static void acm_tty_unregister(struct acm *acm)
static void acm_port_down(struct acm *acm) static void acm_port_down(struct acm *acm)
{ {
int i, nr = acm->rx_buflimit; int i;
mutex_lock(&open_mutex); mutex_lock(&open_mutex);
if (acm->dev) { if (acm->dev) {
usb_autopm_get_interface(acm->control); usb_autopm_get_interface(acm->control);
...@@ -632,7 +632,7 @@ static void acm_port_down(struct acm *acm) ...@@ -632,7 +632,7 @@ static void acm_port_down(struct acm *acm)
for (i = 0; i < ACM_NW; i++) for (i = 0; i < ACM_NW; i++)
usb_kill_urb(acm->wb[i].urb); usb_kill_urb(acm->wb[i].urb);
tasklet_disable(&acm->urb_task); tasklet_disable(&acm->urb_task);
for (i = 0; i < nr; i++) for (i = 0; i < acm->rx_buflimit; i++)
usb_kill_urb(acm->ru[i].urb); usb_kill_urb(acm->ru[i].urb);
tasklet_enable(&acm->urb_task); tasklet_enable(&acm->urb_task);
acm->control->needs_remote_wakeup = 0; acm->control->needs_remote_wakeup = 0;
...@@ -882,9 +882,9 @@ static void acm_write_buffers_free(struct acm *acm) ...@@ -882,9 +882,9 @@ static void acm_write_buffers_free(struct acm *acm)
static void acm_read_buffers_free(struct acm *acm) static void acm_read_buffers_free(struct acm *acm)
{ {
struct usb_device *usb_dev = interface_to_usbdev(acm->control); struct usb_device *usb_dev = interface_to_usbdev(acm->control);
int i, n = acm->rx_buflimit; int i;
for (i = 0; i < n; i++) for (i = 0; i < acm->rx_buflimit; i++)
usb_free_coherent(usb_dev, acm->readsize, usb_free_coherent(usb_dev, acm->readsize,
acm->rb[i].base, acm->rb[i].dma); acm->rb[i].base, acm->rb[i].dma);
} }
......
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