[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfRhL1f-XD=PMbqd3BLeJQzQMFAupSzqAvx0g7-X_2VhQ@mail.gmail.com>
Date: Fri, 5 Jun 2020 15:00:48 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Michael Walle <michael@...le.cc>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-hwmon@...r.kernel.org, linux-pwm@...r.kernel.org,
linux-watchdog@...r.kernel.org,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Rob Herring <robh+dt@...nel.org>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Lee Jones <lee.jones@...aro.org>,
Thierry Reding <thierry.reding@...il.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Shawn Guo <shawnguo@...nel.org>, Li Yang <leoyang.li@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Jason Cooper <jason@...edaemon.net>,
Marc Zyngier <maz@...nel.org>, Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v4 06/11] gpio: add support for the sl28cpld GPIO controller
On Fri, Jun 5, 2020 at 12:14 AM Michael Walle <michael@...le.cc> wrote:
> Add support for the GPIO controller of the sl28 board management
> controller. This driver is part of a multi-function device.
>
> A controller has 8 lines. There are three different flavors:
> full-featured GPIO with interrupt support, input-only and output-only.
...
> +#include <linux/of_device.h>
I think also not needed.
But wait...
> + return devm_regmap_add_irq_chip_np(dev, dev_of_node(dev), regmap,
It seems regmap needs to be converted to use fwnode.
> + irq, IRQF_SHARED | IRQF_ONESHOT, 0,
> + irq_chip, &gpio->irq_data);
...
> + if (!pdev->dev.parent)
> + return -ENODEV;
Are we expecting to get shot into foot? I mean why we need this check?
> + dev_id = platform_get_device_id(pdev);
> + if (dev_id)
> + type = dev_id->driver_data;
Oh, no. In new code we don't need this. We have facilities to provide
platform data in a form of fwnode.
> + else
> + type = (uintptr_t)of_device_get_match_data(&pdev->dev);
So does this. device_get_match_data().
> + if (!type)
> + return -ENODEV;
...
> + if (irq_support &&
Why do you need this flag? Can't simple IRQ number be sufficient?
> + device_property_read_bool(&pdev->dev, "interrupt-controller")) {
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0)
> + return irq;
> +
> + ret = sl28cpld_gpio_irq_init(&pdev->dev, gpio, regmap,
> + base, irq);
> + if (ret)
> + return ret;
> +
> + config.irq_domain = regmap_irq_get_domain(gpio->irq_data);
> + }
...
> +static const struct of_device_id sl28cpld_gpio_of_match[] = {
> + { .compatible = "kontron,sl28cpld-gpio",
> + .data = (void *)SL28CPLD_GPIO },
> + { .compatible = "kontron,sl28cpld-gpi",
> + .data = (void *)SL28CPLD_GPI },
> + { .compatible = "kontron,sl28cpld-gpo",
> + .data = (void *)SL28CPLD_GPO },
All above can be twice less LOCs.
> + {},
No comma.
> +};
...
> + .name = KBUILD_MODNAME,
This actually not good idea in long term. File name can change and break an ABI.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists