From: Tapio Vihuri <tapio.vihuri@nokia.com>
To: ext Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: randy.dunlap@oracle.com, alsa-devel@alsa-project.org,
samu.p.onkalo@nokia.com, peter.ujfalusi@nokia.com,
linux-kernel@vger.kernel.org, ilkka.koskinen@nokia.com
Subject: Re: [PATCH v4 1/3] ECI: input: introduce ECI accessory input driver
Date: Thu, 20 Jan 2011 09:57:28 +0200 [thread overview]
Message-ID: <1295510248.26257.7.camel@dell> (raw)
In-Reply-To: <20110119174412.GB29107@core.coreip.homeip.net>
On Wed, 2011-01-19 at 09:44 -0800, ext Dmitry Torokhov wrote:
> Hi Tapio,
>
> On Wed, Jan 19, 2011 at 02:06:54PM +0200, tapio.vihuri@nokia.com wrote:
> > +
> > + for (; key->type != KE_END; key++) {
> > + switch (key->type) {
> > + case KE_KEY:
> > + __set_bit(key->keycode, eci->acc_input->keybit);
> > + break;
> > + case KE_SW:
> > + case KE_VSW:
> > + __set_bit(key->keycode, eci->acc_input->swbit);
> > + break;
> > + }
> > + }
> > +
>
> Is this still needed? I believe sparse_keymap_setup() below shoudl take
> care of this...
>
> > + __set_bit(EV_KEY, eci->acc_input->evbit);
> > + __set_bit(EV_SW, eci->acc_input->evbit);
> > + __set_bit(EV_REP, eci->acc_input->evbit);
> > +
> > + err = sparse_keymap_setup(eci->acc_input, eci_keymap, NULL);
> > + if (err)
> > + goto err_free_dev;
> > +
>
Hi Dmitry.
Thanks for pointing this out, as we have sparse keymap, we should use
it :)
How about KE_VSW case ? Shouldn't it be in the sparse_keymap_setup {}
also ?
---------8<------------------------
int sparse_keymap_setup(struct input_dev *dev,
const struct key_entry *keymap,
int (*setup)(struct input_dev *, struct
key_entry *))
{
size_t map_size = 1; /* to account for the last KE_END entry */
const struct key_entry *e;
struct key_entry *map, *entry;
int i;
int error;
for (e = keymap; e->type != KE_END; e++)
map_size++;
map = kcalloc(map_size, sizeof (struct key_entry), GFP_KERNEL);
if (!map)
return -ENOMEM;
memcpy(map, keymap, map_size * sizeof (struct key_entry));
for (i = 0; i < map_size; i++) {
entry = &map[i];
if (setup) {
error = setup(dev, entry);
if (error)
goto err_out;
}
switch (entry->type) {
case KE_KEY:
__set_bit(EV_KEY, dev->evbit);
__set_bit(entry->keycode, dev->keybit);
break;
case KE_SW:
__set_bit(EV_SW, dev->evbit);
__set_bit(entry->sw.code, dev->swbit);
break;
}
}
dev->keycode = map;
dev->keycodemax = map_size;
dev->getkeycode_new = sparse_keymap_getkeycode;
dev->setkeycode_new = sparse_keymap_setkeycode;
return 0;
err_out:
kfree(map);
return error;
}
BR,
Tapsa
--
Tapsa
050 4876788
next prev parent reply other threads:[~2011-01-20 7:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-19 12:06 [PATCH v4 0/3] input: Add support for ECI (multimedia) accessories tapio.vihuri
2011-01-19 12:06 ` [PATCH v4 1/3] ECI: input: introduce ECI accessory input driver tapio.vihuri
2011-01-19 12:06 ` [PATCH v4 2/3] ECI: introducing ECI controller driver tapio.vihuri
2011-01-19 12:06 ` [PATCH v4 3/3] ECI: adding platform data for ECI driver tapio.vihuri
2011-01-19 17:44 ` [PATCH v4 1/3] ECI: input: introduce ECI accessory input driver Dmitry Torokhov
2011-01-20 7:57 ` Tapio Vihuri [this message]
2011-01-20 8:11 ` Dmitry Torokhov
2011-01-20 12:17 ` Tapio Vihuri
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=1295510248.26257.7.camel@dell \
--to=tapio.vihuri@nokia.com \
--cc=alsa-devel@alsa-project.org \
--cc=dmitry.torokhov@gmail.com \
--cc=ilkka.koskinen@nokia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.ujfalusi@nokia.com \
--cc=randy.dunlap@oracle.com \
--cc=samu.p.onkalo@nokia.com \
/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).