All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] media: davinci: vpif: Use platform_get_irq_optional() to get the interrupt
Date: Wed, 12 Jan 2022 13:32:37 +0200	[thread overview]
Message-ID: <CAHp75VdL_v3vZwQfCqNUwg3oQbvWpq4HCL2KGbaob88-4w9RNw@mail.gmail.com> (raw)
In-Reply-To: <20220111194014.5908-1-prabhakar.mahadev-lad.rj@bp.renesas.com>

On Tue, Jan 11, 2022 at 9:40 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
>
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypasses the hierarchical setup and messes up the
> irq chaining.
>
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq_optional().
>
> While at it, propagate error code in case devm_request_irq() fails
> instead of returning -EINVAL.

...

> +       while (1) {

The infinite loop use is discouraged.

> +               int irq;
> +
> +               err = platform_get_irq_optional(pdev, res_idx);
> +               if (err < 0 && err != -ENXIO)
> +                       goto vpif_unregister;
> +               if (err > 0)
> +                       irq = err;
> +               else
> +                       break;
> +
> +               err = devm_request_irq(&pdev->dev, irq, vpif_channel_isr,
> +                                      IRQF_SHARED, VPIF_DRIVER_NAME,
> +                                      (void *)(&vpif_obj.dev[res_idx]->channel_id));
> +               if (err)
>                         goto vpif_unregister;
> -               }
>                 res_idx++;
>         }

Slightly better

  do {
  ...
  } while (++res_idx);

...

> +       while (1) {

Ditto.

-- 
With Best Regards,
Andy Shevchenko

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 19:40 [PATCH v3] media: davinci: vpif: Use platform_get_irq_optional() to get the interrupt Lad Prabhakar
2022-01-12 11:32 ` Andy Shevchenko [this message]

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=CAHp75VdL_v3vZwQfCqNUwg3oQbvWpq4HCL2KGbaob88-4w9RNw@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.