linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linuxarm <linuxarm@huawei.com>,
	 mauro.chehab@huawei.com,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH v13 1/9] staging: hi6421-spmi-pmic: rename GPIO IRQ OF node
Date: Fri, 16 Jul 2021 08:59:59 -0600	[thread overview]
Message-ID: <CAL_JsqLDysRNS0YLa2qet09Y3c9ytVkQVtVxxyjr6xdt3_mF0g@mail.gmail.com> (raw)
In-Reply-To: <20210716164529.35d3cb0c@coco.lan>

On Fri, Jul 16, 2021 at 8:45 AM Mauro Carvalho Chehab
<mchehab+huawei@kernel.org> wrote:
>
> Em Wed, 14 Jul 2021 07:36:43 -0600
> Rob Herring <robh@kernel.org> escreveu:
>
> > On Wed, Jul 14, 2021 at 3:13 AM Mauro Carvalho Chehab
> > <mchehab+huawei@kernel.org> wrote:
> > >
> > > Instead of using the standard name ("gpios"), use "interrupts".
> > >
> > > Suggested-by: Rob Herring <robh@kernel.org>
> > > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > > ---
> > >  drivers/staging/hikey9xx/hi6421-spmi-pmic.c              | 2 +-
> > >  drivers/staging/hikey9xx/hisilicon,hi6421-spmi-pmic.yaml | 4 ++--
> > >  2 files changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> > > index 35ef3d4c760b..9a7e095246f7 100644
> > > --- a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> > > +++ b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> > > @@ -233,7 +233,7 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
> > >
> > >         ddata->dev = dev;
> > >
> > > -       ddata->gpio = of_get_gpio(np, 0);
> > > +       ddata->gpio = of_get_named_gpio_flags(np, "interrupts", 0, NULL);
> >
> > It's an interrupt, you should be using platform_get_irq() and
> > devm_request_irq().
> >
> > In general, you should not be using of_get_* for any resources, but
> > use the firmware agnostic flavors.
>
> I've no idea how to convert to use platform_get_irq().
>
> I tried to replace the logic:
>
>         priv->gpio = of_get_gpio(np, 0);
>         if (priv->gpio < 0)
>                 return priv->gpio;
>
>         if (!gpio_is_valid(priv->gpio))
>                 return -EINVAL;
>
>         ret = devm_gpio_request_one(dev, priv->gpio, GPIOF_IN, "pmic");
>         if (ret < 0) {
>                 dev_err(dev, "Failed to request gpio%d\n", priv->gpio);
>                 return ret;
>         }
>
> Into:
>
>         priv->irq = platform_get_irq(pdev, 0);
>
> But it didn't work (I also tried the platform_get_irq_byname):
>
>         [    1.109586] hi6421v600-irq hi6421v600-irq: hi6421v600_irq_probe:
>         [    1.115676] hi6421v600-irq hi6421v600-irq: IRQ index 0 not found
>         [    1.121751] hi6421v600-irq hi6421v600-irq: Error -6 when getting IRQs
>
> The original DT schema as:
>
>         gpios = <&gpio28 0 0>;
>
> Based on your past review, this was replaced by:
>
>         interrupts = <&gpio28 0 0>;
>
>
> What am I missing?

'interrupts' doesn't take a phandle. You need:

interrupts = <0 0>;
interrupt-parent = <&gpio28>;

You should have been getting dtc warnings that this was wrong.

Rob

  reply	other threads:[~2021-07-16 15:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  9:12 [PATCH v13 0/9] Move Hisilicon 6421v600 SPMI and USB drivers out of staging Mauro Carvalho Chehab
2021-07-14  9:12 ` [PATCH v13 1/9] staging: hi6421-spmi-pmic: rename GPIO IRQ OF node Mauro Carvalho Chehab
2021-07-14 13:36   ` Rob Herring
2021-07-16 14:45     ` Mauro Carvalho Chehab
2021-07-16 14:59       ` Rob Herring [this message]
2021-07-14  9:12 ` [PATCH v13 2/9] staging: hi6421-spmi-pmic: add a missing dot at copyright Mauro Carvalho Chehab
2021-07-14  9:12 ` [PATCH v13 3/9] staging: hikey9xx: split hi6421v600 irq into a separate driver Mauro Carvalho Chehab
2021-07-14  9:12 ` [PATCH v13 4/9] staging: hi6421-spmi-pmic: cleanup drvdata Mauro Carvalho Chehab
2021-07-14  9:12 ` [PATCH v13 5/9] staging: hi6421-spmi-pmic: rename spmi_device struct Mauro Carvalho Chehab
2021-07-14  9:12 ` [PATCH v13 6/9] staging: hisilicon,hi6421-spmi-pmic.yaml: fix patternProperties Mauro Carvalho Chehab
2021-07-14  9:12 ` [PATCH v13 7/9] mfd: hi6421-spmi-pmic: move driver from staging Mauro Carvalho Chehab

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=CAL_JsqLDysRNS0YLa2qet09Y3c9ytVkQVtVxxyjr6xdt3_mF0g@mail.gmail.com \
    --to=robh@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linuxarm@huawei.com \
    --cc=mauro.chehab@huawei.com \
    --cc=mchehab+huawei@kernel.org \
    --subject='Re: [PATCH v13 1/9] staging: hi6421-spmi-pmic: rename GPIO IRQ OF node' \
    /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

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox