[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210726091719.47886-2-jose.exposito89@gmail.com>
Date: Mon, 26 Jul 2021 11:17:19 +0200
From: José Expósito <jose.exposito89@...il.com>
To: jikos@...nel.org
Cc: benjamin.tissoires@...hat.com, rydberg@...math.org,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
José Expósito <jose.exposito89@...il.com>
Subject: [PATCH -next 2/2] HID: magicmouse: fix code style warnings
Fix warnings reported by checkpatch in hid-magicmouse.c:
hid-magicmouse.c:39: WARNING: Missing a blank line after declarations
hid-magicmouse.c:79: WARNING: Block comments use a trailing */ on a
separate line
hid-magicmouse.c:156: WARNING: Missing a blank line after declarations
hid-magicmouse.c:190: WARNING: Missing a blank line after declarations
hid-magicmouse.c:505: WARNING: Missing a blank line after declarations
hid-magicmouse.c:756: WARNING: Possible unnecessary 'out of memory'
message
hid-magicmouse.c:825: WARNING: braces {} are not necessary for single
statement blocks
Ignore the following warning because, in this case, the else statement
is useful:
hid-magicmouse.c:161: WARNING: else is not generally useful after a
break or return
Signed-off-by: José Expósito <jose.exposito89@...il.com>
---
drivers/hid/hid-magicmouse.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 3c911c97fe57..6fda883e23fb 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -36,6 +36,7 @@ static int param_set_scroll_speed(const char *val,
const struct kernel_param *kp)
{
unsigned long speed;
+
if (!val || kstrtoul(val, 0, &speed) || speed > 63)
return -EINVAL;
scroll_speed = speed;
@@ -76,7 +77,8 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
#define SCROLL_ACCEL_DEFAULT 7
/* Touch surface information. Dimension is in hundredths of a mm, min and max
- * are in units. */
+ * are in units.
+ */
#define MOUSE_DIMENSION_X ((float)9056)
#define MOUSE_MIN_X -1100
#define MOUSE_MAX_X 1258
@@ -153,6 +155,7 @@ static int magicmouse_firm_touch(struct magicmouse_sc *msc)
*/
for (ii = 0; ii < msc->ntouches; ii++) {
int idx = msc->tracking_ids[ii];
+
if (msc->touches[idx].size < 8) {
/* Ignore this touch. */
} else if (touch >= 0) {
@@ -503,6 +506,7 @@ static int magicmouse_event(struct hid_device *hdev, struct hid_field *field,
struct hid_usage *usage, __s32 value)
{
struct magicmouse_sc *msc = hid_get_drvdata(hdev);
+
if (msc->input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE2 &&
field->report->id == MOUSE2_REPORT_ID) {
/*
@@ -753,10 +757,8 @@ static int magicmouse_probe(struct hid_device *hdev,
return -ENODEV;
msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL);
- if (msc == NULL) {
- hid_err(hdev, "can't alloc magicmouse descriptor\n");
+ if (msc == NULL)
return -ENOMEM;
- }
msc->scroll_accel = SCROLL_ACCEL_DEFAULT;
msc->hdev = hdev;
@@ -823,9 +825,8 @@ static int magicmouse_probe(struct hid_device *hdev,
hid_err(hdev, "unable to request touch data (%d)\n", ret);
goto err_stop_hw;
}
- if (ret == -EIO && id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE2) {
+ if (ret == -EIO && id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE2)
schedule_delayed_work(&msc->work, msecs_to_jiffies(500));
- }
return 0;
err_stop_hw:
--
2.25.1
Powered by blists - more mailing lists