Re: [PATCH 2/7] platform/x86: panasonic-laptop: de-obfuscate button codes

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

 



On Fri, Jun 24, 2022 at 01:23:35PM +0200, Hans de Goede wrote:
> From: Stefan Seyfried <seife+kernel@xxxxxxxxxxxxxx>
> 
> In the definition of panasonic_keymap[] the key codes are given in
> decimal, later checks are done with hexadecimal values, which does
> not help in understanding the code.
> Additionally use two helper variables to shorten the code and make
> the logic more obvious.

(Note, all comments are up to you, I understand that this is a fix and maybe
 better to make code neat in a separate change)

...

>  	struct input_dev *hotk_input_dev = pcc->input_dev;
>  	int rc;
>  	unsigned long long result;
> +	unsigned int key;
> +	unsigned int updown;

Perhaps make them more like reversed xmas tree order?

...

>  			sparse_keymap_report_event(hotk_input_dev,
> -					result & 0xf, 0x80, false);
> +					key, 0x80, false);

Maybe move one or more parameters to the previous line?

...

>  		if (!sparse_keymap_report_event(hotk_input_dev,
> -						result & 0xf, result & 0x80, false))
> +						key, updown, false))
>  			pr_err("Unknown hotkey event: 0x%04llx\n", result);

Ditto.

Although I would even go for

	rc = sparse_...;
	if (!rc)
		pr_err(...);


pattern.

-- 
With Best Regards,
Andy Shevchenko





[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