aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2013-05-08 17:41:18 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2013-06-23 09:55:14 -0400
commit03832aa87f81341d68f5f952c5418984dfb10139 (patch)
tree2e30340ed004b3f81b3998e1e0b3ca541fd9d261
parent80ebf14546647e581e10e2cb14425a3621e782e0 (diff)
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 <geert@linux-m68k.org> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/keyboard/cros_ec_keyb.c54
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 49557f27bfa6..7e8b0a52af25 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,
206 return NOTIFY_DONE; 206 return NOTIFY_DONE;
207} 207}
208 208
209/* Clear any keys in the buffer */
210static void cros_ec_keyb_clear_keyboard(struct cros_ec_keyb *ckdev)
211{
212 uint8_t old_state[ckdev->cols];
213 uint8_t new_state[ckdev->cols];
214 unsigned long duration;
215 int i, ret;
216
217 /*
218 * Keep reading until we see that the scan state does not change.
219 * That indicates that we are done.
220 *
221 * Assume that the EC keyscan buffer is at most 32 deep.
222 */
223 duration = jiffies;
224 ret = cros_ec_keyb_get_state(ckdev, new_state);
225 for (i = 1; !ret && i < 32; i++) {
226 memcpy(old_state, new_state, sizeof(old_state));
227 ret = cros_ec_keyb_get_state(ckdev, new_state);
228 if (0 == memcmp(old_state, new_state, sizeof(old_state)))
229 break;
230 }
231 duration = jiffies - duration;
232 dev_info(ckdev->dev, "Discarded %d keyscan(s) in %dus\n", i,
233 jiffies_to_usecs(duration));
234}
235
236static int cros_ec_keyb_probe(struct platform_device *pdev) 209static int cros_ec_keyb_probe(struct platform_device *pdev)
237{ 210{
238 struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent); 211 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)
299} 272}
300 273
301#ifdef CONFIG_PM_SLEEP 274#ifdef CONFIG_PM_SLEEP
275/* Clear any keys in the buffer */
276static void cros_ec_keyb_clear_keyboard(struct cros_ec_keyb *ckdev)
277{
278 uint8_t old_state[ckdev->cols];
279 uint8_t new_state[ckdev->cols];
280 unsigned long duration;
281 int i, ret;
282
283 /*
284 * Keep reading until we see that the scan state does not change.
285 * That indicates that we are done.
286 *
287 * Assume that the EC keyscan buffer is at most 32 deep.
288 */
289 duration = jiffies;
290 ret = cros_ec_keyb_get_state(ckdev, new_state);
291 for (i = 1; !ret && i < 32; i++) {
292 memcpy(old_state, new_state, sizeof(old_state));
293 ret = cros_ec_keyb_get_state(ckdev, new_state);
294 if (0 == memcmp(old_state, new_state, sizeof(old_state)))
295 break;
296 }
297 duration = jiffies - duration;
298 dev_info(ckdev->dev, "Discarded %d keyscan(s) in %dus\n", i,
299 jiffies_to_usecs(duration));
300}
301
302static int cros_ec_keyb_resume(struct device *dev) 302static int cros_ec_keyb_resume(struct device *dev)
303{ 303{
304 struct cros_ec_keyb *ckdev = dev_get_drvdata(dev); 304 struct cros_ec_keyb *ckdev = dev_get_drvdata(dev);