[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221013002124.1894077-17-sashal@kernel.org>
Date: Wed, 12 Oct 2022 20:20:52 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Sasha Levin <sashal@...nel.org>, linux-gpio@...r.kernel.org
Subject: [PATCH AUTOSEL 5.15 17/47] gpiolib: of: make Freescale SPI quirk similar to all others
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
[ Upstream commit 984914ec4f4bfa9ee8f067b06293bc12bef20137 ]
There is no need for of_find_spi_cs_gpio() to be different from other
quirks: the only variant of property actually used in DTS is "gpios"
(plural) so we can use of_get_named_gpiod_flags() instead of recursing
into of_find_gpio() again.
This will allow us consolidate quirk handling down the road.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Signed-off-by: Bartosz Golaszewski <brgl@...ev.pl>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/gpio/gpiolib-of.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 2956df2605e5..fe34061d918b 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -404,7 +404,7 @@ static struct gpio_desc *of_find_spi_gpio(struct device *dev,
static struct gpio_desc *of_find_spi_cs_gpio(struct device *dev,
const char *con_id,
unsigned int idx,
- unsigned long *flags)
+ enum of_gpio_flags *of_flags)
{
const struct device_node *np = dev->of_node;
@@ -425,7 +425,7 @@ static struct gpio_desc *of_find_spi_cs_gpio(struct device *dev,
* uses just "gpios" so translate to that when "cs-gpios" is
* requested.
*/
- return of_find_gpio(dev, NULL, idx, flags);
+ return of_get_named_gpiod_flags(dev->of_node, "gpios", idx, of_flags);
}
/*
@@ -524,12 +524,8 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
desc = of_find_spi_gpio(dev, con_id, idx, &of_flags);
}
- if (gpiod_not_found(desc)) {
- /* This quirk looks up flags and all */
- desc = of_find_spi_cs_gpio(dev, con_id, idx, flags);
- if (!IS_ERR(desc))
- return desc;
- }
+ if (gpiod_not_found(desc))
+ desc = of_find_spi_cs_gpio(dev, con_id, idx, &of_flags);
if (gpiod_not_found(desc)) {
/* Special handling for regulator GPIOs if used */
--
2.35.1
Powered by blists - more mailing lists