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: as3722: Use devm_gpiochip_add_data() to simplify remove path

Use devm version of gpiochip add function to handle removal for us.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231116223045.274211-1-afd@ti.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andrew Davis and committed by
Linus Walleij
c3c63e66 05e4941d

+2 -15
+2 -15
drivers/pinctrl/pinctrl-as3722.c
··· 542 542 543 543 as_pci->dev = &pdev->dev; 544 544 as_pci->as3722 = dev_get_drvdata(pdev->dev.parent); 545 - platform_set_drvdata(pdev, as_pci); 546 545 547 546 as_pci->pins = as3722_pins_desc; 548 547 as_pci->num_pins = ARRAY_SIZE(as3722_pins_desc); ··· 561 562 562 563 as_pci->gpio_chip = as3722_gpio_chip; 563 564 as_pci->gpio_chip.parent = &pdev->dev; 564 - ret = gpiochip_add_data(&as_pci->gpio_chip, as_pci); 565 + ret = devm_gpiochip_add_data(&pdev->dev, &as_pci->gpio_chip, as_pci); 565 566 if (ret < 0) { 566 567 dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret); 567 568 return ret; ··· 571 572 0, 0, AS3722_PIN_NUM); 572 573 if (ret < 0) { 573 574 dev_err(&pdev->dev, "Couldn't add pin range, %d\n", ret); 574 - goto fail_range_add; 575 + return ret; 575 576 } 576 577 577 578 return 0; 578 - 579 - fail_range_add: 580 - gpiochip_remove(&as_pci->gpio_chip); 581 - return ret; 582 - } 583 - 584 - static void as3722_pinctrl_remove(struct platform_device *pdev) 585 - { 586 - struct as3722_pctrl_info *as_pci = platform_get_drvdata(pdev); 587 - 588 - gpiochip_remove(&as_pci->gpio_chip); 589 579 } 590 580 591 581 static const struct of_device_id as3722_pinctrl_of_match[] = { ··· 589 601 .of_match_table = as3722_pinctrl_of_match, 590 602 }, 591 603 .probe = as3722_pinctrl_probe, 592 - .remove_new = as3722_pinctrl_remove, 593 604 }; 594 605 module_platform_driver(as3722_pinctrl_driver); 595 606