linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Jan Kundrát" <jan.kundrat@cesnet.cz>,
	"Phil Reid" <preid@electromag.com.au>,
	"Lars Poeschel" <poeschel@lemonage.de>,
	"Jason Kridner" <jkridner@gmail.com>
Subject: Re: [PATCH] pinctrl: mcp23s08: Use irqchip template
Date: Tue, 21 Jul 2020 17:02:50 +0300	[thread overview]
Message-ID: <CAHp75VfNcKfa6x43bq7E7QQLiPfNkqwbzZBaa816NbC-SYsjjg@mail.gmail.com> (raw)
In-Reply-To: <20200721125223.344411-1-linus.walleij@linaro.org>

On Tue, Jul 21, 2020 at 3:53 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> This makes the driver use the irqchip template to assign
> properties to the gpio_irq_chip instead of using the
> explicit calls to gpiochip_irqchip_add_nested() and
> gpiochip_set_nested_irqchip(). The irqchip is instead
> added while adding the gpiochip.

For the code
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
I can't test right now, though.

> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Jan Kundrát <jan.kundrat@cesnet.cz>
> Cc: Phil Reid <preid@electromag.com.au>
> Cc: Lars Poeschel <poeschel@lemonage.de>
> Cc: Jason Kridner <jkridner@gmail.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/pinctrl/pinctrl-mcp23s08.c | 44 ++++++++++--------------------
>  1 file changed, 14 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
> index 151931b593f6..42b12ea14d6b 100644
> --- a/drivers/pinctrl/pinctrl-mcp23s08.c
> +++ b/drivers/pinctrl/pinctrl-mcp23s08.c
> @@ -522,29 +522,6 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp)
>         return 0;
>  }
>
> -static int mcp23s08_irqchip_setup(struct mcp23s08 *mcp)
> -{
> -       struct gpio_chip *chip = &mcp->chip;
> -       int err;
> -
> -       err =  gpiochip_irqchip_add_nested(chip,
> -                                          &mcp->irq_chip,
> -                                          0,
> -                                          handle_simple_irq,
> -                                          IRQ_TYPE_NONE);
> -       if (err) {
> -               dev_err(chip->parent,
> -                       "could not connect irqchip to gpiochip: %d\n", err);
> -               return err;
> -       }
> -
> -       gpiochip_set_nested_irqchip(chip,
> -                                   &mcp->irq_chip,
> -                                   mcp->irq);
> -
> -       return 0;
> -}
> -
>  /*----------------------------------------------------------------------*/
>
>  int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
> @@ -589,10 +566,6 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
>         if (ret < 0)
>                 goto fail;
>
> -       ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
> -       if (ret < 0)
> -               goto fail;
> -
>         mcp->irq_controller =
>                 device_property_read_bool(dev, "interrupt-controller");
>         if (mcp->irq && mcp->irq_controller) {
> @@ -629,11 +602,22 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
>         }
>
>         if (mcp->irq && mcp->irq_controller) {
> -               ret = mcp23s08_irqchip_setup(mcp);
> -               if (ret)
> -                       goto fail;
> +               struct gpio_irq_chip *girq = &mcp->chip.irq;
> +
> +               girq->chip = &mcp->irq_chip;
> +               /* This will let us handle the parent IRQ in the driver */
> +               girq->parent_handler = NULL;
> +               girq->num_parents = 0;
> +               girq->parents = NULL;
> +               girq->default_type = IRQ_TYPE_NONE;
> +               girq->handler = handle_simple_irq;
> +               girq->threaded = true;
>         }
>
> +       ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
> +       if (ret < 0)
> +               goto fail;
> +
>         mcp->pinctrl_desc.pctlops = &mcp_pinctrl_ops;
>         mcp->pinctrl_desc.confops = &mcp_pinconf_ops;
>         mcp->pinctrl_desc.npins = mcp->chip.ngpio;
> --
> 2.26.2
>


-- 
With Best Regards,
Andy Shevchenko

      reply	other threads:[~2020-07-21 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 12:52 [PATCH] pinctrl: mcp23s08: Use irqchip template Linus Walleij
2020-07-21 14:02 ` 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=CAHp75VfNcKfa6x43bq7E7QQLiPfNkqwbzZBaa816NbC-SYsjjg@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jan.kundrat@cesnet.cz \
    --cc=jkridner@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=poeschel@lemonage.de \
    --cc=preid@electromag.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).