diff options
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) |