GPIO fixes for the v5.1 series:
- 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. -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJcn4QVAAoJEEEQszewGV1zhyMP/3E2PeJmi1IKK2YTGJaEdz0+ 71Q6++a7xB1jTOa1FKgYBUI+cwjjyhpaFU8Ax7jbNEpcUgTRu+wKFrdAp2of7UZk iv+7ODzw+d/usdhlLgFSIf+NHUFSytQBZRRS4sSFi2QyavHF49pXzWv2oMFOgGiv sn/Ke2lU8oT49W1TfH/RjLTyx36eEBhEyWe9JKYCrFuDFCYvykAOmYPP6wULHRG5 UCsRCP/tYktu5aANAavMh+o0SRH6Xik23bPo5adP32iKb4HuKurxy5bl26k+T5tU crRANm/LD/3fu2GBoKPl3EjI7zQsJINwwvYO65tX44WJpBVZX07MRBiBCZxAex/m j11x5oA9pBNM8Jn2MP2IIP3+izpyc3ojwJoLn27fM/PizMS3vU4Wp7MetAAjCwmb qF7Y2ua3IGHn4vay5u4UJjGP/wFptv8YJLlqCO1wkeH2LdJm6ZM3uAhj0R4VOPoA bTmFSRVCGOVL1DYYW2eWxADXW5zmdXmuKQx+/bmMUiw1s84gDOde8Yg7UGegaT4k H1FjacvwKU0Q/OMx+4+jv1h6yAb0tF4iTkno5v99WEOAg+WWNnHj85r6aigaWSa7 FVmsMEJbDJbvUF1rEZ9Zq1fmwBKOY3qd3zSRulchimx0wd3LeBw3AKLx8ojk2/Hq hoLlO5f2ifYTuHQbnHnX =6ndO -----END PGP SIGNATURE----- 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
This commit is contained in:
Коммит
3af9a5256f
|
@ -132,8 +132,10 @@ static int adnp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
|
|||
if (err < 0)
|
||||
goto out;
|
||||
|
||||
if (err & BIT(pos))
|
||||
err = -EACCES;
|
||||
if (value & BIT(pos)) {
|
||||
err = -EPERM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = 0;
|
||||
|
||||
|
|
|
@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
|
|||
|
||||
gpio->offset_timer =
|
||||
devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL);
|
||||
if (!gpio->offset_timer)
|
||||
return -ENOMEM;
|
||||
|
||||
return aspeed_gpio_setup_irqs(gpio, pdev);
|
||||
}
|
||||
|
|
|
@ -148,6 +148,8 @@ static int gpio_exar_probe(struct platform_device *pdev)
|
|||
mutex_init(&exar_gpio->lock);
|
||||
|
||||
index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
|
||||
if (index < 0)
|
||||
goto err_destroy;
|
||||
|
||||
sprintf(exar_gpio->name, "exar_gpio%d", index);
|
||||
exar_gpio->gpio_chip.label = exar_gpio->name;
|
||||
|
|
|
@ -204,8 +204,8 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
|
|||
struct gpio_mockup_chip *chip;
|
||||
struct seq_file *sfile;
|
||||
struct gpio_chip *gc;
|
||||
int val, cnt;
|
||||
char buf[3];
|
||||
int val, rv;
|
||||
|
||||
if (*ppos != 0)
|
||||
return 0;
|
||||
|
@ -216,13 +216,9 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
|
|||
gc = &chip->gc;
|
||||
|
||||
val = gpio_mockup_get(gc, priv->offset);
|
||||
snprintf(buf, sizeof(buf), "%d\n", val);
|
||||
cnt = snprintf(buf, sizeof(buf), "%d\n", val);
|
||||
|
||||
rv = copy_to_user(usr_buf, buf, sizeof(buf));
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
return sizeof(buf) - 1;
|
||||
return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt);
|
||||
}
|
||||
|
||||
static ssize_t gpio_mockup_debugfs_write(struct file *file,
|
||||
|
|
|
@ -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;
|
||||
|
@ -142,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;
|
||||
|
@ -717,7 +718,13 @@ int of_gpiochip_add(struct gpio_chip *chip)
|
|||
|
||||
of_node_get(chip->of_node);
|
||||
|
||||
return of_gpiochip_scan_gpios(chip);
|
||||
status = of_gpiochip_scan_gpios(chip);
|
||||
if (status) {
|
||||
of_node_put(chip->of_node);
|
||||
gpiochip_remove_pin_ranges(chip);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void of_gpiochip_remove(struct gpio_chip *chip)
|
||||
|
|
|
@ -2776,7 +2776,7 @@ int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
|
|||
}
|
||||
|
||||
config = pinconf_to_config_packed(PIN_CONFIG_INPUT_DEBOUNCE, debounce);
|
||||
return gpio_set_config(chip, gpio_chip_hwgpio(desc), config);
|
||||
return chip->set_config(chip, gpio_chip_hwgpio(desc), config);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpiod_set_debounce);
|
||||
|
||||
|
@ -2813,7 +2813,7 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
|
|||
packed = pinconf_to_config_packed(PIN_CONFIG_PERSIST_STATE,
|
||||
!transitory);
|
||||
gpio = gpio_chip_hwgpio(desc);
|
||||
rc = gpio_set_config(chip, gpio, packed);
|
||||
rc = chip->set_config(chip, gpio, packed);
|
||||
if (rc == -ENOTSUPP) {
|
||||
dev_dbg(&desc->gdev->dev, "Persistence not supported for GPIO %d\n",
|
||||
gpio);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL+ */
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
|
||||
/*
|
||||
* AMD FCH gpio driver platform-data
|
||||
|
|
Загрузка…
Ссылка в новой задаче