LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Serge Semin <fancer.lancer@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Hoan Tran <hoan@os.amperecomputing.com>
Subject: Re: [PATCH v1 2/4] gpio: dwapb: Read GPIO base from gpio-base property
Date: Wed, 4 Aug 2021 15:44:33 +0300	[thread overview]
Message-ID: <20210804124433.crh7w6jzfjcswubo@mobilestation> (raw)
In-Reply-To: <CAHp75Vcz=vkaGObUcOOTZA51pHPoMc50RpPBLg4fgZgHdUStRA@mail.gmail.com>

@Linus, @Bartosz, @Rob, could you join the discussion regarding the
gpio-base property usage?

On Mon, Aug 02, 2021 at 06:52:28PM +0300, Andy Shevchenko wrote:
> On Mon, Aug 2, 2021 at 5:14 PM Serge Semin <fancer.lancer@gmail.com> wrote:
> > On Mon, Jul 26, 2021 at 03:54:34PM +0300, Andy Shevchenko wrote:
> > > For backward compatibility with some legacy devices introduce
> > > a new (*) property gpio-base to read GPIO base. This will allow
> > > further cleanup of the driver.
> 
> Thanks for the review! My answers below.
> 
> > > *) Note, it's not new for GPIO library since mockup driver is
> > >    using it already.
> >
> > You are right but I don't think it's a good idea to advertise the
> > pure Linux-internal property "gpio-base" to any use-case like OF
> > and ACPI FW nodes.
> 

> I don't want to advertise them, actually (that's why no bindings are
> modified). Perhaps introducing a paragraph in the GPIO documentation
> about this (and / or in GPIO generic bindings) that gpio-base property
> is solely for internal use and should't be used in actual DTs?

It might have been not that clear but by "advertising" I meant to have
the property generically handled in the driver, thus permitting it
being specified not only via the SW-nodes but also via the ACPI
and OF firmware. (Please see my next comment for more details.)

Regarding adding the gpio-base property documentation. I am pretty
sure it shouldn't be mentioned neither in the DW APB GPIO bindings,
nor in any other GPIO device DT-bindings because as you are right
saying it is the solely Linux kernel-specific parameter and isn't
supposed to be part of the device tree specification. On the other
hand if it gets to be frequently used then indeed we need to somehow
have it described and of course make sure it isn't used
inappropriately. Thus a possible option of documenting the property
would be just adding a new paragraph/file somewhere in
Documentation/driver-api/gpio/ since the property name implies that
it's going to be generic and permitted to be specified for all
GPIO-chips. Though it's for @Linus and @Bartosz to decide after all.

> 
> >  Especially seeing we don't have it described in the
> > DT-bindings and noting that the mockup driver is dedicated for the
> > GPIO tests only. What about restricting the property usage for the
> > SW-nodes only by adding an additional check: is_software_node() here?
> 

> I don't think we need this. But if you think it's better this way just
> to avoid usage of this property outside of internal properties, I'm
> fine to add. Perhaps we may issue a warning and continue? (see also
> above)

In my opinion it's very required and here is why. Adding the generic
gpio-base property support into the driver basically means saying:
"Hey, the driver supports it, so you can add it to your firmware."
Even if the property isn't described in the bindings, the platform
developers will be able to use it in new DTS-files since it's much
easier to add a property into a DT-file and make things working than
to convert the drivers/platforms/apps to using the GPIOd API. In case
if maintainers aren't that careful at review such dts may get slip
into the kernel, which in its turn will de facto make the property
being part of the DT specification and will need to be supported. That
is we must be very careful in what properties are permitted in the
driver. Thus, yes, I think we need to make sure here that the property
is only used in framework of the kernel and isn't passed via
inappropriate paths like DT/ACPI fw so not to get into the
maintainability troubles in future.

Issuing a warning but accepting the property isn't good alternative
due to the same reason. Why do we need to add the DT/ACPI property
support, which isn't supposed to be used like that instead of just
restricting the usecases beforehand? So I vote for parsing the
"gpio-base" property only if it's passed as a part of the SW-node.

-Sergey

> 
> > @Linus, @Bartosz, @Rob, what do you think about that?
> 
> -- 
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2021-08-04 12:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 12:54 [PATCH v1 1/4] gpio: dwapb: Unify ACPI enumeration checks in get_irq() and configure_irqs() Andy Shevchenko
2021-07-26 12:54 ` [PATCH v1 2/4] gpio: dwapb: Read GPIO base from gpio-base property Andy Shevchenko
2021-08-02 13:58   ` Serge Semin
2021-08-02 15:52     ` Andy Shevchenko
2021-08-04 12:44       ` Serge Semin [this message]
2021-08-04 14:43         ` Andy Shevchenko
2021-08-11 12:40           ` Linus Walleij
2021-08-11 12:47             ` Serge Semin
2021-08-11 12:37   ` Linus Walleij
2021-08-11 13:11     ` Andy Shevchenko
2021-07-26 12:54 ` [PATCH v1 3/4] mfd: intel_quark_i2c_gpio: Convert GPIO to use software nodes Andy Shevchenko
2021-08-11  8:38   ` Linus Walleij
2021-08-11 10:55     ` Andy Shevchenko
2021-08-16 13:05   ` Lee Jones
2021-08-16 13:18     ` Andy Shevchenko
2021-08-16 13:33       ` Lee Jones
2021-08-16 14:00         ` Andy Shevchenko
2021-08-16 14:19           ` Lee Jones
2021-08-16 14:53             ` Andy Shevchenko
2021-08-17  7:26               ` Lee Jones
2021-08-17 11:23                 ` Andy Shevchenko
2021-08-18  6:34                   ` Lee Jones
2021-08-18 11:04                     ` Andy Shevchenko
2021-09-21 15:25                   ` Lee Jones
2021-07-26 12:54 ` [PATCH v1 4/4] gpio: dwapb: Get rid of legacy platform data Andy Shevchenko
2021-08-02 14:07   ` Serge Semin
2021-08-02 15:54     ` Andy Shevchenko
2021-08-02  8:48 ` [PATCH v1 1/4] gpio: dwapb: Unify ACPI enumeration checks in get_irq() and configure_irqs() Lee Jones
2021-08-02 13:40 ` Serge Semin
2021-08-02 18:37   ` Andy Shevchenko

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=20210804124433.crh7w6jzfjcswubo@mobilestation \
    --to=fancer.lancer@gmail.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=hoan@os.amperecomputing.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH v1 2/4] gpio: dwapb: Read GPIO base from gpio-base property' \
    /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
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).