linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: dvhart@infradead.org
Cc: andy@infradead.org, platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, carlo@caione.org
Subject: [PATCH 1/9] platform/x86: hp-wmi: Cleanup local variable declarations
Date: Wed, 19 Apr 2017 19:25:13 -0700	[thread overview]
Message-ID: <ef8e0bbccb1402af3532d3abc684844eb602d5ba.1492654448.git.dvhart@infradead.org> (raw)
In-Reply-To: <cover.1492654448.git.dvhart@infradead.org>
In-Reply-To: <cover.1492654448.git.dvhart@infradead.org>

From: "Darren Hart (VMware)" <dvhart@infradead.org>

Declare like types on one line. Order declarations in decreasing length
where possible.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
---
 drivers/platform/x86/hp-wmi.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 5ca9328..e772105 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -346,15 +346,14 @@ static const struct rfkill_ops hp_wmi_rfkill_ops = {
 
 static bool hp_wmi_get_sw_state(enum hp_wmi_radio r)
 {
+	int mask = 0x200 << (r * 8);
 	int wireless = 0;
-	int mask;
+
 	hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0,
 			     &wireless, sizeof(wireless),
 			     sizeof(wireless));
 	/* TBD: Pass error */
 
-	mask = 0x200 << (r * 8);
-
 	if (wireless & mask)
 		return false;
 	else
@@ -363,15 +362,14 @@ static bool hp_wmi_get_sw_state(enum hp_wmi_radio r)
 
 static bool hp_wmi_get_hw_state(enum hp_wmi_radio r)
 {
+	int mask = 0x800 << (r * 8);
 	int wireless = 0;
-	int mask;
+
 	hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0,
 			     &wireless, sizeof(wireless),
 			     sizeof(wireless));
 	/* TBD: Pass error */
 
-	mask = 0x800 << (r * 8);
-
 	if (wireless & mask)
 		return false;
 	else
@@ -395,8 +393,8 @@ static const struct rfkill_ops hp_wmi_rfkill2_ops = {
 
 static int hp_wmi_rfkill2_refresh(void)
 {
-	int err, i;
 	struct bios_rfkill2_state state;
+	int err, i;
 
 	err = hp_wmi_perform_query(HPWMI_WIRELESS2_QUERY, 0, &state,
 				   0, sizeof(state));
@@ -502,9 +500,9 @@ static ssize_t set_als(struct device *dev, struct device_attribute *attr,
 static ssize_t set_postcode(struct device *dev, struct device_attribute *attr,
 		       const char *buf, size_t count)
 {
+	long unsigned int tmp2;
 	int ret;
 	u32 tmp;
-	long unsigned int tmp2;
 
 	ret = kstrtoul(buf, 10, &tmp2);
 	if (ret || tmp2 != 1)
@@ -530,11 +528,11 @@ static DEVICE_ATTR(postcode, S_IRUGO | S_IWUSR, show_postcode, set_postcode);
 static void hp_wmi_notify(u32 value, void *context)
 {
 	struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
-	union acpi_object *obj;
 	u32 event_id, event_data;
+	union acpi_object *obj;
 	int key_code = 0, ret;
-	u32 *location;
 	acpi_status status;
+	u32 *location;
 
 	status = wmi_get_event_data(value, &response);
 	if (status != AE_OK) {
@@ -645,8 +643,7 @@ static void hp_wmi_notify(u32 value, void *context)
 static int __init hp_wmi_input_setup(void)
 {
 	acpi_status status;
-	int err;
-	int val;
+	int err, val;
 
 	hp_wmi_input_dev = input_allocate_device();
 	if (!hp_wmi_input_dev)
@@ -719,8 +716,7 @@ static void cleanup_sysfs(struct platform_device *device)
 
 static int __init hp_wmi_rfkill_setup(struct platform_device *device)
 {
-	int err;
-	int wireless = 0;
+	int err, wireless = 0;
 
 	err = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, &wireless,
 				   sizeof(wireless), sizeof(wireless));
@@ -804,8 +800,9 @@ static int __init hp_wmi_rfkill_setup(struct platform_device *device)
 
 static int __init hp_wmi_rfkill2_setup(struct platform_device *device)
 {
-	int err, i;
 	struct bios_rfkill2_state state;
+	int err, i;
+
 	err = hp_wmi_perform_query(HPWMI_WIRELESS2_QUERY, 0, &state,
 				   0, sizeof(state));
 	if (err)
@@ -1002,9 +999,9 @@ static struct platform_driver hp_wmi_driver = {
 
 static int __init hp_wmi_init(void)
 {
-	int err;
 	int event_capable = wmi_has_guid(HPWMI_EVENT_GUID);
 	int bios_capable = wmi_has_guid(HPWMI_BIOS_GUID);
+	int err;
 
 	if (!bios_capable && !event_capable)
 		return -ENODEV;
-- 
2.9.3

  reply	other threads:[~2017-04-20  2:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20  2:25 [PATCH v1 0/9] platform/x86: hp-wmi: Driver refactoring and cleanups Darren Hart
2017-04-20  2:25 ` Darren Hart [this message]
2017-04-20  2:25 ` [PATCH 2/9] platform/x86: hp-wmi: Add bios_args initializer Darren Hart
2017-04-20  7:37   ` Andy Shevchenko
2017-04-20  2:25 ` [PATCH 3/9] platform/x86: hp-wmi: Standardize enum usage for constants Darren Hart
2017-04-20  7:19   ` Andy Shevchenko
2017-04-20 20:31   ` Darren Hart
2017-04-20  2:25 ` [PATCH 4/9] platform/x86: hp-wmi: Refactor redundant HPWMI_READ functions Darren Hart
2017-04-20  2:25 ` [PATCH 5/9] platform/x86: hp-wmi: Cleanup wireless get_(hw|sw)state functions Darren Hart
2017-04-20  2:25 ` [PATCH 6/9] platform/x86: hp-wmi: Refactor dock and tablet state fetchers Darren Hart
2017-04-20  2:25 ` [PATCH 7/9] platform/x86: hp-wmi: Use DEVICE_ATTR_(RO|RW) helper macros Darren Hart
2017-04-20  2:25 ` [PATCH 8/9] platform/x86: hp-wmi: Do not shadow errors in sysfs show functions Darren Hart
2017-04-20  2:25 ` [PATCH 9/9] platform/x86: hp-wmi: Cleanup exit paths Darren Hart
2017-04-20  7:38 ` [PATCH v1 0/9] platform/x86: hp-wmi: Driver refactoring and cleanups Andy Shevchenko
2017-04-20 20:19   ` Darren Hart
2017-04-20  9:06 ` Carlo Caione

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=ef8e0bbccb1402af3532d3abc684844eb602d5ba.1492654448.git.dvhart@infradead.org \
    --to=dvhart@infradead.org \
    --cc=andy@infradead.org \
    --cc=carlo@caione.org \
    --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;
as well as URLs for NNTP newsgroup(s).