public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@gentoo.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Conor Dooley <conor@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Yangyu Chen <cyy@cyyself.name>,
	Jisheng Zhang <jszhang@kernel.org>,
	Jesse Taube <mr.bossman075@gmail.com>,
	Inochi Amaoto <inochiama@outlook.com>,
	Icenowy Zheng <uwu@icenowy.me>,
	Meng Zhang <zhangmeng.kevin@linux.spacemit.com>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	spacemit@lists.linux.dev
Subject: Re: [PATCH v5 1/5] gpio: of: support to add custom add pin range function
Date: Sat, 22 Feb 2025 13:23:01 +0000	[thread overview]
Message-ID: <20250222132301-GYA37325@gentoo> (raw)
In-Reply-To: <CAMRc=MdGBTXRSAgY2vjOrqVVRzOyYh7N8yZsjK+W4cYFCQAwhQ@mail.gmail.com>

Hi Bartosz Golaszewski:

On 11:22 Thu 20 Feb     , Bartosz Golaszewski wrote:
> On Mon, Feb 17, 2025 at 1:58 PM Yixun Lan <dlan@gentoo.org> wrote:
> >
> > Export custom function to add gpio pin range from pinctrl
> > subsystem. This would make it possible to add pins to multi
> > gpio chips.
> >
> > Signed-off-by: Yixun Lan <dlan@gentoo.org>
> > ---
> >  drivers/gpio/gpiolib-of.c   | 5 ++++-
> >  include/linux/gpio/driver.h | 7 +++++++
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> > index 2e537ee979f3e2b6e8d5f86f3e121a66f2a8e083..64c8a153b823d65faebed9c4cd87952359b42765 100644
> > --- a/drivers/gpio/gpiolib-of.c
> > +++ b/drivers/gpio/gpiolib-of.c
> > @@ -1170,7 +1170,10 @@ int of_gpiochip_add(struct gpio_chip *chip)
> >         if (chip->of_gpio_n_cells > MAX_PHANDLE_ARGS)
> >                 return -EINVAL;
> >
> > -       ret = of_gpiochip_add_pin_range(chip);
> > +       if (!chip->of_add_pin_range)
> > +               chip->of_add_pin_range = of_gpiochip_add_pin_range;
> > +
> > +       ret = chip->of_add_pin_range(chip);
> >         if (ret)
> >                 return ret;
> >
> > diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
> > index 2dd7cb9cc270a68ddedbcdd5d44e0d0f88dfa785..a7b966c78a2f62075fb7804f6e96028564dda161 100644
> > --- a/include/linux/gpio/driver.h
> > +++ b/include/linux/gpio/driver.h
> > @@ -528,6 +528,13 @@ struct gpio_chip {
> >          */
> >         int (*of_xlate)(struct gpio_chip *gc,
> >                         const struct of_phandle_args *gpiospec, u32 *flags);
> > +
> > +       /**
> > +        * @of_add_pin_range:
> > +        *
> > +        * Callback to add pin ranges from pinctrl
> > +        */
> 
> Please, make the API contract more specific: describe the return value
> and check it in the call place if it can return errors.
> 
> Also: is this even OF-specific if it doesn't take any OF argument? Why
> not just add_pin_range()?
> 
now, this patch is obsolete, please ignore
it will be replaced by the one sent by LinusW
https://lore.kernel.org/all/20250218-gpio-ranges-fourcell-v1-0-b1f3db6c8036@linaro.org/

> Bart
> 
> 
> > +       int (*of_add_pin_range)(struct gpio_chip *chip);
> >  #endif /* CONFIG_OF_GPIO */
> >  };
> >
> >
> > --
> > 2.48.1
> >
> 

-- 
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55

  reply	other threads:[~2025-02-22 13:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 12:57 [PATCH v5 0/5] riscv: spacemit: add gpio support for K1 SoC Yixun Lan
2025-02-17 12:57 ` [PATCH v5 1/5] gpio: of: support to add custom add pin range function Yixun Lan
2025-02-20 10:22   ` Bartosz Golaszewski
2025-02-22 13:23     ` Yixun Lan [this message]
2025-02-17 12:57 ` [PATCH v5 2/5] dt-bindings: gpio: spacemit: add support for K1 SoC Yixun Lan
2025-02-18 13:09   ` Linus Walleij
2025-02-17 12:57 ` [PATCH v5 3/5] " Yixun Lan
2025-02-20 13:34   ` Bartosz Golaszewski
2025-02-20 23:35     ` Chen Wang
2025-02-21  8:37       ` Bartosz Golaszewski
2025-02-21 12:21         ` Yixun Lan
2025-02-21 12:33           ` Bartosz Golaszewski
2025-02-21 17:27   ` Alex Elder
2025-02-23  3:09     ` Yixun Lan
2025-02-17 12:57 ` [PATCH v5 4/5] riscv: dts: spacemit: add gpio " Yixun Lan
2025-02-17 12:57 ` [PATCH v5 5/5] riscv: dts: spacemit: add gpio LED for system heartbeat Yixun Lan

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=20250222132301-GYA37325@gentoo \
    --to=dlan@gentoo.org \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=cyy@cyyself.name \
    --cc=devicetree@vger.kernel.org \
    --cc=inochiama@outlook.com \
    --cc=jszhang@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mr.bossman075@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=uwu@icenowy.me \
    --cc=zhangmeng.kevin@linux.spacemit.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