All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: of: Check propname before applying "cs-gpios" quirks
@ 2019-03-26  6:32 Andrey Smirnov
  2019-03-26  6:32 ` [PATCH 2/2] gpio: of: Check for "spi-cs-high" in child instead of parent node Andrey Smirnov
  2019-03-28 16:08 ` [PATCH 1/2] gpio: of: Check propname before applying "cs-gpios" quirks Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Andrey Smirnov @ 2019-03-26  6:32 UTC (permalink / raw)
  To: linux-gpio
  Cc: Andrey Smirnov, Linus Walleij, Bartosz Golaszewski, Chris Healy,
	linux-kernel

SPI GPIO device has more than just "cs-gpio" property in its node and
would request those GPIOs as a part of its initialization. To avoid
applying CS-specific quirk to all of them add a check to make sure
that propname is "cs-gpios".

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpio/gpiolib-of.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 8b9c3ab70f6e..ee7f08386a72 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -120,7 +120,8 @@ static void of_gpio_flags_quirks(struct device_node *np,
 	 * to determine if the flags should have inverted semantics.
 	 */
 	if (IS_ENABLED(CONFIG_SPI_MASTER) &&
-	    of_property_read_bool(np, "cs-gpios")) {
+	    of_property_read_bool(np, "cs-gpios") &&
+	    !strcmp(propname, "cs-gpios")) {
 		struct device_node *child;
 		u32 cs;
 		int ret;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] gpio: of: Check for "spi-cs-high" in child instead of parent node
  2019-03-26  6:32 [PATCH 1/2] gpio: of: Check propname before applying "cs-gpios" quirks Andrey Smirnov
@ 2019-03-26  6:32 ` Andrey Smirnov
  2019-03-28 16:11   ` Linus Walleij
  2019-03-28 16:08 ` [PATCH 1/2] gpio: of: Check propname before applying "cs-gpios" quirks Linus Walleij
  1 sibling, 1 reply; 4+ messages in thread
From: Andrey Smirnov @ 2019-03-26  6:32 UTC (permalink / raw)
  To: linux-gpio
  Cc: Andrey Smirnov, Linus Walleij, Bartosz Golaszewski, Chris Healy,
	linux-kernel

"spi-cs-high" is going to be specified in child node of an SPI
controller's representing attached SPI device, so change the code to
look for it there, instead of checking parent node.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpio/gpiolib-of.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index ee7f08386a72..0220dd6d64ed 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -143,16 +143,16 @@ static void of_gpio_flags_quirks(struct device_node *np,
 				 * conflict and the "spi-cs-high" flag will
 				 * take precedence.
 				 */
-				if (of_property_read_bool(np, "spi-cs-high")) {
+				if (of_property_read_bool(child, "spi-cs-high")) {
 					if (*flags & OF_GPIO_ACTIVE_LOW) {
 						pr_warn("%s GPIO handle specifies active low - ignored\n",
-							of_node_full_name(np));
+							of_node_full_name(child));
 						*flags &= ~OF_GPIO_ACTIVE_LOW;
 					}
 				} else {
 					if (!(*flags & OF_GPIO_ACTIVE_LOW))
 						pr_info("%s enforce active low on chipselect handle\n",
-							of_node_full_name(np));
+							of_node_full_name(child));
 					*flags |= OF_GPIO_ACTIVE_LOW;
 				}
 				break;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] gpio: of: Check propname before applying "cs-gpios" quirks
  2019-03-26  6:32 [PATCH 1/2] gpio: of: Check propname before applying "cs-gpios" quirks Andrey Smirnov
  2019-03-26  6:32 ` [PATCH 2/2] gpio: of: Check for "spi-cs-high" in child instead of parent node Andrey Smirnov
@ 2019-03-28 16:08 ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-03-28 16:08 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: open list:GPIO SUBSYSTEM, Bartosz Golaszewski, Chris Healy, linux-kernel

On Tue, Mar 26, 2019 at 7:32 AM Andrey Smirnov <andrew.smirnov@gmail.com> wrote:

> SPI GPIO device has more than just "cs-gpio" property in its node and
> would request those GPIOs as a part of its initialization. To avoid
> applying CS-specific quirk to all of them add a check to make sure
> that propname is "cs-gpios".
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org

Patch applied for fixes.

Sorry for my mistakes...

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] gpio: of: Check for "spi-cs-high" in child instead of parent node
  2019-03-26  6:32 ` [PATCH 2/2] gpio: of: Check for "spi-cs-high" in child instead of parent node Andrey Smirnov
@ 2019-03-28 16:11   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-03-28 16:11 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: open list:GPIO SUBSYSTEM, Bartosz Golaszewski, Chris Healy, linux-kernel

On Tue, Mar 26, 2019 at 7:32 AM Andrey Smirnov <andrew.smirnov@gmail.com> wrote:

> "spi-cs-high" is going to be specified in child node of an SPI
> controller's representing attached SPI device, so change the code to
> look for it there, instead of checking parent node.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org

Patch applied for fixes.

I could bet I exercised these code paths just the other
week, but I don't know how it all ended up like this... :/

Thanks for fixing it up!!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-28 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26  6:32 [PATCH 1/2] gpio: of: Check propname before applying "cs-gpios" quirks Andrey Smirnov
2019-03-26  6:32 ` [PATCH 2/2] gpio: of: Check for "spi-cs-high" in child instead of parent node Andrey Smirnov
2019-03-28 16:11   ` Linus Walleij
2019-03-28 16:08 ` [PATCH 1/2] gpio: of: Check propname before applying "cs-gpios" quirks Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.