linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, akpm@linux-foundation.org
Subject: [PATCH 4/4] apanel: use generic keycode routines
Date: Mon, 03 Dec 2007 14:18:11 -0800	[thread overview]
Message-ID: <20071203221901.004608464@linux-foundation.org> (raw)
In-Reply-To: 20071203221807.077325020@linux-foundation.org

[-- Attachment #1: fujitsu-apanel-generic-keymap.patch --]
[-- Type: text/plain, Size: 1602 bytes --]

Don't need driver specific keymap routines, generic keycode routines
will work fine.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/input/misc/apanel.c	2007-11-21 17:32:36.000000000 -0800
+++ b/drivers/input/misc/apanel.c	2007-11-21 17:39:24.000000000 -0800
@@ -120,33 +120,6 @@ static void apanel_poll(struct input_pol
 			report_key(idev, ap->keymap[i]);
 }
 
-static int apanel_getkeycode(struct input_dev *idev, int scancode, int *keycode)
-{
-	struct apanel *ap = idev->private;
-
-	if (scancode < 0 || scancode >= MAX_PANEL_KEYS)
-		return -EINVAL;
-
-	*keycode = ap->keymap[scancode];
-	return 0;
-}
-
-static int apanel_setkeycode(struct input_dev *idev, int scancode, int keycode)
-{
-	struct apanel *ap = idev->private;
-
-	if (keycode < 0 || keycode > KEY_MAX)
-		return -EINVAL;
-
-	if (scancode < 0 || scancode >= MAX_PANEL_KEYS)
-		return -EINVAL;
-
-	clear_bit(ap->keymap[scancode], idev->keybit);
-	ap->keymap[scancode] = keycode;
-	set_bit(keycode, idev->keybit);
-	return 0;
-}
-
 /* Track state changes of LED */
 static void led_update(struct work_struct *work)
 {
@@ -274,11 +247,11 @@ static int apanel_probe(struct i2c_adapt
 	idev->phys = "apanel/input0";
 	idev->id.bustype = BUS_HOST;
 	idev->dev.parent = &ap->client.dev;
-	idev->getkeycode = apanel_getkeycode;
-	idev->setkeycode = apanel_setkeycode;
 
 	set_bit(EV_KEY, idev->evbit);
 
+	idev->keycode = ap->keymap;
+	idev->keycodesize = sizeof(ap->keymap[0]);
 	idev->keycodemax = (device_chip[APANEL_DEV_CDBTN] != CHIP_NONE) ? 12 : 4;
 
 	for (i = 0; i < idev->keycodemax; i++)

-- 


      parent reply	other threads:[~2007-12-03 22:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03 22:18 [PATCH 0/4] Fujitsu panel update Stephen Hemminger
2007-12-03 22:18 ` [PATCH 1/4] apanel: free input device on close Stephen Hemminger
2007-12-03 22:18 ` [PATCH 2/4] apanel: change name of LED Stephen Hemminger
2007-12-03 22:18 ` [PATCH 3/4] apanel: detach on shutdown Stephen Hemminger
2007-12-03 22:18 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071203221901.004608464@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).