Commit 3fe81a56 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Dmitry Torokhov

Input: spear-keyboard - switch to devm_clk_get_prepared()

Use devm_clk_get_prepared() in order to remove a clk_unprepare() in an
error handling path of the probe and from the .remove() function.

This done, the whole .remove() function can also be axed because
'input_dev' is a managed resource allocated with
devm_input_allocate_device() and we can fully rely on devm for cleaning up.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/062986b0a5105cbc61330da0e55b22c00e2c1c4f.1722062145.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 740ff03d
...@@ -222,7 +222,7 @@ static int spear_kbd_probe(struct platform_device *pdev) ...@@ -222,7 +222,7 @@ static int spear_kbd_probe(struct platform_device *pdev)
if (IS_ERR(kbd->io_base)) if (IS_ERR(kbd->io_base))
return PTR_ERR(kbd->io_base); return PTR_ERR(kbd->io_base);
kbd->clk = devm_clk_get(&pdev->dev, NULL); kbd->clk = devm_clk_get_prepared(&pdev->dev, NULL);
if (IS_ERR(kbd->clk)) if (IS_ERR(kbd->clk))
return PTR_ERR(kbd->clk); return PTR_ERR(kbd->clk);
...@@ -255,14 +255,9 @@ static int spear_kbd_probe(struct platform_device *pdev) ...@@ -255,14 +255,9 @@ static int spear_kbd_probe(struct platform_device *pdev)
return error; return error;
} }
error = clk_prepare(kbd->clk);
if (error)
return error;
error = input_register_device(input_dev); error = input_register_device(input_dev);
if (error) { if (error) {
dev_err(&pdev->dev, "Unable to register keyboard device\n"); dev_err(&pdev->dev, "Unable to register keyboard device\n");
clk_unprepare(kbd->clk);
return error; return error;
} }
...@@ -272,14 +267,6 @@ static int spear_kbd_probe(struct platform_device *pdev) ...@@ -272,14 +267,6 @@ static int spear_kbd_probe(struct platform_device *pdev)
return 0; return 0;
} }
static void spear_kbd_remove(struct platform_device *pdev)
{
struct spear_kbd *kbd = platform_get_drvdata(pdev);
input_unregister_device(kbd->input);
clk_unprepare(kbd->clk);
}
static int spear_kbd_suspend(struct device *dev) static int spear_kbd_suspend(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
...@@ -373,7 +360,6 @@ MODULE_DEVICE_TABLE(of, spear_kbd_id_table); ...@@ -373,7 +360,6 @@ MODULE_DEVICE_TABLE(of, spear_kbd_id_table);
static struct platform_driver spear_kbd_driver = { static struct platform_driver spear_kbd_driver = {
.probe = spear_kbd_probe, .probe = spear_kbd_probe,
.remove_new = spear_kbd_remove,
.driver = { .driver = {
.name = "keyboard", .name = "keyboard",
.pm = pm_sleep_ptr(&spear_kbd_pm_ops), .pm = pm_sleep_ptr(&spear_kbd_pm_ops),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment