From: "José Expósito" <jose.exposito89@gmail.com>
To: jikos@kernel.org
Cc: benjamin.tissoires@redhat.com, rydberg@bitmath.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
"José Expósito" <jose.exposito89@gmail.com>
Subject: [PATCH -next 1/2] HID: magicmouse: fix code style errors
Date: Mon, 26 Jul 2021 11:17:18 +0200 [thread overview]
Message-ID: <20210726091719.47886-1-jose.exposito89@gmail.com> (raw)
Fix errors reported by checkpatch in hid-magicmouse.c:
hid-magicmouse.c:35: ERROR: open brace '{' following function
definitions go on the next line
hid-magicmouse.c:46: ERROR: do not initialise statics to false
hid-magicmouse.c:79: ERROR: Macros with complex values should be
enclosed in parentheses
hid-magicmouse.c:83: ERROR: Macros with complex values should be
enclosed in parentheses
hid-magicmouse.c:88: ERROR: Macros with complex values should be
enclosed in parentheses
hid-magicmouse.c:93: ERROR: Macros with complex values should be
enclosed in parentheses
hid-magicmouse.c:99: ERROR: Macros with complex values should be
enclosed in parentheses
hid-magicmouse.c:104: ERROR: Macros with complex values should be
enclosed in parentheses
hid-magicmouse.c:185: ERROR: do not use assignment in if condition
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/hid/hid-magicmouse.c | 37 ++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 686788ebf3e1..3c911c97fe57 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -33,7 +33,8 @@ MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel");
static unsigned int scroll_speed = 32;
static int param_set_scroll_speed(const char *val,
- const struct kernel_param *kp) {
+ const struct kernel_param *kp)
+{
unsigned long speed;
if (!val || kstrtoul(val, 0, &speed) || speed > 63)
return -EINVAL;
@@ -43,7 +44,7 @@ static int param_set_scroll_speed(const char *val,
module_param_call(scroll_speed, param_set_scroll_speed, param_get_uint, &scroll_speed, 0644);
MODULE_PARM_DESC(scroll_speed, "Scroll speed, value from 0 (slow) to 63 (fast)");
-static bool scroll_acceleration = false;
+static bool scroll_acceleration;
module_param(scroll_acceleration, bool, 0644);
MODULE_PARM_DESC(scroll_acceleration, "Accelerate sequential scroll events");
@@ -76,32 +77,32 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
/* Touch surface information. Dimension is in hundredths of a mm, min and max
* are in units. */
-#define MOUSE_DIMENSION_X (float)9056
+#define MOUSE_DIMENSION_X ((float)9056)
#define MOUSE_MIN_X -1100
#define MOUSE_MAX_X 1258
#define MOUSE_RES_X ((MOUSE_MAX_X - MOUSE_MIN_X) / (MOUSE_DIMENSION_X / 100))
-#define MOUSE_DIMENSION_Y (float)5152
+#define MOUSE_DIMENSION_Y ((float)5152)
#define MOUSE_MIN_Y -1589
#define MOUSE_MAX_Y 2047
#define MOUSE_RES_Y ((MOUSE_MAX_Y - MOUSE_MIN_Y) / (MOUSE_DIMENSION_Y / 100))
-#define TRACKPAD_DIMENSION_X (float)13000
+#define TRACKPAD_DIMENSION_X ((float)13000)
#define TRACKPAD_MIN_X -2909
#define TRACKPAD_MAX_X 3167
#define TRACKPAD_RES_X \
((TRACKPAD_MAX_X - TRACKPAD_MIN_X) / (TRACKPAD_DIMENSION_X / 100))
-#define TRACKPAD_DIMENSION_Y (float)11000
+#define TRACKPAD_DIMENSION_Y ((float)11000)
#define TRACKPAD_MIN_Y -2456
#define TRACKPAD_MAX_Y 2565
#define TRACKPAD_RES_Y \
((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
-#define TRACKPAD2_DIMENSION_X (float)16000
+#define TRACKPAD2_DIMENSION_X ((float)16000)
#define TRACKPAD2_MIN_X -3678
#define TRACKPAD2_MAX_X 3934
#define TRACKPAD2_RES_X \
((TRACKPAD2_MAX_X - TRACKPAD2_MIN_X) / (TRACKPAD2_DIMENSION_X / 100))
-#define TRACKPAD2_DIMENSION_Y (float)11490
+#define TRACKPAD2_DIMENSION_Y ((float)11490)
#define TRACKPAD2_MIN_Y -2478
#define TRACKPAD2_MAX_Y 2587
#define TRACKPAD2_RES_Y \
@@ -182,14 +183,18 @@ static void magicmouse_emit_buttons(struct magicmouse_sc *msc, int state)
/* The button was released. */
} else if (last_state != 0) {
state = last_state;
- } else if ((id = magicmouse_firm_touch(msc)) >= 0) {
- int x = msc->touches[id].x;
- if (x < middle_button_start)
- state = 1;
- else if (x > middle_button_stop)
- state = 2;
- else
- state = 4;
+ } else {
+ id = magicmouse_firm_touch(msc);
+ if (id >= 0) {
+ int x = msc->touches[id].x;
+
+ if (x < middle_button_start)
+ state = 1;
+ else if (x > middle_button_stop)
+ state = 2;
+ else
+ state = 4;
+ }
} /* else: we keep the mouse's guess */
input_report_key(msc->input, BTN_MIDDLE, state & 4);
--
2.25.1
next reply other threads:[~2021-07-26 9:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 9:17 José Expósito [this message]
2021-07-26 9:17 ` [PATCH -next 2/2] HID: magicmouse: fix code style warnings José Expósito
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=20210726091719.47886-1-jose.exposito89@gmail.com \
--to=jose.exposito89@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rydberg@bitmath.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.