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.

pinctrl: stop using gpiod_to_chip()

Don't dereference struct gpio_chip directly, use dedicated gpio_device
getters instead.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20231115165001.2932350-3-brgl@bgdev.pl
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Bartosz Golaszewski and committed by
Linus Walleij
524fc108 16048722

+7 -6
+7 -6
drivers/pinctrl/core.c
··· 13 13 #define pr_fmt(fmt) "pinctrl core: " fmt 14 14 15 15 #include <linux/array_size.h> 16 + #include <linux/cleanup.h> 16 17 #include <linux/debugfs.h> 17 18 #include <linux/device.h> 18 19 #include <linux/err.h> ··· 1650 1649 const struct pinctrl_ops *ops = pctldev->desc->pctlops; 1651 1650 unsigned i, pin; 1652 1651 #ifdef CONFIG_GPIOLIB 1652 + struct gpio_device *gdev __free(gpio_device_put) = NULL; 1653 1653 struct pinctrl_gpio_range *range; 1654 - struct gpio_chip *chip; 1655 1654 int gpio_num; 1656 1655 #endif 1657 1656 ··· 1686 1685 * we need to get rid of the range->base eventually and 1687 1686 * get the descriptor directly from the gpio_chip. 1688 1687 */ 1689 - chip = gpiod_to_chip(gpio_to_desc(gpio_num)); 1690 - else 1691 - chip = NULL; 1692 - if (chip) 1693 - seq_printf(s, "%u:%s ", gpio_num - chip->gpiodev->base, chip->label); 1688 + gdev = gpiod_to_gpio_device(gpio_to_desc(gpio_num)); 1689 + if (gdev) 1690 + seq_printf(s, "%u:%s ", 1691 + gpio_num - gpio_device_get_base(gdev), 1692 + gpio_device_get_label(gdev)); 1694 1693 else 1695 1694 seq_puts(s, "0:? "); 1696 1695 #endif