public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
	hverkuil@xs4all.nl, ribalda@chromium.org, tfiga@chromium.org,
	senozhatsky@google.com, hch@lst.de, kernel@collabora.com
Subject: Re: [PATCH 2/3] media: stk1160: move transfer_buffer and urb to same struct 'stk1160_urb'
Date: Tue, 11 Jan 2022 09:29:14 -0300	[thread overview]
Message-ID: <Yd14Gqq7Nmjhlihx@eze-laptop> (raw)
In-Reply-To: <20220111065505.6323-3-dafna.hirschfeld@collabora.com>

Hi Dafna,

On Tue, Jan 11, 2022 at 08:55:04AM +0200, Dafna Hirschfeld wrote:
> Instead of having two separated arrays, one for the urbs and
> one for their buffers, have one array of a struct containing both.
> In addition, the array is just 16 pointers, no need to dynamically
> allocate it.
> 
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
> ---
>  drivers/media/usb/stk1160/stk1160-v4l.c   |  2 +-
>  drivers/media/usb/stk1160/stk1160-video.c | 50 ++++++++---------------
>  drivers/media/usb/stk1160/stk1160.h       | 11 ++---
>  3 files changed, 23 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c
> index 6a4eb616d516..a06030451db4 100644
> --- a/drivers/media/usb/stk1160/stk1160-v4l.c
> +++ b/drivers/media/usb/stk1160/stk1160-v4l.c
> @@ -232,7 +232,7 @@ static int stk1160_start_streaming(struct stk1160 *dev)
>  
>  	/* submit urbs and enables IRQ */
>  	for (i = 0; i < dev->isoc_ctl.num_bufs; i++) {
> -		rc = usb_submit_urb(dev->isoc_ctl.urb[i], GFP_KERNEL);
> +		rc = usb_submit_urb(dev->isoc_ctl.stk1160_urb[i].urb, GFP_KERNEL);

The "stk1160_urb" field is a member of struct stk1160_isoc_ctl,
so it's not really needed to name it "stk1160_urb", you could just
name it "urb_ctl" or something like that.

I think the result should be saner:

		rc = usb_submit_urb(dev->isoc_ctl.urb_ctl[i].urb,
				    GFP_KERNEL);

Also, please make sure you run some regression tests with this patch alone
applied (without 3/3). It's easy to make a mistake on this kind of cleanups.

Thanks,
Ezequiel

  parent reply	other threads:[~2022-01-11 12:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  6:55 [PATCH 0/3] media: stk1160: allocate urb buffs with the DMA noncontiguous API Dafna Hirschfeld
2022-01-11  6:55 ` [PATCH 1/3] media: stk1160: fix number of buffers in case not all buffers are created Dafna Hirschfeld
2022-01-11 12:21   ` Ezequiel Garcia
2022-01-11  6:55 ` [PATCH 2/3] media: stk1160: move transfer_buffer and urb to same struct 'stk1160_urb' Dafna Hirschfeld
2022-01-11  8:10   ` Christoph Hellwig
2022-01-11 12:29   ` Ezequiel Garcia [this message]
2022-01-11  6:55 ` [PATCH 3/3] media: stk1160: use dma_alloc_noncontiguous API Dafna Hirschfeld
2022-01-11  8:13   ` Christoph Hellwig
2022-01-11  8:50     ` Dafna Hirschfeld
2022-01-11  8:52       ` Christoph Hellwig
2022-01-11  8:55         ` Dafna Hirschfeld
2022-01-11  8:59           ` Christoph Hellwig
2022-01-12  9:25             ` Sergey Senozhatsky
2022-01-11 12:38   ` Ezequiel Garcia
2022-01-24 14:43     ` Dafna Hirschfeld
2022-01-24 16:02       ` Dafna Hirschfeld

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=Yd14Gqq7Nmjhlihx@eze-laptop \
    --to=ezequiel@vanguardiasur.com.ar \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=hch@lst.de \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=ribalda@chromium.org \
    --cc=senozhatsky@google.com \
    --cc=tfiga@chromium.org \
    /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