From: paul.elder@ideasonboard.com
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: linux-usb@vger.kernel.org, balbi@kernel.org,
laurent.pinchart@ideasonboard.com, kernel@pengutronix.de,
nicolas@ndufresne.ca, kieran.bingham@ideasonboard.com
Subject: Re: [PATCH 1/2] usb: gadget: uvc: clean and rename uvcg_queue_next_buffer to uvcg_complete_buffer
Date: Fri, 11 Mar 2022 16:04:44 +0900 [thread overview]
Message-ID: <20220311070444.GC1046627@pyrite.rasen.tech> (raw)
In-Reply-To: <20220228141659.775302-1-m.grzeschik@pengutronix.de>
Hi Michael,
Thanks for the patch.
On Mon, Feb 28, 2022 at 03:16:58PM +0100, Michael Grzeschik wrote:
> The functions purpose is different to its name. We change the function
> name and remove all unused code.
>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
> drivers/usb/gadget/function/uvc_queue.c | 18 +-----------------
> drivers/usb/gadget/function/uvc_queue.h | 2 +-
> drivers/usb/gadget/function/uvc_video.c | 6 +++---
> 3 files changed, 5 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c
> index d852ac9e47e72c..73ff56043d2e6a 100644
> --- a/drivers/usb/gadget/function/uvc_queue.c
> +++ b/drivers/usb/gadget/function/uvc_queue.c
> @@ -326,24 +326,10 @@ int uvcg_queue_enable(struct uvc_video_queue *queue, int enable)
> }
>
> /* called with &queue_irqlock held.. */
> -struct uvc_buffer *uvcg_queue_next_buffer(struct uvc_video_queue *queue,
> +void uvcg_complete_buffer(struct uvc_video_queue *queue,
> struct uvc_buffer *buf)
> {
> - struct uvc_buffer *nextbuf;
> -
> - if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
> - buf->length != buf->bytesused) {
> - buf->state = UVC_BUF_STATE_QUEUED;
> - vb2_set_plane_payload(&buf->buf.vb2_buf, 0, 0);
> - return buf;
> - }
> -
> list_del(&buf->queue);
> - if (!list_empty(&queue->irqqueue))
> - nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
> - queue);
> - else
> - nextbuf = NULL;
Is it fine to drop these? They look important to me. If they're not,
then the reason should be explained in the commit message.
>
> buf->buf.field = V4L2_FIELD_NONE;
> buf->buf.sequence = queue->sequence++;
> @@ -351,8 +337,6 @@ struct uvc_buffer *uvcg_queue_next_buffer(struct uvc_video_queue *queue,
>
> vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused);
> vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_DONE);
> -
> - return nextbuf;
This looks fine since all callers ignore it anyway.
Paul
> }
>
> struct uvc_buffer *uvcg_queue_head(struct uvc_video_queue *queue)
> diff --git a/drivers/usb/gadget/function/uvc_queue.h b/drivers/usb/gadget/function/uvc_queue.h
> index 05360a0767f61f..b668927b5d2c4e 100644
> --- a/drivers/usb/gadget/function/uvc_queue.h
> +++ b/drivers/usb/gadget/function/uvc_queue.h
> @@ -93,7 +93,7 @@ void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect);
>
> int uvcg_queue_enable(struct uvc_video_queue *queue, int enable);
>
> -struct uvc_buffer *uvcg_queue_next_buffer(struct uvc_video_queue *queue,
> +void uvcg_complete_buffer(struct uvc_video_queue *queue,
> struct uvc_buffer *buf);
>
> struct uvc_buffer *uvcg_queue_head(struct uvc_video_queue *queue);
> diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
> index 7f59a0c4740209..0c8d146b840321 100644
> --- a/drivers/usb/gadget/function/uvc_video.c
> +++ b/drivers/usb/gadget/function/uvc_video.c
> @@ -112,7 +112,7 @@ uvc_video_encode_bulk(struct usb_request *req, struct uvc_video *video,
> if (buf->bytesused == video->queue.buf_used) {
> video->queue.buf_used = 0;
> buf->state = UVC_BUF_STATE_DONE;
> - uvcg_queue_next_buffer(&video->queue, buf);
> + uvcg_complete_buffer(&video->queue, buf);
> video->fid ^= UVC_STREAM_FID;
>
> video->payload_size = 0;
> @@ -183,7 +183,7 @@ uvc_video_encode_isoc_sg(struct usb_request *req, struct uvc_video *video,
> video->queue.buf_used = 0;
> buf->state = UVC_BUF_STATE_DONE;
> buf->offset = 0;
> - uvcg_queue_next_buffer(&video->queue, buf);
> + uvcg_complete_buffer(&video->queue, buf);
> video->fid ^= UVC_STREAM_FID;
> }
> }
> @@ -210,7 +210,7 @@ uvc_video_encode_isoc(struct usb_request *req, struct uvc_video *video,
> if (buf->bytesused == video->queue.buf_used) {
> video->queue.buf_used = 0;
> buf->state = UVC_BUF_STATE_DONE;
> - uvcg_queue_next_buffer(&video->queue, buf);
> + uvcg_complete_buffer(&video->queue, buf);
> video->fid ^= UVC_STREAM_FID;
> }
> }
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-03-11 7:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 14:16 [PATCH 1/2] usb: gadget: uvc: clean and rename uvcg_queue_next_buffer to uvcg_complete_buffer Michael Grzeschik
2022-02-28 14:16 ` [PATCH 2/2] usb: gadget: uvc: giveback vb2 buffer on req complete Michael Grzeschik
2022-03-11 7:04 ` paul.elder [this message]
2022-03-11 18:37 ` [PATCH 1/2] usb: gadget: uvc: clean and rename uvcg_queue_next_buffer to uvcg_complete_buffer Michael Grzeschik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220311070444.GC1046627@pyrite.rasen.tech \
--to=paul.elder@ideasonboard.com \
--cc=balbi@kernel.org \
--cc=kernel@pengutronix.de \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-usb@vger.kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=nicolas@ndufresne.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox