Skip to contentSkip to conversation

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

PATCH New Markus Elfring 2 participants 2 messages Nov 14

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (aspeed-g6-pwm-tach) Use devm_reset_control_get_exclusive_deasserted() in aspeed_pwm_tach_probe()

From: Markus Elfring <[email protected]>
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.

---
 drivers/hwmon/aspeed-g6-pwm-tach.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)
drivers/hwmon/aspeed-g6-pwm-tach.c +2 -18
index f07c9a036b69..a26a0d48dde7 100644
@@ -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))
Signature · 1 line
2.56.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 9 lines

From: Markus Elfring <[email protected]>
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.

Quoted 3 lines

The source code was transformed by using the Coccinelle software.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1