diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-30 14:33:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-30 14:33:34 -0400 |
commit | 3af9a5256f448e3d0405f7905c430ef2f9f32b9c (patch) | |
tree | 947da1e128e28c3b0b7134a8d08f3a6bb8534fc0 /drivers/gpio/gpiolib-of.c | |
parent | 32faca66bd3f6aa7ec4212d20c7b2d45657fab10 (diff) | |
parent | 86d0756558b701b2c5502d90f705c2936008922d (diff) |
Merge tag 'gpio-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij:
"As you can see [in the git history] I was away on leave and Bartosz
kindly stepped in and collected a slew of fixes, I pulled them into my
tree in two sets and merged some two more fixes (fixing my own caused
bugs) on top.
Summary:
- Revert the extended use of gpio_set_config() and think about how we
can do this properly.
- Fix up the SPI CS GPIO handling so it now works properly on the SPI
bus children, as intended.
- Error paths and driver fixes"
* tag 'gpio-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
gpio: mockup: use simple_read_from_buffer() in debugfs read callback
gpio: of: Fix of_gpiochip_add() error path
gpio: of: Check for "spi-cs-high" in child instead of parent node
gpio: of: Check propname before applying "cs-gpios" quirks
gpio: mockup: fix debugfs read
Revert "gpio: use new gpio_set_config() helper in more places"
gpio: aspeed: fix a potential NULL pointer dereference
gpio: amd-fch: Fix bogus SPDX identifier
gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input
gpio: exar: add a check for the return value of ida_simple_get fails
Diffstat (limited to 'drivers/gpio/gpiolib-of.c')
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 8b9c3ab70f6e..6a3ec575a404 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, | |||
120 | * to determine if the flags should have inverted semantics. | 120 | * to determine if the flags should have inverted semantics. |
121 | */ | 121 | */ |
122 | if (IS_ENABLED(CONFIG_SPI_MASTER) && | 122 | if (IS_ENABLED(CONFIG_SPI_MASTER) && |
123 | of_property_read_bool(np, "cs-gpios")) { | 123 | of_property_read_bool(np, "cs-gpios") && |
124 | !strcmp(propname, "cs-gpios")) { | ||
124 | struct device_node *child; | 125 | struct device_node *child; |
125 | u32 cs; | 126 | u32 cs; |
126 | int ret; | 127 | int ret; |
@@ -142,16 +143,16 @@ static void of_gpio_flags_quirks(struct device_node *np, | |||
142 | * conflict and the "spi-cs-high" flag will | 143 | * conflict and the "spi-cs-high" flag will |
143 | * take precedence. | 144 | * take precedence. |
144 | */ | 145 | */ |
145 | if (of_property_read_bool(np, "spi-cs-high")) { | 146 | if (of_property_read_bool(child, "spi-cs-high")) { |
146 | if (*flags & OF_GPIO_ACTIVE_LOW) { | 147 | if (*flags & OF_GPIO_ACTIVE_LOW) { |
147 | pr_warn("%s GPIO handle specifies active low - ignored\n", | 148 | pr_warn("%s GPIO handle specifies active low - ignored\n", |
148 | of_node_full_name(np)); | 149 | of_node_full_name(child)); |
149 | *flags &= ~OF_GPIO_ACTIVE_LOW; | 150 | *flags &= ~OF_GPIO_ACTIVE_LOW; |
150 | } | 151 | } |
151 | } else { | 152 | } else { |
152 | if (!(*flags & OF_GPIO_ACTIVE_LOW)) | 153 | if (!(*flags & OF_GPIO_ACTIVE_LOW)) |
153 | pr_info("%s enforce active low on chipselect handle\n", | 154 | pr_info("%s enforce active low on chipselect handle\n", |
154 | of_node_full_name(np)); | 155 | of_node_full_name(child)); |
155 | *flags |= OF_GPIO_ACTIVE_LOW; | 156 | *flags |= OF_GPIO_ACTIVE_LOW; |
156 | } | 157 | } |
157 | break; | 158 | break; |
@@ -717,7 +718,13 @@ int of_gpiochip_add(struct gpio_chip *chip) | |||
717 | 718 | ||
718 | of_node_get(chip->of_node); | 719 | of_node_get(chip->of_node); |
719 | 720 | ||
720 | return of_gpiochip_scan_gpios(chip); | 721 | status = of_gpiochip_scan_gpios(chip); |
722 | if (status) { | ||
723 | of_node_put(chip->of_node); | ||
724 | gpiochip_remove_pin_ranges(chip); | ||
725 | } | ||
726 | |||
727 | return status; | ||
721 | } | 728 | } |
722 | 729 | ||
723 | void of_gpiochip_remove(struct gpio_chip *chip) | 730 | void of_gpiochip_remove(struct gpio_chip *chip) |