Skip to content

Commit 6698cbd

Browse files
tititiou36groeck
authored andcommitted
hwmon: (lan966x) Use the devm_clk_get_enabled() helper function
Use the devm_clk_get_enabled() helper function instead of hand-writing it. It saves some line of codes. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/25f2ab4c61d4fc48e8200f8754bb446f2b89ea89.1688795527.git.christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent c15a8ed commit 6698cbd

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

drivers/hwmon/lan966x-hwmon.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -334,24 +334,6 @@ static struct regmap *lan966x_init_regmap(struct platform_device *pdev,
334334
return devm_regmap_init_mmio(&pdev->dev, base, &regmap_config);
335335
}
336336

337-
static void lan966x_clk_disable(void *data)
338-
{
339-
struct lan966x_hwmon *hwmon = data;
340-
341-
clk_disable_unprepare(hwmon->clk);
342-
}
343-
344-
static int lan966x_clk_enable(struct device *dev, struct lan966x_hwmon *hwmon)
345-
{
346-
int ret;
347-
348-
ret = clk_prepare_enable(hwmon->clk);
349-
if (ret)
350-
return ret;
351-
352-
return devm_add_action_or_reset(dev, lan966x_clk_disable, hwmon);
353-
}
354-
355337
static int lan966x_hwmon_probe(struct platform_device *pdev)
356338
{
357339
struct device *dev = &pdev->dev;
@@ -363,15 +345,11 @@ static int lan966x_hwmon_probe(struct platform_device *pdev)
363345
if (!hwmon)
364346
return -ENOMEM;
365347

366-
hwmon->clk = devm_clk_get(dev, NULL);
348+
hwmon->clk = devm_clk_get_enabled(dev, NULL);
367349
if (IS_ERR(hwmon->clk))
368350
return dev_err_probe(dev, PTR_ERR(hwmon->clk),
369351
"failed to get clock\n");
370352

371-
ret = lan966x_clk_enable(dev, hwmon);
372-
if (ret)
373-
return dev_err_probe(dev, ret, "failed to enable clock\n");
374-
375353
hwmon->clk_rate = clk_get_rate(hwmon->clk);
376354

377355
hwmon->regmap_pvt = lan966x_init_regmap(pdev, "pvt");

0 commit comments

Comments
 (0)