From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] gpiolib: of: make Freescale SPI quirk similar to all others
Date: Wed, 7 Sep 2022 22:39:47 -0700 [thread overview]
Message-ID: <20220908053949.3564796-2-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20220908053949.3564796-1-dmitry.torokhov@gmail.com>
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@gmail.com>
---
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 c08564948bf9..30b89b694530 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -407,7 +407,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;
@@ -428,7 +428,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);
}
/*
@@ -527,12 +527,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.37.2.789.g6183377224-goog
next prev parent reply other threads:[~2022-09-08 5:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 5:39 [PATCH 1/4] gpiolib: of: do not ignore requested index when applying quirks Dmitry Torokhov
2022-09-08 5:39 ` Dmitry Torokhov [this message]
2022-09-08 12:43 ` [PATCH 2/4] gpiolib: of: make Freescale SPI quirk similar to all others Linus Walleij
2022-09-08 5:39 ` [PATCH 3/4] gpiolib: rework quirk handling in of_find_gpio() Dmitry Torokhov
2022-09-08 12:44 ` Linus Walleij
2022-09-16 11:03 ` Conor.Dooley
2022-09-16 11:20 ` Linus Walleij
2022-09-16 11:25 ` Conor.Dooley
2022-09-08 5:39 ` [PATCH 4/4] gpiolib: of: factor out conversion from OF flags Dmitry Torokhov
2022-09-08 12:45 ` Linus Walleij
2022-09-08 12:42 ` [PATCH 1/4] gpiolib: of: do not ignore requested index when applying quirks Linus Walleij
2022-09-15 8:37 ` Bartosz Golaszewski
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=20220908053949.3564796-2-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).