Skip to content

Commit 092b7d4

Browse files
committed
Input: snvs_pwrkey - use devm_clk_get_optional_enabled()
Switch to using devm_clk_get_optional_enabled() helper instead of acquiring the clock with devm_clk_get_optional(), enabling it, and defining and installing a custom devm action to call clk_disable(). Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/ZtDDGMaOFlMYjOrt@google.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 81bdc7e commit 092b7d4

1 file changed

Lines changed: 1 addition & 23 deletions

File tree

drivers/input/keyboard/snvs_pwrkey.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
100100
return IRQ_HANDLED;
101101
}
102102

103-
static void imx_snvs_pwrkey_disable_clk(void *data)
104-
{
105-
clk_disable_unprepare(data);
106-
}
107-
108103
static void imx_snvs_pwrkey_act(void *pdata)
109104
{
110105
struct pwrkey_drv_data *pd = pdata;
@@ -141,28 +136,12 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
141136
dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");
142137
}
143138

144-
clk = devm_clk_get_optional(&pdev->dev, NULL);
139+
clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
145140
if (IS_ERR(clk)) {
146141
dev_err(&pdev->dev, "Failed to get snvs clock (%pe)\n", clk);
147142
return PTR_ERR(clk);
148143
}
149144

150-
error = clk_prepare_enable(clk);
151-
if (error) {
152-
dev_err(&pdev->dev, "Failed to enable snvs clock (%pe)\n",
153-
ERR_PTR(error));
154-
return error;
155-
}
156-
157-
error = devm_add_action_or_reset(&pdev->dev,
158-
imx_snvs_pwrkey_disable_clk, clk);
159-
if (error) {
160-
dev_err(&pdev->dev,
161-
"Failed to register clock cleanup handler (%pe)\n",
162-
ERR_PTR(error));
163-
return error;
164-
}
165-
166145
pdata->wakeup = of_property_read_bool(np, "wakeup-source");
167146

168147
pdata->irq = platform_get_irq(pdev, 0);
@@ -204,7 +183,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
204183
error = devm_request_irq(&pdev->dev, pdata->irq,
205184
imx_snvs_pwrkey_interrupt,
206185
0, pdev->name, pdev);
207-
208186
if (error) {
209187
dev_err(&pdev->dev, "interrupt not available.\n");
210188
return error;

0 commit comments

Comments
 (0)