X86 platform drivers
 help / color / mirror / Atom feed
From: Xiang Shen <turyshen@gmail.com>
To: acelan.kao@canonical.com, hansg@kernel.org,
	ilpo.jarvinen@linux.intel.com,
	platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Xiang Shen <turyshen@gmail.com>
Subject: [PATCH] platform/x86: intel-vbtn: Fix code style issues
Date: Fri, 20 Jun 2025 10:38:49 +1000	[thread overview]
Message-ID: <20250620003849.54442-1-turyshen@gmail.com> (raw)

Fix checkpatch code style errors:

ERROR: do not use assignment in if condition
+	if ((ke = sparse_keymap_entry_from_scancode(priv->buttons_dev, event))) {

ERROR: do not use assignment in if condition
+	} else if ((ke = sparse_keymap_entry_from_scancode(priv->switches_dev, event))) {

Signed-off-by: Xiang Shen <turyshen@gmail.com>
---
 drivers/platform/x86/intel/vbtn.c | 38 +++++++++++++++++--------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/platform/x86/intel/vbtn.c b/drivers/platform/x86/intel/vbtn.c
index 232cd12e3c9f..bcc97b06844e 100644
--- a/drivers/platform/x86/intel/vbtn.c
+++ b/drivers/platform/x86/intel/vbtn.c
@@ -160,30 +160,34 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
 
 	guard(mutex)(&priv->mutex);
 
-	if ((ke = sparse_keymap_entry_from_scancode(priv->buttons_dev, event))) {
+	ke = sparse_keymap_entry_from_scancode(priv->buttons_dev, event);
+	if (ke) {
 		if (!priv->has_buttons) {
 			dev_warn(&device->dev, "Warning: received 0x%02x button event on a device without buttons, please report this.\n",
 				 event);
 			return;
 		}
 		input_dev = priv->buttons_dev;
-	} else if ((ke = sparse_keymap_entry_from_scancode(priv->switches_dev, event))) {
-		if (!priv->has_switches) {
-			/* See dual_accel_detect.h for more info */
-			if (priv->dual_accel)
-				return;
-
-			dev_info(&device->dev, "Registering Intel Virtual Switches input-dev after receiving a switch event\n");
-			ret = input_register_device(priv->switches_dev);
-			if (ret)
-				return;
-
-			priv->has_switches = true;
-		}
-		input_dev = priv->switches_dev;
 	} else {
-		dev_dbg(&device->dev, "unknown event index 0x%x\n", event);
-		return;
+		ke = sparse_keymap_entry_from_scancode(priv->switches_dev, event);
+		if (ke) {
+			if (!priv->has_switches) {
+				/* See dual_accel_detect.h for more info */
+				if (priv->dual_accel)
+					return;
+
+				dev_info(&device->dev, "Registering Intel Virtual Switches input-dev after receiving a switch event\n");
+				ret = input_register_device(priv->switches_dev);
+				if (ret)
+					return;
+
+				priv->has_switches = true;
+			}
+			input_dev = priv->switches_dev;
+		} else {
+			dev_dbg(&device->dev, "unknown event index 0x%x\n", event);
+			return;
+		}
 	}
 
 	if (priv->wakeup_mode) {
-- 
2.46.0


             reply	other threads:[~2025-06-20  0:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20  0:38 Xiang Shen [this message]
2025-06-20 10:00 ` [PATCH] platform/x86: intel-vbtn: Fix code style issues Hans de Goede
2025-06-22  6:48   ` Xiang Shen
2025-06-24 10:35     ` Ilpo Järvinen
2025-06-25  9:58       ` Xiang Shen
2025-06-25 12:25         ` Ilpo Järvinen
2025-06-26  8:09           ` Xiang Shen

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=20250620003849.54442-1-turyshen@gmail.com \
    --to=turyshen@gmail.com \
    --cc=acelan.kao@canonical.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --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