mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
Input: samsung-keypad - switch to using devm_clk_get_prepared()
Switch to using devm_clk_get_prepared() instead of combining devm_clk_get() with clk_prepare(), which simplifies the code and ensures that the clock is unprepared at the right time relative to releasing other managed resources. Link: https://lore.kernel.org/r/20240819045813.2154642-2-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
c6f908f88a
commit
e65efc62ca
|
|
@ -361,18 +361,12 @@ static int samsung_keypad_probe(struct platform_device *pdev)
|
|||
if (!keypad->base)
|
||||
return -EBUSY;
|
||||
|
||||
keypad->clk = devm_clk_get(&pdev->dev, "keypad");
|
||||
keypad->clk = devm_clk_get_prepared(&pdev->dev, "keypad");
|
||||
if (IS_ERR(keypad->clk)) {
|
||||
dev_err(&pdev->dev, "failed to get keypad clk\n");
|
||||
return PTR_ERR(keypad->clk);
|
||||
}
|
||||
|
||||
error = clk_prepare(keypad->clk);
|
||||
if (error) {
|
||||
dev_err(&pdev->dev, "keypad clock prepare failed\n");
|
||||
return error;
|
||||
}
|
||||
|
||||
keypad->input_dev = input_dev;
|
||||
keypad->pdev = pdev;
|
||||
keypad->row_shift = row_shift;
|
||||
|
|
@ -399,7 +393,7 @@ static int samsung_keypad_probe(struct platform_device *pdev)
|
|||
keypad->keycodes, input_dev);
|
||||
if (error) {
|
||||
dev_err(&pdev->dev, "failed to build keymap\n");
|
||||
goto err_unprepare_clk;
|
||||
return error;
|
||||
}
|
||||
|
||||
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
|
||||
|
|
@ -411,7 +405,7 @@ static int samsung_keypad_probe(struct platform_device *pdev)
|
|||
keypad->irq = platform_get_irq(pdev, 0);
|
||||
if (keypad->irq < 0) {
|
||||
error = keypad->irq;
|
||||
goto err_unprepare_clk;
|
||||
return error;
|
||||
}
|
||||
|
||||
error = devm_request_threaded_irq(&pdev->dev, keypad->irq, NULL,
|
||||
|
|
@ -419,7 +413,7 @@ static int samsung_keypad_probe(struct platform_device *pdev)
|
|||
dev_name(&pdev->dev), keypad);
|
||||
if (error) {
|
||||
dev_err(&pdev->dev, "failed to register keypad interrupt\n");
|
||||
goto err_unprepare_clk;
|
||||
return error;
|
||||
}
|
||||
|
||||
device_init_wakeup(&pdev->dev, pdata->wakeup);
|
||||
|
|
@ -439,20 +433,12 @@ static int samsung_keypad_probe(struct platform_device *pdev)
|
|||
|
||||
err_disable_runtime_pm:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err_unprepare_clk:
|
||||
clk_unprepare(keypad->clk);
|
||||
return error;
|
||||
}
|
||||
|
||||
static void samsung_keypad_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct samsung_keypad *keypad = platform_get_drvdata(pdev);
|
||||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
input_unregister_device(keypad->input_dev);
|
||||
|
||||
clk_unprepare(keypad->clk);
|
||||
}
|
||||
|
||||
static int samsung_keypad_runtime_suspend(struct device *dev)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user