From: "Pali Rohár" <pali.rohar@gmail.com>
To: "Michał Kępień" <kernel@kempniu.pl>
Cc: Darren Hart <dvhart@infradead.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Gabriele Mazzotta <gabriele.mzt@gmail.com>,
Mario Limonciello <mario_limonciello@dell.com>,
Andy Lutomirski <luto@kernel.org>,
Alex Hung <alex.hung@canonical.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] dell-wmi: Rework code for generating sparse keymap and processing WMI events
Date: Thu, 9 Jun 2016 13:33:48 +0200 [thread overview]
Message-ID: <201606091333.49010@pali> (raw)
In-Reply-To: <20160609112721.GA2461@eudyptula.hq.kempniu.pl>
[-- Attachment #1: Type: Text/Plain, Size: 2349 bytes --]
On Thursday 09 June 2016 13:27:21 Michał Kępień wrote:
> > > - case 0x10:
> > > - /* Keys pressed */
> > > + case 0x0010:
> > > + /* Sequence of keys pressed */
> > >
> > > for (i = 2; i < len; ++i)
> > >
> > > - dell_wmi_process_key(buffer_entry[i]);
> > > + dell_wmi_process_key(0x0010, buffer_entry[i]);
> > >
> > > break;
> > >
> > > - case 0x11:
> > > - for (i = 2; i < len; ++i) {
> > > - switch (buffer_entry[i]) {
> > > - case 0xfff0:
> > > - /* Battery unplugged */
> > > - pr_debug("Battery unplugged\n");
> > > - break;
> > > - case 0xfff1:
> > > - /* Battery inserted */
> > > - pr_debug("Battery inserted\n");
> > > - break;
> > > - case 0x01e1:
> > > - case 0x02ea:
> > > - case 0x02eb:
> > > - case 0x02ec:
> > > - case 0x02f6:
> > > - /* Keyboard backlight level changed */
> > > - pr_debug("Keyboard backlight level "
> > > - "changed\n");
> > > - break;
> > > - default:
> > > - /* Unknown event */
> > > - pr_info("Unknown WMI event type 0x11: "
> > > - "0x%x\n", (int)buffer_entry[i]);
> > > - break;
> > > - }
> > > - }
> > > + case 0x0011:
> > > + /* Sequence of events occurred */
> > > + for (i = 2; i < len; ++i)
> > > + dell_wmi_process_key(0x0011, buffer_entry[i]);
> >
> > Since this is identical to case 0x010, let's avoid the duplication
> > of code and
> >
> > handle this with a fall-through, like:
> > case 0x0010:
> > case 0x0011:
> > /* Sequence of events occurred */
> > for (i = 2; i < len; ++i)
> >
> > dell_wmi_process_key(buffer_entry[1], buffer_entry[i]);
>
> I believe it was Pali's intention to make a distinction between keys
> being pressed (0x0010) and other events occuring (0x0011), so perhaps
> a comment after the first case label could be useful?
>
> case 0x0010:
> /* Sequence of keys pressed; fall through */
> case 0x0011:
> /* Sequence of events occurred */
> for (i = 2; i < len; ++i)
> dell_wmi_process_key(buffer_entry[1], buffer_entry[i]);
>
> I'll leave it to Pali to decide, I'm just throwing in my two cents.
Yes, that is truth, to visually distinguish between events and keys.
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2016-06-09 11:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 23:32 [PATCH v2 0/4] dell-wmi: Changes in WMI event code handling Pali Rohár
2016-06-07 23:32 ` [PATCH v2 1/4] dell-wmi: Ignore WMI event code 0xe045 Pali Rohár
2016-06-07 23:32 ` [PATCH v2 2/4] dell-wmi: Sort WMI event codes and update comments Pali Rohár
2016-06-07 23:32 ` [PATCH v2 3/4] dell-wmi: Add information about other WMI event codes Pali Rohár
2016-06-07 23:32 ` [PATCH v2 4/4] dell-wmi: Rework code for generating sparse keymap and processing WMI events Pali Rohár
2016-06-08 22:50 ` Darren Hart
2016-06-09 11:27 ` Michał Kępień
2016-06-09 11:33 ` Pali Rohár [this message]
2016-06-09 19:59 ` Darren Hart
2016-06-09 11:57 ` [PATCH v2 0/4] dell-wmi: Changes in WMI event code handling Michał Kępień
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=201606091333.49010@pali \
--to=pali.rohar@gmail.com \
--cc=alex.hung@canonical.com \
--cc=dvhart@infradead.org \
--cc=gabriele.mzt@gmail.com \
--cc=kernel@kempniu.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mario_limonciello@dell.com \
--cc=mjg59@srcf.ucam.org \
--cc=platform-driver-x86@vger.kernel.org \
/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).