public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 3/6] media: rcar-vin: Generate a VIN group ID for Gen2
Date: Mon, 17 Mar 2025 15:53:09 +0100	[thread overview]
Message-ID: <20250317145309.GA919085@ragnatech.se> (raw)
In-Reply-To: <CAMuHMdVwnhVuhpawg_KVbe-h1ikoqXcy88M3JJy-nnS6dpH3kA@mail.gmail.com>

Hi Geert

Thanks for your comments.

On 2025-02-27 14:46:24 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Mon, 24 Feb 2025 at 19:40, Niklas Söderlund
> <niklas.soderlund+renesas@ragnatech.se> wrote:
> > Prepare to move Gen2 and earlier models to media controller by
> > generating a unique VIN group id for each VIN instance. On Gen3 and Gen4
> > it is important to have a specific id in the group as media graph routes
> > depend on this. On Gen2 and earlier models all that will matter is to
> > have a unique id in the range.
> >
> > Break out the id generation to a own function keeping the logic for Gen3
> > and Gen4 while generating a sequential id for Gen2 models.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> Thanks for your patch!
> 
> > --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c
> > +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
> > @@ -114,23 +114,41 @@ static void rvin_group_release(struct kref *kref)
> >         mutex_unlock(&rvin_group_lock);
> >  }
> >
> > +static int rvin_group_get_id(struct rvin_dev *vin)
> > +{
> > +       struct device_node *np;
> > +       unsigned int count;
> > +       u32 id;
> > +
> > +       switch (vin->info->model) {
> > +       case RCAR_GEN3:
> > +               if (!of_property_read_u32(vin->dev->of_node, "renesas,id", &id))
> > +                       return id;
> > +               break;
> 
> Please insert a blank line here.
> 
> > +       default:
> > +               count = 0;
> > +               for_each_matching_node(np, vin->dev->driver->of_match_table) {
> 
> This is a rather expensive operation.
> What about calling ida_alloc() instead?

That is a good idea, did not know about this. I opted to use 
ida_alloc_range() to make sure the ID is in supported range. Thanks for 
the tip.


> And probably moving the code to obtain the ID to rcar_vin_probe()?

Good idea!

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

-- 
Kind Regards,
Niklas Söderlund

  reply	other threads:[~2025-03-17 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 18:39 [PATCH 0/6] media: rcar-vin: Unify notifiers and enable MC on Gen2 Niklas Söderlund
2025-02-24 18:39 ` [PATCH 1/6] media: rcar-vin: Use correct count of remote subdevices Niklas Söderlund
2025-02-24 18:39 ` [PATCH 2/6] media: rcar-vin: Change link setup argument Niklas Söderlund
2025-02-24 18:39 ` [PATCH 3/6] media: rcar-vin: Generate a VIN group ID for Gen2 Niklas Söderlund
2025-02-27 13:46   ` Geert Uytterhoeven
2025-03-17 14:53     ` Niklas Söderlund [this message]
2025-02-24 18:39 ` [PATCH 4/6] media: rcar-vin: Prepare for unifying all v4l-async notifiers Niklas Söderlund
2025-02-24 18:39 ` [PATCH 5/6] media: rcar-vin: Merge all notifiers Niklas Söderlund
2025-02-24 18:39 ` [PATCH 6/6] media: rcar-vin: Enable media-graph on Gen2 Niklas Söderlund

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=20250317145309.GA919085@ragnatech.se \
    --to=niklas.soderlund+renesas@ragnatech.se \
    --cc=geert@linux-m68k.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen+renesas@ideasonboard.com \
    /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