mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michał Kępień" <kernel@kempniu.pl>
To: Jonathan Woithe <jwoithe@just42.net>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 05/10] platform/x86: fujitsu-laptop: replace numeric values with constants
Date: Wed,  8 Feb 2017 14:46:28 +0100	[thread overview]
Message-ID: <20170208134633.5152-6-kernel@kempniu.pl> (raw)
In-Reply-To: <20170208134633.5152-1-kernel@kempniu.pl>

From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>

Replace three repeating numeric values with constants to improve code
clarity.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
 drivers/platform/x86/fujitsu-laptop.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 55d696262301..deef40a03b6d 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -97,6 +97,11 @@
 /* FUNC interface - responses */
 #define UNSUPPORTED_CMD 0x80000000
 
+/* FUNC interface - status flags */
+#define FLAG_RFKILL	0x020
+#define FLAG_LID	0x100
+#define FLAG_DOCK	0x200
+
 #if IS_ENABLED(CONFIG_LEDS_CLASS)
 /* FUNC interface - LED control */
 #define FUNC_LED_OFF	0x1
@@ -567,9 +572,9 @@ static ssize_t
 show_lid_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (!(fujitsu_laptop->flags_supported & 0x100))
+	if (!(fujitsu_laptop->flags_supported & FLAG_LID))
 		return sprintf(buf, "unknown\n");
-	if (fujitsu_laptop->flags_state & 0x100)
+	if (fujitsu_laptop->flags_state & FLAG_LID)
 		return sprintf(buf, "open\n");
 	else
 		return sprintf(buf, "closed\n");
@@ -579,9 +584,9 @@ static ssize_t
 show_dock_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (!(fujitsu_laptop->flags_supported & 0x200))
+	if (!(fujitsu_laptop->flags_supported & FLAG_DOCK))
 		return sprintf(buf, "unknown\n");
-	if (fujitsu_laptop->flags_state & 0x200)
+	if (fujitsu_laptop->flags_state & FLAG_DOCK)
 		return sprintf(buf, "docked\n");
 	else
 		return sprintf(buf, "undocked\n");
@@ -591,9 +596,9 @@ static ssize_t
 show_radios_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (!(fujitsu_laptop->flags_supported & 0x20))
+	if (!(fujitsu_laptop->flags_supported & FLAG_RFKILL))
 		return sprintf(buf, "unknown\n");
-	if (fujitsu_laptop->flags_state & 0x20)
+	if (fujitsu_laptop->flags_state & FLAG_RFKILL)
 		return sprintf(buf, "on\n");
 	else
 		return sprintf(buf, "killed\n");
-- 
2.11.1

  parent reply	other threads:[~2017-02-08 14:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 13:46 [PATCH 00/10] fujitsu-laptop: renames and cleanups Michał Kępień
2017-02-08 13:46 ` [PATCH 01/10] platform/x86: fujitsu-laptop: clearly denote backlight-related symbols Michał Kępień
2017-02-08 13:46 ` [PATCH 02/10] platform/x86: fujitsu-laptop: replace "hotkey" with "laptop" in symbol names Michał Kępień
2017-02-08 13:46 ` [PATCH 03/10] platform/x86: fujitsu-laptop: make platform-related variables match naming convention Michał Kępień
2017-02-08 13:46 ` [PATCH 04/10] platform/x86: fujitsu-laptop: rename FUNC_RFKILL to FUNC_FLAGS Michał Kępień
2017-02-08 13:46 ` Michał Kępień [this message]
2017-02-08 13:46 ` [PATCH 06/10] platform/x86: fujitsu-laptop: remove redundant forward declarations Michał Kępień
2017-02-08 13:46 ` [PATCH 07/10] platform/x86: fujitsu-laptop: simplify acpi_bus_register_driver() error handling Michał Kępień
2017-02-08 13:46 ` [PATCH 08/10] platform/x86: fujitsu-laptop: only register backlight device if FUJ02B1 is present Michał Kępień
2017-02-13  2:40   ` [lkp-robot] [platform/x86] b925ff7dcd: BUG:unable_to_handle_kernel kernel test robot
2017-02-13  4:34     ` Jonathan Woithe
2017-02-13  8:14       ` Michał Kępień
2017-02-13 12:26         ` Jonathan Woithe
2017-02-08 13:46 ` [PATCH 09/10] platform/x86: fujitsu-laptop: autodetect LCD interface on all models Michał Kępień
2017-02-08 13:46 ` [PATCH 10/10] platform/x86: fujitsu-laptop: remove redundant MODULE_ALIAS entries Michał Kępień
2017-02-08 15:24 ` [PATCH 00/10] fujitsu-laptop: renames and cleanups Andy Shevchenko
2017-02-09  1:36   ` Darren Hart
2017-02-09  1:46     ` Andy Shevchenko
2017-02-09  6:57   ` Michał Kępień
2017-02-08 22:52 ` Jonathan Woithe
2017-02-09  7:29   ` Michał Kępień
2017-02-10  0:16 ` Jonathan Woithe
2017-02-10  0:42   ` Andy Shevchenko
2017-02-17  2:57     ` Darren Hart
2017-02-17  3:08       ` Jonathan Woithe
2017-02-17  3:53         ` Darren Hart
2017-02-17  4:17           ` Jonathan Woithe
2017-02-17  5:23             ` Darren Hart
2017-02-24 20:34             ` Andy Shevchenko
2017-02-26 11:30               ` Michał Kępień
2017-02-26 15:03                 ` Andy Shevchenko
2017-02-17  7:14           ` Michał Kępień
2017-02-24 22:13             ` Darren Hart

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=20170208134633.5152-6-kernel@kempniu.pl \
    --to=kernel@kempniu.pl \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=jwoithe@just42.net \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®