ChangeSet 1.1595.7.16, 2003/07/30 13:19:01-07:00, oliver@neukum.org [PATCH] USB: cleanup of usblp (release and poll) this cleans up locking and freeing in usblp_release and poll. drivers/usb/class/usblp.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff -Nru a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c --- a/drivers/usb/class/usblp.c Fri Aug 1 10:55:03 2003 +++ b/drivers/usb/class/usblp.c Fri Aug 1 10:55:03 2003 @@ -383,7 +383,7 @@ 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 @@ 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 @@ { 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) @@ -738,7 +736,7 @@ usblp->readurb->dev = usblp->dev; usblp->readcount = 0; if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) - dbg("error submitting urb"); + dbg("error submitting urb"); count = -EIO; goto done; }