Skip to content

Commit 6907c97

Browse files
AdityaGarg8Jiri Kosina
authored andcommitted
HID: apple: 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 9bdc30e commit 6907c97

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/hid/hid-apple.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#define APPLE_FLAG_FKEY 0x01
4747

4848
#define HID_COUNTRY_INTERNATIONAL_ISO 13
49-
#define APPLE_BATTERY_TIMEOUT_MS 60000
49+
#define APPLE_BATTERY_TIMEOUT_SEC 60
5050

5151
#define HID_USAGE_MAGIC_BL 0xff00000f
5252
#define APPLE_MAGIC_REPORT_ID_POWER 3
@@ -619,7 +619,7 @@ static void apple_battery_timer_tick(struct timer_list *t)
619619

620620
if (apple_fetch_battery(hdev) == 0) {
621621
mod_timer(&asc->battery_timer,
622-
jiffies + msecs_to_jiffies(APPLE_BATTERY_TIMEOUT_MS));
622+
jiffies + secs_to_jiffies(APPLE_BATTERY_TIMEOUT_SEC));
623623
}
624624
}
625625

@@ -936,7 +936,7 @@ static int apple_probe(struct hid_device *hdev,
936936
if (quirks & APPLE_RDESC_BATTERY) {
937937
timer_setup(&asc->battery_timer, apple_battery_timer_tick, 0);
938938
mod_timer(&asc->battery_timer,
939-
jiffies + msecs_to_jiffies(APPLE_BATTERY_TIMEOUT_MS));
939+
jiffies + secs_to_jiffies(APPLE_BATTERY_TIMEOUT_SEC));
940940
apple_fetch_battery(hdev);
941941
}
942942

0 commit comments

Comments
 (0)