Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: Emil Velikov <emil.l.velikov@gmail.com>,
	kernel@collabora.com, Philipp Zabel <p.zabel@pengutronix.de>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org,  linux-media@vger.kernel.org,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v3 6/9] media: hantro: add fallback handling for single irq/clk
Date: Wed, 31 Mar 2021 16:57:48 -0300	[thread overview]
Message-ID: <7ab16129c1f3cb701f3b5d5fc3cc66f9f42d6606.camel@collabora.com> (raw)
In-Reply-To: <20210331173520.184191-7-emil.l.velikov@gmail.com>

Hi Emil,

Thanks for the patch. Looking good!

A few comments below.

On Wed, 2021-03-31 at 18:35 +0100, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov@collabora.com>
> 
> Currently the driver expects that each irq/clk will have a name
> specified.
> 
> A valid point was raised by the DT maintainers - when there is a single
> interrupt line or clock - the names are not needed.
> 
> This is handled:
>  - clk - implicitly - ultimately we'll call of_clk_get_hw(..., 0, NULL
>    which will get the first clock from the pmc
>  - irq - explicitly - platform_get_irq(..., 0)
> 
> To gracefully handle potential bugs, add respective WARN_ON() if we're
> having more than one irq/clk, yet lacking the respective names.
> 
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Since this is a new patch, I'm unsure where was this Acked-by?

> Suggested-by: Ezequiel Garcia <ezequiel@collabora.com>
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
> v3
>  - New patch
> ---
>  drivers/staging/media/hantro/hantro_drv.c | 24 +++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> index e5f200e64993..d1294eb9cd07 100644
> --- a/drivers/staging/media/hantro/hantro_drv.c
> +++ b/drivers/staging/media/hantro/hantro_drv.c
> @@ -752,8 +752,16 @@ static int hantro_probe(struct platform_device *pdev)
>         if (!vpu->clocks)
>                 return -ENOMEM;
>  
> -       for (i = 0; i < vpu->variant->num_clocks; i++)
> +       for (i = 0; i < vpu->variant->num_clocks; i++) {
>                 vpu->clocks[i].id = vpu->variant->clk_names[i];
> +
> +               /*
> +                * Warn and refuse to load if the driver has multiple clocks,
> +                * yet they are lacking the respective names.
> +                */
> +               if (WARN_ON(!vpu->variant->clk_names[i] && 

We already have more WARN_ON than we should in this driver,
I would just remove this condition entirely.

> +                       return -ENXIO;
> +       }
>         ret = devm_clk_bulk_get(&pdev->dev, vpu->variant->num_clocks,
>                                 vpu->clocks);
>         if (ret)
> @@ -791,7 +799,19 @@ static int hantro_probe(struct platform_device *pdev)
>                 if (!vpu->variant->irqs[i].handler)
>                         continue;
>  
> -               irq = platform_get_irq_byname(vpu->pdev, irq_name);
> +               /*
> +                * If the driver has a single IRQ, chances are there will be no
> +                * actual name in the DT bindings.
> +                */
> +               if (!irq_name) {
> +                       if (WARN_ON(i))
> +                               return -ENXIO;
> +
> +                       irq_name = "default";
> +                       irq = platform_get_irq(vpu->pdev, 0);
> +               } else {
> +                       irq = platform_get_irq_byname(vpu->pdev, irq_name);
> +               }

How about this instead:

irq = platform_get_irq_byname(vpu->pdev, irq_name);
if (irq <= 0)
	irq = platform_get_irq(vpu->pdev, i);

(and leave the irq name in the sama5d4 code).

Thanks,
Ezequiel


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2021-03-31 19:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 17:35 [PATCH v3 0/9] Microchip SAMA5D4 VPU support et al Emil Velikov
2021-03-31 17:35 ` [PATCH v3 1/9] media: hantro: use G1_REG_INTERRUPT directly for the mpeg2 Emil Velikov
2021-03-31 17:35 ` [PATCH v3 2/9] media: hantro: imx: reuse MB_DIM define Emil Velikov
2021-03-31 17:35 ` [PATCH v3 3/9] media: hantro: imx: remove duplicate dec_base init Emil Velikov
2021-03-31 17:35 ` [PATCH v3 4/9] media: hantro: imx: remove unused include Emil Velikov
2021-03-31 17:35 ` [PATCH v3 5/9] media: hantro: introduce hantro_g1.c for common API Emil Velikov
2021-03-31 17:35 ` [PATCH v3 6/9] media: hantro: add fallback handling for single irq/clk Emil Velikov
2021-03-31 19:57   ` Ezequiel Garcia [this message]
2021-03-31 17:35 ` [PATCH v3 7/9] media: dt-bindings: Document SAMA5D4 VDEC bindings Emil Velikov
2021-03-31 18:48   ` [PATCH v3.5 " Emil Velikov
2021-03-31 18:53   ` [PATCH v3 " Emil Velikov
2021-03-31 17:35 ` [PATCH v3 8/9] media: hantro: add initial SAMA5D4 support Emil Velikov
2021-03-31 20:03   ` Ezequiel Garcia
2021-04-01 13:54     ` Emil Velikov
2021-03-31 17:35 ` [PATCH v3 9/9] ARM: dts: sama5d4: enable Hantro G1 VDEC Emil Velikov

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=7ab16129c1f3cb701f3b5d5fc3cc66f9f42d6606.camel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=kernel@collabora.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.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