public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: remove res2 argument from gadget code completions
@ 2021-10-25 15:23 Jens Axboe
  2021-10-25 15:25 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2021-10-25 15:23 UTC (permalink / raw)
  To: linux-usb; +Cc: John Keeping, Greg Kroah-Hartman

The USB gadget code is the only code that every tried to utilize the
2nd argument of the aio completions, but there are strong suspicions
that it was never actually used by anything on the userspace side.

Out of the 3 cases that touch it, two of them just pass in the same
as res, and the last one passes in error/transfer in res like any
other normal use case.

Remove the 2nd argument, pass 0 like the rest of the in-kernel users
of kiocb based IO.

Link: https://lore.kernel.org/linux-block/20211021174021.273c82b1.john@metanate.com/
Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

Greg/John - if you guys are fine with this patch, let me know. I've got
the ->ki_complete() argument removal sitting on top of this.

diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 8260f38025b7..7bd22398d52f 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -831,7 +831,7 @@ static void ffs_user_copy_worker(struct work_struct *work)
 		kthread_unuse_mm(io_data->mm);
 	}
 
-	io_data->kiocb->ki_complete(io_data->kiocb, ret, ret);
+	io_data->kiocb->ki_complete(io_data->kiocb, ret, 0);
 
 	if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)
 		eventfd_signal(io_data->ffs->ffs_eventfd, 1);
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index 539220d7f5b6..28d3d4e71182 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -469,7 +469,7 @@ static void ep_user_copy_worker(struct work_struct *work)
 		ret = -EFAULT;
 
 	/* completing the iocb can drop the ctx and mm, don't touch mm after */
-	iocb->ki_complete(iocb, ret, ret);
+	iocb->ki_complete(iocb, ret, 0);
 
 	kfree(priv->buf);
 	kfree(priv->to_free);
@@ -496,11 +496,9 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)
 		kfree(priv->to_free);
 		kfree(priv);
 		iocb->private = NULL;
-		/* aio_complete() reports bytes-transferred _and_ faults */
-
 		iocb->ki_complete(iocb,
 				req->actual ? req->actual : (long)req->status,
-				req->status);
+				0);
 	} else {
 		/* ep_copy_to_user() won't report both; we hide some faults */
 		if (unlikely(0 != req->status))
-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: remove res2 argument from gadget code completions
  2021-10-25 15:23 [PATCH] usb: remove res2 argument from gadget code completions Jens Axboe
@ 2021-10-25 15:25 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-10-25 15:25 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-usb, John Keeping

On Mon, Oct 25, 2021 at 09:23:58AM -0600, Jens Axboe wrote:
> The USB gadget code is the only code that every tried to utilize the
> 2nd argument of the aio completions, but there are strong suspicions
> that it was never actually used by anything on the userspace side.
> 
> Out of the 3 cases that touch it, two of them just pass in the same
> as res, and the last one passes in error/transfer in res like any
> other normal use case.
> 
> Remove the 2nd argument, pass 0 like the rest of the in-kernel users
> of kiocb based IO.
> 
> Link: https://lore.kernel.org/linux-block/20211021174021.273c82b1.john@metanate.com/
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> 
> ---
> 
> Greg/John - if you guys are fine with this patch, let me know. I've got
> the ->ki_complete() argument removal sitting on top of this.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-25 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-25 15:23 [PATCH] usb: remove res2 argument from gadget code completions Jens Axboe
2021-10-25 15:25 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox