aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-05-22 12:26:31 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 15:04:12 -0700
commit83196b52053068f0240371ad2efd9d6ad685bbeb (patch)
tree61ce5b727519780633f1cc4cfaaebc7087a1f8d2 /drivers
parent212a4b4ed1ea9a969f3f967b3e3a8075ad1cb4de (diff)
downloadkernel_samsung_crespo-83196b52053068f0240371ad2efd9d6ad685bbeb.zip
kernel_samsung_crespo-83196b52053068f0240371ad2efd9d6ad685bbeb.tar.gz
kernel_samsung_crespo-83196b52053068f0240371ad2efd9d6ad685bbeb.tar.bz2
[PATCH] gadgetfs: fix AIO interface bugs
This patch (as691) fixes a few errors in the AIO interface for the gadgetfs driver. Now requests will complete properly instead of hanging. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/inode.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 0eb010a..57bf248 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -528,7 +528,7 @@ struct kiocb_priv {
struct usb_request *req;
struct ep_data *epdata;
void *buf;
- char __user *ubuf;
+ char __user *ubuf; /* NULL for writes */
unsigned actual;
};
@@ -566,7 +566,6 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
status = priv->actual;
kfree(priv->buf);
kfree(priv);
- aio_put_req(iocb);
return status;
}
@@ -580,8 +579,8 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)
spin_lock(&epdata->dev->lock);
priv->req = NULL;
priv->epdata = NULL;
- if (NULL == iocb->ki_retry
- || unlikely(0 == req->actual)
+ if (priv->ubuf == NULL
+ || unlikely(req->actual == 0)
|| unlikely(kiocbIsCancelled(iocb))) {
kfree(req->buf);
kfree(priv);
@@ -618,7 +617,7 @@ ep_aio_rwtail(
char __user *ubuf
)
{
- struct kiocb_priv *priv = (void *) &iocb->private;
+ struct kiocb_priv *priv;
struct usb_request *req;
ssize_t value;
@@ -670,7 +669,7 @@ fail:
kfree(priv);
put_ep(epdata);
} else
- value = -EIOCBQUEUED;
+ value = (ubuf ? -EIOCBRETRY : -EIOCBQUEUED);
return value;
}