Skip to content

Commit 230cdd8

Browse files
AdityaGarg8Jiri Kosina
authored andcommitted
HID: magicmouse: use secs_to_jiffies() for battery timeout
The kernel now has a secs_to_jiffies() function which expands to a simpler code than msecs_to_jiffies(). Use the same for battery timeout which was using 60000 milliseconds (60 seconds). Signed-off-by: Aditya Garg <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 6907c97 commit 230cdd8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/hid/hid-magicmouse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
6060
#define MOUSE_REPORT_ID 0x29
6161
#define MOUSE2_REPORT_ID 0x12
6262
#define DOUBLE_REPORT_ID 0xf7
63-
#define USB_BATTERY_TIMEOUT_MS 60000
63+
#define USB_BATTERY_TIMEOUT_SEC 60
6464

6565
/* These definitions are not precise, but they're close enough. (Bits
6666
* 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem
@@ -841,7 +841,7 @@ static void magicmouse_battery_timer_tick(struct timer_list *t)
841841

842842
if (magicmouse_fetch_battery(hdev) == 0) {
843843
mod_timer(&msc->battery_timer,
844-
jiffies + msecs_to_jiffies(USB_BATTERY_TIMEOUT_MS));
844+
jiffies + secs_to_jiffies(USB_BATTERY_TIMEOUT_SEC));
845845
}
846846
}
847847

@@ -881,7 +881,7 @@ static int magicmouse_probe(struct hid_device *hdev,
881881
is_usb_magictrackpad2(id->vendor, id->product)) {
882882
timer_setup(&msc->battery_timer, magicmouse_battery_timer_tick, 0);
883883
mod_timer(&msc->battery_timer,
884-
jiffies + msecs_to_jiffies(USB_BATTERY_TIMEOUT_MS));
884+
jiffies + secs_to_jiffies(USB_BATTERY_TIMEOUT_SEC));
885885
magicmouse_fetch_battery(hdev);
886886
}
887887

0 commit comments

Comments
 (0)