* [PATCH] HID: appletb-kbd: Use secs_to_jiffies() instead of msecs_to_jiffies()
@ 2025-04-07 8:29 Thorsten Blum
2025-04-08 7:52 ` Aditya Garg
2025-04-24 10:20 ` Jiri Kosina
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2025-04-07 8:29 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires; +Cc: Thorsten Blum, linux-input, linux-kernel
Use secs_to_jiffies() instead of msecs_to_jiffies() and avoid scaling
the module params 'appletb_tb_idle_timeout' and 'appletb_tb_dim_timeout'
to milliseconds. secs_to_jiffies() expands to simpler code and reduces
the size of 'hid-appletb-kbd.ko'.
Reformat the code to silence multiple checkpatch warnings.
No functional changes intended.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/hid/hid-appletb-kbd.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-appletb-kbd.c b/drivers/hid/hid-appletb-kbd.c
index d4b95aa3eecb..2f78db891cb9 100644
--- a/drivers/hid/hid-appletb-kbd.c
+++ b/drivers/hid/hid-appletb-kbd.c
@@ -172,7 +172,8 @@ static void appletb_inactivity_timer(struct timer_list *t)
if (!kbd->has_dimmed) {
backlight_device_set_brightness(kbd->backlight_dev, 1);
kbd->has_dimmed = true;
- mod_timer(&kbd->inactivity_timer, jiffies + msecs_to_jiffies(appletb_tb_idle_timeout * 1000));
+ mod_timer(&kbd->inactivity_timer,
+ jiffies + secs_to_jiffies(appletb_tb_idle_timeout));
} else if (!kbd->has_turned_off) {
backlight_device_set_brightness(kbd->backlight_dev, 0);
kbd->has_turned_off = true;
@@ -188,7 +189,8 @@ static void reset_inactivity_timer(struct appletb_kbd *kbd)
kbd->has_dimmed = false;
kbd->has_turned_off = false;
}
- mod_timer(&kbd->inactivity_timer, jiffies + msecs_to_jiffies(appletb_tb_dim_timeout * 1000));
+ mod_timer(&kbd->inactivity_timer,
+ jiffies + secs_to_jiffies(appletb_tb_dim_timeout));
}
}
@@ -407,7 +409,8 @@ static int appletb_kbd_probe(struct hid_device *hdev, const struct hid_device_id
} else {
backlight_device_set_brightness(kbd->backlight_dev, 2);
timer_setup(&kbd->inactivity_timer, appletb_inactivity_timer, 0);
- mod_timer(&kbd->inactivity_timer, jiffies + msecs_to_jiffies(appletb_tb_dim_timeout * 1000));
+ mod_timer(&kbd->inactivity_timer,
+ jiffies + secs_to_jiffies(appletb_tb_dim_timeout));
}
kbd->inp_handler.event = appletb_kbd_inp_event;
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] HID: appletb-kbd: Use secs_to_jiffies() instead of msecs_to_jiffies()
2025-04-07 8:29 [PATCH] HID: appletb-kbd: Use secs_to_jiffies() instead of msecs_to_jiffies() Thorsten Blum
@ 2025-04-08 7:52 ` Aditya Garg
2025-04-24 10:20 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Aditya Garg @ 2025-04-08 7:52 UTC (permalink / raw)
To: Thorsten Blum, Jiri Kosina, Benjamin Tissoires; +Cc: linux-input, linux-kernel
On 07/04/25 1:59 pm, Thorsten Blum wrote:
> Use secs_to_jiffies() instead of msecs_to_jiffies() and avoid scaling
> the module params 'appletb_tb_idle_timeout' and 'appletb_tb_dim_timeout'
> to milliseconds. secs_to_jiffies() expands to simpler code and reduces
> the size of 'hid-appletb-kbd.ko'.
>
> Reformat the code to silence multiple checkpatch warnings.
>
> No functional changes intended.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
LGTM
Reviewed-by: Aditya Garg <gargaditya08@live.com>
Tested-by: Aditya Garg <gargaditya08@live.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: appletb-kbd: Use secs_to_jiffies() instead of msecs_to_jiffies()
2025-04-07 8:29 [PATCH] HID: appletb-kbd: Use secs_to_jiffies() instead of msecs_to_jiffies() Thorsten Blum
2025-04-08 7:52 ` Aditya Garg
@ 2025-04-24 10:20 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2025-04-24 10:20 UTC (permalink / raw)
To: Thorsten Blum; +Cc: Benjamin Tissoires, linux-input, linux-kernel
On Mon, 7 Apr 2025, Thorsten Blum wrote:
> Use secs_to_jiffies() instead of msecs_to_jiffies() and avoid scaling
> the module params 'appletb_tb_idle_timeout' and 'appletb_tb_dim_timeout'
> to milliseconds. secs_to_jiffies() expands to simpler code and reduces
> the size of 'hid-appletb-kbd.ko'.
>
> Reformat the code to silence multiple checkpatch warnings.
>
> No functional changes intended.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-24 10:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 8:29 [PATCH] HID: appletb-kbd: Use secs_to_jiffies() instead of msecs_to_jiffies() Thorsten Blum
2025-04-08 7:52 ` Aditya Garg
2025-04-24 10:20 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox