[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220930151525.GC12989@alpha.franken.de>
Date: Fri, 30 Sep 2022 17:15:25 +0200
From: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC/PATCH v2] MIPS: pci: lantiq: switch to using gpiod API
On Mon, Sep 26, 2022 at 09:59:00PM -0700, Dmitry Torokhov wrote:
> This patch switches the driver from legacy gpio API to the newer
> gpiod API.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
> v2 - actually compiles.
I have some doubts...
> arch/mips/pci/pci-lantiq.c | 27 ++++++++++++---------------
> 1 file changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
> index 1ca42f482130..377b4a2577e1 100644
> --- a/arch/mips/pci/pci-lantiq.c
> +++ b/arch/mips/pci/pci-lantiq.c
> @@ -9,11 +9,11 @@
> #include <linux/kernel.h>
> #include <linux/init.h>
> #include <linux/delay.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/mm.h>
> #include <linux/vmalloc.h>
> #include <linux/clk.h>
> #include <linux/of_platform.h>
> -#include <linux/of_gpio.h>
> #include <linux/of_irq.h>
> #include <linux/of_pci.h>
>
> @@ -62,7 +62,7 @@
> __iomem void *ltq_pci_mapped_cfg;
> static __iomem void *ltq_pci_membase;
>
> -static int reset_gpio;
> +static gpio_desc *reset_gpio;
/local/tbogendoerfer/korg/linux/arch/mips/pci/pci-lantiq.c:65:8: error: unknown type name ‘gpio_desc’
static gpio_desc *reset_gpio;
> static struct clk *clk_pci, *clk_external;
> static struct resource pci_io_resource;
> static struct resource pci_mem_resource;
> @@ -123,17 +123,14 @@ static int ltq_pci_startup(struct platform_device *pdev)
> clk_disable(clk_external);
>
> /* setup reset gpio used by pci */
> - reset_gpio = of_get_named_gpio(node, "gpio-reset", 0);
> - if (gpio_is_valid(reset_gpio)) {
> - int ret = devm_gpio_request(&pdev->dev,
> - reset_gpio, "pci-reset");
> - if (ret) {
> - dev_err(&pdev->dev,
> - "failed to request gpio %d\n", reset_gpio);
> - return ret;
> - }
> - gpio_direction_output(reset_gpio, 1);
> + reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
> + GPIOD_OUT_LOW);
> + ret = PTR_ERR_OR_ZERO(reset_gpio);
/local/tbogendoerfer/korg/linux/arch/mips/pci/pci-lantiq.c:128:2: error: ‘ret’ undeclared (first use in this function)
ret = PTR_ERR_OR_ZERO(reset_gpio);
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
Powered by blists - more mailing lists