2013-05-08 21:45:42

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH] input: cros_ec_keyb_clear_keyboard() depends on CONFIG_PM_SLEEP

If CONFIG_PM_SLEEP is not set:

drivers/input/keyboard/cros_ec_keyb.c:211: warning: ‘cros_ec_keyb_clear_keyboard’ defined but not used

Move the definition of cros_ec_keyb_clear_keyboard() inside the section
protected by #ifdef CONFIG_PM_SLEEP to fix this.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/input/keyboard/cros_ec_keyb.c | 54 ++++++++++++++++----------------
1 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index 49557f2..7e8b0a5 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -206,33 +206,6 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
return NOTIFY_DONE;
}

-/* Clear any keys in the buffer */
-static void cros_ec_keyb_clear_keyboard(struct cros_ec_keyb *ckdev)
-{
- uint8_t old_state[ckdev->cols];
- uint8_t new_state[ckdev->cols];
- unsigned long duration;
- int i, ret;
-
- /*
- * Keep reading until we see that the scan state does not change.
- * That indicates that we are done.
- *
- * Assume that the EC keyscan buffer is at most 32 deep.
- */
- duration = jiffies;
- ret = cros_ec_keyb_get_state(ckdev, new_state);
- for (i = 1; !ret && i < 32; i++) {
- memcpy(old_state, new_state, sizeof(old_state));
- ret = cros_ec_keyb_get_state(ckdev, new_state);
- if (0 == memcmp(old_state, new_state, sizeof(old_state)))
- break;
- }
- duration = jiffies - duration;
- dev_info(ckdev->dev, "Discarded %d keyscan(s) in %dus\n", i,
- jiffies_to_usecs(duration));
-}
-
static int cros_ec_keyb_probe(struct platform_device *pdev)
{
struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
@@ -299,6 +272,33 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
}

#ifdef CONFIG_PM_SLEEP
+/* Clear any keys in the buffer */
+static void cros_ec_keyb_clear_keyboard(struct cros_ec_keyb *ckdev)
+{
+ uint8_t old_state[ckdev->cols];
+ uint8_t new_state[ckdev->cols];
+ unsigned long duration;
+ int i, ret;
+
+ /*
+ * Keep reading until we see that the scan state does not change.
+ * That indicates that we are done.
+ *
+ * Assume that the EC keyscan buffer is at most 32 deep.
+ */
+ duration = jiffies;
+ ret = cros_ec_keyb_get_state(ckdev, new_state);
+ for (i = 1; !ret && i < 32; i++) {
+ memcpy(old_state, new_state, sizeof(old_state));
+ ret = cros_ec_keyb_get_state(ckdev, new_state);
+ if (0 == memcmp(old_state, new_state, sizeof(old_state)))
+ break;
+ }
+ duration = jiffies - duration;
+ dev_info(ckdev->dev, "Discarded %d keyscan(s) in %dus\n", i,
+ jiffies_to_usecs(duration));
+}
+
static int cros_ec_keyb_resume(struct device *dev)
{
struct cros_ec_keyb *ckdev = dev_get_drvdata(dev);
--
1.7.0.4


2013-05-09 03:25:58

by Simon Glass

[permalink] [raw]
Subject: Re: [PATCH] input: cros_ec_keyb_clear_keyboard() depends on CONFIG_PM_SLEEP

On Wed, May 8, 2013 at 3:45 PM, Geert Uytterhoeven <[email protected]> wrote:
> If CONFIG_PM_SLEEP is not set:
>
> drivers/input/keyboard/cros_ec_keyb.c:211: warning: ?cros_ec_keyb_clear_keyboard? defined but not used
>
> Move the definition of cros_ec_keyb_clear_keyboard() inside the section
> protected by #ifdef CONFIG_PM_SLEEP to fix this.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Acked-by: Simon Glass <[email protected]>

2013-05-15 06:42:53

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH] input: cros_ec_keyb_clear_keyboard() depends on CONFIG_PM_SLEEP

On Wed, May 08, 2013 at 09:25:56PM -0600, Simon Glass wrote:
> On Wed, May 8, 2013 at 3:45 PM, Geert Uytterhoeven <[email protected]> wrote:
> > If CONFIG_PM_SLEEP is not set:
> >
> > drivers/input/keyboard/cros_ec_keyb.c:211: warning: ‘cros_ec_keyb_clear_keyboard’ defined but not used
> >
> > Move the definition of cros_ec_keyb_clear_keyboard() inside the section
> > protected by #ifdef CONFIG_PM_SLEEP to fix this.
> >
> > Signed-off-by: Geert Uytterhoeven <[email protected]>
>
> Acked-by: Simon Glass <[email protected]>

Acked-by: Dmitry Torokhov <[email protected]>

Could you please forward this to Linus as I do not have this driver in
my branch yet.

Thanks.

--
Dmitry

2013-06-17 23:16:44

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH] input: cros_ec_keyb_clear_keyboard() depends on CONFIG_PM_SLEEP

Hi Dmitry,

On Tue, May 14, 2013 at 11:42:48PM -0700, Dmitry Torokhov wrote:
> On Wed, May 08, 2013 at 09:25:56PM -0600, Simon Glass wrote:
> > On Wed, May 8, 2013 at 3:45 PM, Geert Uytterhoeven <[email protected]> wrote:
> > > If CONFIG_PM_SLEEP is not set:
> > >
> > > drivers/input/keyboard/cros_ec_keyb.c:211: warning: ‘cros_ec_keyb_clear_keyboard’ defined but not used
> > >
> > > Move the definition of cros_ec_keyb_clear_keyboard() inside the section
> > > protected by #ifdef CONFIG_PM_SLEEP to fix this.
> > >
> > > Signed-off-by: Geert Uytterhoeven <[email protected]>
> >
> > Acked-by: Simon Glass <[email protected]>
>
> Acked-by: Dmitry Torokhov <[email protected]>
>
> Could you please forward this to Linus as I do not have this driver in
> my branch yet.
I guess you took that one now ? Or are you expecting me to merge it ?

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/

2013-06-18 08:39:15

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] input: cros_ec_keyb_clear_keyboard() depends on CONFIG_PM_SLEEP

On Tue, Jun 18, 2013 at 1:16 AM, Samuel Ortiz <[email protected]> wrote:
> On Tue, May 14, 2013 at 11:42:48PM -0700, Dmitry Torokhov wrote:
>> On Wed, May 08, 2013 at 09:25:56PM -0600, Simon Glass wrote:
>> > On Wed, May 8, 2013 at 3:45 PM, Geert Uytterhoeven <[email protected]> wrote:
>> > > If CONFIG_PM_SLEEP is not set:
>> > >
>> > > drivers/input/keyboard/cros_ec_keyb.c:211: warning: ‘cros_ec_keyb_clear_keyboard’ defined but not used
>> > >
>> > > Move the definition of cros_ec_keyb_clear_keyboard() inside the section
>> > > protected by #ifdef CONFIG_PM_SLEEP to fix this.
>> > >
>> > > Signed-off-by: Geert Uytterhoeven <[email protected]>
>> >
>> > Acked-by: Simon Glass <[email protected]>
>>
>> Acked-by: Dmitry Torokhov <[email protected]>
>>
>> Could you please forward this to Linus as I do not have this driver in
>> my branch yet.
> I guess you took that one now ? Or are you expecting me to merge it ?

FWIW, I also have it in my exotic-arch-fixes branch, now destined for 3.11.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds