mbox series

[v5,0/6] gpiolib: switch to fwnode in the core

Message ID 20210308194535.66394-1-andriy.shevchenko@linux.intel.com
Headers show
Series gpiolib: switch to fwnode in the core | expand

Message

Andy Shevchenko March 8, 2021, 7:45 p.m. UTC
GPIO library uses of_node and fwnode in the core in non-unified way.
The series cleans this up and improves IRQ domain creation for non-OF cases
where currently the names of the domain are 'unknown'.

This has been tested on Intel Galileo Gen 2.

It touches GPIO core parts and it's expected that the series is routed via
GPIO tree.

In v5:
 - same as v4 + v3 (patches 1-4/5) in order to route via GPIO tree (Bart)

In v4:
 - based on Rafael's bleeding-edge
 - split the rest to two patches (Rafael)
 - elaborate WARN() deduplication in the commit message (Rafael)

In v3:
- fixed subtle bug in gpiod_count
- made irq_domain_add_simple() static inline (Marc)

In v2:
- added a new patch due to functionality in irq_comain_add_simple() (Linus)
- tagged patches 2-4 (Linus)
- Cc'ed to Rafael

Andy Shevchenko (6):
  irqdomain: Introduce irq_domain_create_simple() API
  gpiolib: Unify the checks on fwnode type
  gpiolib: Move of_node operations to gpiolib-of and correct fwnode use
  gpiolib: Introduce acpi_gpio_dev_init() and call it from core
  gpiolib: Reuse device's fwnode to create IRQ domain
  gpiolib: Fold conditionals into a simple ternary operator

 Documentation/core-api/irq/irq-domain.rst | 22 ++++----
 drivers/gpio/gpiolib-acpi.c               |  7 +++
 drivers/gpio/gpiolib-acpi.h               |  4 ++
 drivers/gpio/gpiolib-of.c                 |  6 ++-
 drivers/gpio/gpiolib.c                    | 61 +++++++++--------------
 include/linux/irqdomain.h                 | 19 +++++--
 kernel/irq/irqdomain.c                    | 20 ++++----
 7 files changed, 75 insertions(+), 64 deletions(-)

Comments

Andy Shevchenko March 8, 2021, 8:04 p.m. UTC | #1
On Mon, Mar 08, 2021 at 08:47:47PM +0100, Rafael J. Wysocki wrote:
> On Mon, Mar 8, 2021 at 8:45 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > It's quite spread code to initialize IRQ domain options.
> > Let's fold it into a simple oneliner.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Please see the comments I've just sent:
> 
> https://lore.kernel.org/linux-acpi/CAJZ5v0gpNzyBDKfBXoBYskUXs15GrZAe-E2vzhSEu2Nrj7wa7g@mail.gmail.com/T/#u

Yeah, I answered there, thanks!
Linus Walleij March 9, 2021, 4:34 p.m. UTC | #2
On Mon, Mar 8, 2021 at 8:45 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> When IRQ domain is created for an ACPI case, the name of it becomes unknown-%d

> since for now it utilizes of_node member only and doesn't consider fwnode case.

> Convert IRQ domain creation code to utilize fwnode instead.

>

> Before/After the change on Intel Galileo Gen 2 with two GPIO (IRQ) controllers:

>

>   unknown-1     ==>     \_SB.PCI0.GIP0.GPO

>   unknown-2     ==>     \_SB.NIO3

>

> Due to the nature of this change we may also deduplicate the WARN():s

> because in either case (DT or ACPI) the fwnode will be set correctly

> and %pfw is an equivalent to what the current code prints as a prefix.

>

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


Reviewed-by: Linus Walleij <linus.walleij@linaro.org>


Yours,
Linus Walleij