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.

gpio: aggregator: add possibility to attach data to the forwarder

Add a data pointer to store private data in the forwarder.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://lore.kernel.org/r/20250811-aaeon-up-board-pinctrl-support-v9-8-29f0cbbdfb30@bootlin.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Thomas Richard and committed by
Bartosz Golaszewski
60e92c10 b31c68fd

+21 -3
+18 -2
drivers/gpio/gpio-aggregator.c
··· 246 246 spinlock_t slock; /* protects tmp[] if !can_sleep */ 247 247 }; 248 248 struct gpiochip_fwd_timing *delay_timings; 249 + void *data; 249 250 unsigned long *valid_mask; 250 251 unsigned long tmp[]; /* values and descs for multiple ops */ 251 252 }; ··· 504 503 return &fwd->chip; 505 504 } 506 505 EXPORT_SYMBOL_NS_GPL(gpiochip_fwd_get_gpiochip, "GPIO_FORWARDER"); 506 + 507 + /** 508 + * gpiochip_fwd_get_data - Get driver-private data for the GPIO forwarder 509 + * @fwd: GPIO forwarder 510 + * 511 + * Returns: The driver-private data for the GPIO forwarder 512 + */ 513 + void *gpiochip_fwd_get_data(struct gpiochip_fwd *fwd) 514 + { 515 + return fwd->data; 516 + } 517 + EXPORT_SYMBOL_NS_GPL(gpiochip_fwd_get_data, "GPIO_FORWARDER"); 507 518 508 519 /** 509 520 * gpiochip_fwd_gpio_request - Request a line of the GPIO forwarder ··· 781 768 /** 782 769 * gpiochip_fwd_register - Register a GPIO forwarder 783 770 * @fwd: GPIO forwarder 771 + * @data: driver-private data associated with this forwarder 784 772 * 785 773 * Returns: 0 on success, or negative errno on failure. 786 774 */ 787 - int gpiochip_fwd_register(struct gpiochip_fwd *fwd) 775 + int gpiochip_fwd_register(struct gpiochip_fwd *fwd, void *data) 788 776 { 789 777 struct gpio_chip *chip = &fwd->chip; 790 778 ··· 800 786 mutex_init(&fwd->mlock); 801 787 else 802 788 spin_lock_init(&fwd->slock); 789 + 790 + fwd->data = data; 803 791 804 792 return devm_gpiochip_add_data(chip->parent, chip, fwd); 805 793 } ··· 847 831 return ERR_PTR(error); 848 832 } 849 833 850 - error = gpiochip_fwd_register(fwd); 834 + error = gpiochip_fwd_register(fwd, NULL); 851 835 if (error) 852 836 return ERR_PTR(error); 853 837
+3 -1
include/linux/gpio/forwarder.h
··· 11 11 int gpiochip_fwd_desc_add(struct gpiochip_fwd *fwd, 12 12 struct gpio_desc *desc, unsigned int offset); 13 13 void gpiochip_fwd_desc_free(struct gpiochip_fwd *fwd, unsigned int offset); 14 - int gpiochip_fwd_register(struct gpiochip_fwd *fwd); 14 + int gpiochip_fwd_register(struct gpiochip_fwd *fwd, void *data); 15 15 16 16 struct gpio_chip *gpiochip_fwd_get_gpiochip(struct gpiochip_fwd *fwd); 17 + 18 + void *gpiochip_fwd_get_data(struct gpiochip_fwd *fwd); 17 19 18 20 int gpiochip_fwd_gpio_request(struct gpiochip_fwd *fwd, unsigned int offset); 19 21 int gpiochip_fwd_gpio_get_direction(struct gpiochip_fwd *fwd,