Thread (14 messages) 14 messages, 2 authors, 2012-11-26

Re: [PATCH 2/3] Input: spear-keyboard: Add clk_{un}prepare() support

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-11-26 16:56:17
Also in: lkml
Subsystem: input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Dmitry Torokhov, Linus Torvalds

On Mon, Nov 26, 2012 at 09:57:45PM +0530, Viresh Kumar wrote:
On 20 November 2012 14:17, Dmitry Torokhov [off-list ref] wrote:
quoted
No, not really, it just does not work well with devm_* patches that got
applied: on removal you unprepare clock as the very first operation and
then devm_* does the rest which is wrong order.

I am looking at adding dem_* for clocks.
I haven't seen your clock patch in your tree. I am asking because i want to
push this patch :)
Yeah, I think I am not going to rush it and let it take its normal
course instead of short-cutting through my tree. I am going to apply the
patcch below in the meantime.

Thanks.

-- 
Dmitry


Input: spear-keyboard - Add clk_{un}prepare() support

From: Vipul Kumar Samar <redacted>

clk_{un}prepare is mandatory for platforms using common clock framework.
Because for SPEAr we don't do anything in clk_{un}prepare() calls, just
call them once in probe/remove.

Signed-off-by: Vipul Kumar Samar <redacted>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/spear-keyboard.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index d70093b..695d237 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -267,9 +267,14 @@ static int spear_kbd_probe(struct platform_device *pdev)
 		return error;
 	}
 
+	error = clk_prepare(kbd->clk);
+	if (error)
+		return error;
+
 	error = input_register_device(input_dev);
 	if (error) {
 		dev_err(&pdev->dev, "Unable to register keyboard device\n");
+		clk_unprepare(kbd->clk);
 		return error;
 	}
 
@@ -281,6 +286,11 @@ static int spear_kbd_probe(struct platform_device *pdev)
 
 static int spear_kbd_remove(struct platform_device *pdev)
 {
+	struct spear_kbd *kbd = platform_get_drvdata(pdev);
+
+	input_unregister_device(kbd->input);
+	clk_unprepare(kbd->clk);
+
 	device_init_wakeup(&pdev->dev, 0);
 	platform_set_drvdata(pdev, NULL);
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help