Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+26 -17
+4 -2
drivers/gpio/gpio-adnp.c
··· 132 132 if (err < 0) 133 133 goto out; 134 134 135 - if (err & BIT(pos)) 136 - err = -EACCES; 135 + if (value & BIT(pos)) { 136 + err = -EPERM; 137 + goto out; 138 + } 137 139 138 140 err = 0; 139 141
+2
drivers/gpio/gpio-aspeed.c
··· 1224 1224 1225 1225 gpio->offset_timer = 1226 1226 devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); 1227 + if (!gpio->offset_timer) 1228 + return -ENOMEM; 1227 1229 1228 1230 return aspeed_gpio_setup_irqs(gpio, pdev); 1229 1231 }
+2
drivers/gpio/gpio-exar.c
··· 148 148 mutex_init(&exar_gpio->lock); 149 149 150 150 index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL); 151 + if (index < 0) 152 + goto err_destroy; 151 153 152 154 sprintf(exar_gpio->name, "exar_gpio%d", index); 153 155 exar_gpio->gpio_chip.label = exar_gpio->name;
+3 -7
drivers/gpio/gpio-mockup.c
··· 204 204 struct gpio_mockup_chip *chip; 205 205 struct seq_file *sfile; 206 206 struct gpio_chip *gc; 207 + int val, cnt; 207 208 char buf[3]; 208 - int val, rv; 209 209 210 210 if (*ppos != 0) 211 211 return 0; ··· 216 216 gc = &chip->gc; 217 217 218 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)); 222 - if (rv) 223 - return rv; 224 - 225 - return sizeof(buf) - 1; 221 + return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt); 226 222 } 227 223 228 224 static ssize_t gpio_mockup_debugfs_write(struct file *file,
+12 -5
drivers/gpio/gpiolib-of.c
··· 120 120 * to determine if the flags should have inverted semantics. 121 121 */ 122 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 125 struct device_node *child; 125 126 u32 cs; 126 127 int ret; ··· 143 142 * conflict and the "spi-cs-high" flag will 144 143 * take precedence. 145 144 */ 146 - if (of_property_read_bool(np, "spi-cs-high")) { 145 + if (of_property_read_bool(child, "spi-cs-high")) { 147 146 if (*flags & OF_GPIO_ACTIVE_LOW) { 148 147 pr_warn("%s GPIO handle specifies active low - ignored\n", 149 - of_node_full_name(np)); 148 + of_node_full_name(child)); 150 149 *flags &= ~OF_GPIO_ACTIVE_LOW; 151 150 } 152 151 } else { 153 152 if (!(*flags & OF_GPIO_ACTIVE_LOW)) 154 153 pr_info("%s enforce active low on chipselect handle\n", 155 - of_node_full_name(np)); 154 + of_node_full_name(child)); 156 155 *flags |= OF_GPIO_ACTIVE_LOW; 157 156 } 158 157 break; ··· 718 717 719 718 of_node_get(chip->of_node); 720 719 721 - return of_gpiochip_scan_gpios(chip); 720 + status = of_gpiochip_scan_gpios(chip); 721 + if (status) { 722 + of_node_put(chip->of_node); 723 + gpiochip_remove_pin_ranges(chip); 724 + } 725 + 726 + return status; 722 727 } 723 728 724 729 void of_gpiochip_remove(struct gpio_chip *chip)
+2 -2
drivers/gpio/gpiolib.c
··· 2776 2776 } 2777 2777 2778 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 } 2781 2781 EXPORT_SYMBOL_GPL(gpiod_set_debounce); 2782 2782 ··· 2813 2813 packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE, 2814 2814 !transitory); 2815 2815 gpio = gpio_chip_hwgpio(desc); 2816 - rc = gpio_set_config(chip, gpio, packed); 2816 + rc = chip->set_config(chip, gpio, packed); 2817 2817 if (rc == -ENOTSUPP) { 2818 2818 dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n", 2819 2819 gpio);
+1 -1
include/linux/platform_data/gpio/gpio-amd-fch.h
··· 1 - /* SPDX-License-Identifier: GPL+ */ 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 3 3 /* 4 4 * AMD FCH gpio driver platform-data