aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/gpio-adnp.c6
-rw-r--r--drivers/gpio/gpio-aspeed.c2
-rw-r--r--drivers/gpio/gpio-exar.c2
-rw-r--r--drivers/gpio/gpio-mockup.c10
-rw-r--r--drivers/gpio/gpiolib-of.c17
-rw-r--r--drivers/gpio/gpiolib.c4
-rw-r--r--include/linux/platform_data/gpio/gpio-amd-fch.h2
7 files changed, 26 insertions, 17 deletions
diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c
index 91b90c0cea73..12acdac85820 100644
--- a/drivers/gpio/gpio-adnp.c
+++ b/drivers/gpio/gpio-adnp.c
@@ -132,8 +132,10 @@ static int adnp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
132 if (err < 0) 132 if (err < 0)
133 goto out; 133 goto out;
134 134
135 if (err & BIT(pos)) 135 if (value & BIT(pos)) {
136 err = -EACCES; 136 err = -EPERM;
137 goto out;
138 }
137 139
138 err = 0; 140 err = 0;
139 141
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 854bce4fb9e7..217507002dbc 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
1224 1224
1225 gpio->offset_timer = 1225 gpio->offset_timer =
1226 devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); 1226 devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL);
1227 if (!gpio->offset_timer)
1228 return -ENOMEM;
1227 1229
1228 return aspeed_gpio_setup_irqs(gpio, pdev); 1230 return aspeed_gpio_setup_irqs(gpio, pdev);
1229} 1231}
diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c
index 0ecd2369c2ca..a09d2f9ebacc 100644
--- a/drivers/gpio/gpio-exar.c
+++ b/drivers/gpio/gpio-exar.c
@@ -148,6 +148,8 @@ static int gpio_exar_probe(struct platform_device *pdev)
148 mutex_init(&exar_gpio->lock); 148 mutex_init(&exar_gpio->lock);
149 149
150 index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL); 150 index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
151 if (index < 0)
152 goto err_destroy;
151 153
152 sprintf(exar_gpio->name, "exar_gpio%d", index); 154 sprintf(exar_gpio->name, "exar_gpio%d", index);
153 exar_gpio->gpio_chip.label = exar_gpio->name; 155 exar_gpio->gpio_chip.label = exar_gpio->name;
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index 154d959e8993..b6a4efce7c92 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -204,8 +204,8 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
204 struct gpio_mockup_chip *chip; 204 struct gpio_mockup_chip *chip;
205 struct seq_file *sfile; 205 struct seq_file *sfile;
206 struct gpio_chip *gc; 206 struct gpio_chip *gc;
207 int val, cnt;
207 char buf[3]; 208 char buf[3];
208 int val, rv;
209 209
210 if (*ppos != 0) 210 if (*ppos != 0)
211 return 0; 211 return 0;
@@ -216,13 +216,9 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
216 gc = &chip->gc; 216 gc = &chip->gc;
217 217
218 val = gpio_mockup_get(gc, priv->offset); 218 val = gpio_mockup_get(gc, priv->offset);
219 snprintf(buf, sizeof(buf), "%d\n", val); 219 cnt = snprintf(buf, sizeof(buf), "%d\n", val);
220 220
221 rv = copy_to_user(usr_buf, buf, sizeof(buf)); 221 return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt);
222 if (rv)
223 return rv;
224
225 return sizeof(buf) - 1;
226} 222}
227 223
228static ssize_t gpio_mockup_debugfs_write(struct file *file, 224static ssize_t gpio_mockup_debugfs_write(struct file *file,
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
723void of_gpiochip_remove(struct gpio_chip *chip) 730void of_gpiochip_remove(struct gpio_chip *chip)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 144af0733581..0495bf1d480a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2776,7 +2776,7 @@ int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
2776 } 2776 }
2777 2777
2778 config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, debounce); 2778 config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, debounce);
2779 return gpio_set_config(chip, gpio_chip_hwgpio(desc), config); 2779 return chip->set_config(chip, gpio_chip_hwgpio(desc), config);
2780} 2780}
2781EXPORT_SYMBOL_GPL(gpiod_set_debounce); 2781EXPORT_SYMBOL_GPL(gpiod_set_debounce);
2782 2782
@@ -2813,7 +2813,7 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
2813 packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE, 2813 packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE,
2814 !transitory); 2814 !transitory);
2815 gpio = gpio_chip_hwgpio(desc); 2815 gpio = gpio_chip_hwgpio(desc);
2816 rc = gpio_set_config(chip, gpio, packed); 2816 rc = chip->set_config(chip, gpio, packed);
2817 if (rc == -ENOTSUPP) { 2817 if (rc == -ENOTSUPP) {
2818 dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n", 2818 dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n",
2819 gpio); 2819 gpio);
diff --git a/include/linux/platform_data/gpio/gpio-amd-fch.h b/include/linux/platform_data/gpio/gpio-amd-fch.h
index a867637e172d..9e46678edb2a 100644
--- a/include/linux/platform_data/gpio/gpio-amd-fch.h
+++ b/include/linux/platform_data/gpio/gpio-amd-fch.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL+ */ 1/* SPDX-License-Identifier: GPL-2.0+ */
2 2
3/* 3/*
4 * AMD FCH gpio driver platform-data 4 * AMD FCH gpio driver platform-data