X86 platform drivers
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
	Mark Gross <markgross@kernel.org>,
	Andy Shevchenko <andy@kernel.org>, Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org,
	Stefan Seyfried <stefan.seyfried@googlemail.com>,
	Kenneth Chan <kenneth.t.chan@gmail.com>,
	platform-driver-x86@vger.kernel.org,
	Stefan Seyfried <seife+kernel@b1-systems.com>
Subject: Re: [PATCH 2/7] platform/x86: panasonic-laptop: de-obfuscate button codes
Date: Tue, 28 Jun 2022 13:29:42 +0300	[thread overview]
Message-ID: <YrrYFgu17uC+bMxo@smile.fi.intel.com> (raw)
In-Reply-To: <20220624112340.10130-3-hdegoede@redhat.com>

On Fri, Jun 24, 2022 at 01:23:35PM +0200, Hans de Goede wrote:
> From: Stefan Seyfried <seife+kernel@b1-systems.com>
> 
> 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



  reply	other threads:[~2022-06-28 10:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 11:23 [PATCH 0/7] ACPI: video / platform/x86: Fix Panasonic laptop missing keypresses Hans de Goede
2022-06-24 11:23 ` [PATCH 1/7] ACPI: video: Change how we determine if brightness key-presses are handled Hans de Goede
2022-06-25 13:43   ` Rafael J. Wysocki
2022-06-28 10:24   ` Andy Shevchenko
2022-06-24 11:23 ` [PATCH 2/7] platform/x86: panasonic-laptop: de-obfuscate button codes Hans de Goede
2022-06-28 10:29   ` Andy Shevchenko [this message]
2022-06-24 11:23 ` [PATCH 3/7] platform/x86: panasonic-laptop: sort includes alphabetically Hans de Goede
2022-06-24 11:23 ` [PATCH 4/7] platform/x86: panasonic-laptop: revert "Resolve hotkey double trigger bug" Hans de Goede
2022-06-24 11:23 ` [PATCH 5/7] platform/x86: panasonic-laptop: don't report duplicate brightness key-presses Hans de Goede
2022-06-24 11:23 ` [PATCH 6/7] platform/x86: panasonic-laptop: filter out duplicate volume up/down/mute keypresses Hans de Goede
2022-06-28 10:34   ` Andy Shevchenko
2022-06-24 11:23 ` [PATCH 7/7] platform/x86: panasonic-laptop: Use acpi_video_get_backlight_type() Hans de Goede
2022-06-24 19:49 ` [PATCH 0/7] ACPI: video / platform/x86: Fix Panasonic laptop missing keypresses Stefan Seyfried
2022-06-26  6:58   ` Kenneth Chan
2022-06-28 20:09     ` Hans de Goede
2022-06-28 10:35 ` Andy Shevchenko
2022-06-28 20:02 ` Hans de Goede

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=YrrYFgu17uC+bMxo@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=kenneth.t.chan@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=seife+kernel@b1-systems.com \
    --cc=stefan.seyfried@googlemail.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