Re: [PATCH 2/3] sony-laptop - simplify keymap initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 24, 2009 at 07:01:46PM -0200, Henrique de Moraes Holschuh wrote:
> On Thu, 24 Dec 2009, Dmitry Torokhov wrote:
> > +	for (i = 0; i < ARRAY_SIZE(sony_laptop_input_keycode_map); i++)
> > +		__set_bit(sony_laptop_input_keycode_map[i], key_dev->keybit);
> > +	__clear_bit(KEY_RESERVED, key_dev->keybit);
> 
> Maybe:
> 
> for (i = 0; i < ARRAY_SIZE(sony_laptop_input_keycode_map); i++) {
> 	if (sony_laptop_input_keycode_map[i] != KEY_RESERVED) {
> 		input_set_capability(key_dev, EV_KEY,
> 				sony_laptop_input_keycode_map[i]);
> 	}
> }
> 
> would be better, as it means the driver doesn't poke into the inputdev
> struct innards directly?
> 

Given that you have to still poke there to set up open, close, name,
phys, id and so on and so forth I think the original is fine and that is
what most of keyboard-like drivers do.

The reason I came up with input_set_capability is because gpio-keys
wanted to set up siwtches and keys based on platform data so doing;

	for(...)
		input_set_capability(dev, pdata->type, pdata->code);

looked nice.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux