lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 20 Jan 2011 09:57:28 +0200
From:	Tapio Vihuri <tapio.vihuri@...ia.com>
To:	ext Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:	peter.ujfalusi@...ia.com, randy.dunlap@...cle.com,
	linux-kernel@...r.kernel.org, alsa-devel@...a-project.org,
	ilkka.koskinen@...ia.com, samu.p.onkalo@...ia.com
Subject: Re: [PATCH v4 1/3] ECI: input: introduce ECI accessory input driver

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@...ia.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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ