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: refactor the forwarder registration part

Add a new function gpiochip_fwd_register(), which finalizes the
initialization of the forwarder and registers the corresponding gpiochip.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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-4-29f0cbbdfb30@bootlin.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Thomas Richard and committed by
Bartosz Golaszewski
10d022ef c44ce91b

+13 -6
+13 -6
drivers/gpio/gpio-aggregator.c
··· 538 538 return 0; 539 539 } 540 540 541 + static int gpiochip_fwd_register(struct gpiochip_fwd *fwd) 542 + { 543 + struct gpio_chip *chip = &fwd->chip; 544 + 545 + if (chip->can_sleep) 546 + mutex_init(&fwd->mlock); 547 + else 548 + spin_lock_init(&fwd->slock); 549 + 550 + return devm_gpiochip_add_data(chip->parent, chip, fwd); 551 + } 552 + 541 553 /** 542 554 * gpiochip_fwd_create() - Create a new GPIO forwarder 543 555 * @dev: Parent device pointer ··· 587 575 return ERR_PTR(error); 588 576 } 589 577 590 - if (chip->can_sleep) 591 - mutex_init(&fwd->mlock); 592 - else 593 - spin_lock_init(&fwd->slock); 594 - 595 578 if (features & FWD_FEATURE_DELAY) { 596 579 error = gpiochip_fwd_setup_delay_line(dev, chip, fwd); 597 580 if (error) 598 581 return ERR_PTR(error); 599 582 } 600 583 601 - error = devm_gpiochip_add_data(dev, chip, fwd); 584 + error = gpiochip_fwd_register(fwd); 602 585 if (error) 603 586 return ERR_PTR(error); 604 587