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

From: Dmitry Torokhov
Date: Mon Nov 26 2012 - 11:56:19 EST


On Mon, Nov 26, 2012 at 09:57:45PM +0530, Viresh Kumar wrote:
> On 20 November 2012 14:17, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote:
> > 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 <vipulkumar.samar@xxxxxx>

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 <vipulkumar.samar@xxxxxx>
Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
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);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/