airoha: pwm: use devm
authorRosen Penev <[email protected]>
Sat, 26 Apr 2025 23:48:12 +0000 (16:48 -0700)
committerChristian Marangi <[email protected]>
Wed, 20 Aug 2025 06:43:18 +0000 (08:43 +0200)
Removes the need for a remove function in platform_device.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/18660
Signed-off-by: Christian Marangi <[email protected]>
(cherry picked from commit aa4c96b9250c06d07cde145441e391453f87ccb2)

target/linux/airoha/patches-6.6/108-pwm-airoha-Add-support-for-EN7581-SoC.patch

index 8f83c696c4f5589d02b65c391987ab620b4b09d3..0b114d5f53b6fe2d33b9a17ec3f55b9bc6ff594f 100644 (file)
@@ -48,7 +48,7 @@ Signed-off-by: Lorenzo Bianconi <[email protected]>
  obj-$(CONFIG_PWM_ATMEL_HLCDC_PWM)     += pwm-atmel-hlcdc.o
 --- /dev/null
 +++ b/drivers/pwm/pwm-airoha.c
-@@ -0,0 +1,400 @@
+@@ -0,0 +1,388 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright 2022 Markus Gothe <[email protected]>
@@ -414,18 +414,7 @@ Signed-off-by: Lorenzo Bianconi <[email protected]>
 +      if (IS_ERR(pc->regmap))
 +              return PTR_ERR(pc->regmap);
 +
-+      platform_set_drvdata(pdev, pc);
-+
-+      return pwmchip_add(&pc->chip);
-+}
-+
-+static int airoha_pwm_remove(struct platform_device *pdev)
-+{
-+      struct airoha_pwm *pc = platform_get_drvdata(pdev);
-+
-+      pwmchip_remove(&pc->chip);
-+
-+      return 0;
++      return devm_pwmchip_add(&pdev->dev, &pc->chip);
 +}
 +
 +static const struct of_device_id airoha_pwm_of_match[] = {
@@ -440,7 +429,6 @@ Signed-off-by: Lorenzo Bianconi <[email protected]>
 +              .of_match_table = airoha_pwm_of_match,
 +      },
 +      .probe = airoha_pwm_probe,
-+      .remove = airoha_pwm_remove,
 +};
 +module_platform_driver(airoha_pwm_driver);
 +