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

[PATCH] USB: cleanup of usblp (release and poll)

this cleans up locking and freeing in usblp_release and
poll.
parent f3f7317f
......@@ -383,7 +383,7 @@ static void usblp_cleanup (struct usblp *usblp)
usb_buffer_free (usblp->dev, USBLP_BUF_SIZE,
usblp->writebuf, usblp->writeurb->transfer_dma);
usb_buffer_free (usblp->dev, USBLP_BUF_SIZE,
usblp->readbuf, usblp->writeurb->transfer_dma);
usblp->readbuf, usblp->readurb->transfer_dma);
kfree (usblp->device_id_string);
kfree (usblp->statusbuf);
usb_free_urb(usblp->writeurb);
......@@ -403,14 +403,12 @@ static int usblp_release(struct inode *inode, struct file *file)
struct usblp *usblp = file->private_data;
down (&usblp->sem);
lock_kernel();
usblp->used = 0;
if (usblp->present) {
usblp_unlink_urbs(usblp);
up(&usblp->sem);
} else /* finish cleanup from disconnect */
usblp_cleanup (usblp);
unlock_kernel();
return 0;
}
......@@ -419,8 +417,8 @@ static unsigned int usblp_poll(struct file *file, struct poll_table_struct *wait
{
struct usblp *usblp = file->private_data;
poll_wait(file, &usblp->wait, wait);
return ((!usblp->bidir || usblp->readurb->status == -EINPROGRESS) ? 0 : POLLIN | POLLRDNORM)
| (usblp->writeurb->status == -EINPROGRESS ? 0 : POLLOUT | POLLWRNORM);
return ((!usblp->bidir || !usblp->rcomplete) ? 0 : POLLIN | POLLRDNORM)
| (!usblp->wcomplete ? 0 : POLLOUT | POLLWRNORM);
}
static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
......
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