[PATCH] hwmon: (aspeed-g6-pwm-tach) Use devm_reset_control_get_exclusive_deasserted() in aspeed_pwm_tach_probe()

From: Markus Elfring

Date: Sat Nov 14 2026 - 11:29:29 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 14 Nov 2026 17:11:34 +0100

Use devm_reset_control_get_exclusive_deasserted() to replace the
explicit reset acquisition, deassertion, and cleanup action registered
with devm_add_action_or_reset().
Simplify reset handling and remove the custom reset assertion callback
while preserving reset assertion during cleanup.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/hwmon/aspeed-g6-pwm-tach.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/hwmon/aspeed-g6-pwm-tach.c b/drivers/hwmon/aspeed-g6-pwm-tach.c
index f07c9a036b69..a26a0d48dde7 100644
--- a/drivers/hwmon/aspeed-g6-pwm-tach.c
+++ b/drivers/hwmon/aspeed-g6-pwm-tach.c
@@ -448,13 +448,6 @@ static int aspeed_create_fan_monitor(struct device *dev,
return 0;
}

-static void aspeed_pwm_tach_reset_assert(void *data)
-{
- struct reset_control *rst = data;
-
- reset_control_assert(rst);
-}
-
static int aspeed_pwm_tach_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev, *hwmon;
@@ -475,19 +468,10 @@ static int aspeed_pwm_tach_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(priv->clk),
"Couldn't get clock\n");
priv->clk_rate = clk_get_rate(priv->clk);
- priv->reset = devm_reset_control_get_exclusive(dev, NULL);
+ priv->reset = devm_reset_control_get_exclusive_deasserted(dev, NULL);
if (IS_ERR(priv->reset))
return dev_err_probe(dev, PTR_ERR(priv->reset),
- "Couldn't get reset control\n");
-
- ret = reset_control_deassert(priv->reset);
- if (ret)
- return dev_err_probe(dev, ret,
- "Couldn't deassert reset control\n");
- ret = devm_add_action_or_reset(dev, aspeed_pwm_tach_reset_assert,
- priv->reset);
- if (ret)
- return ret;
+ "failed to get and deassert reset\n");

chip = devm_pwmchip_alloc(dev, PWM_ASPEED_NR_PWMS, 0);
if (IS_ERR(chip))
--
2.56.0