HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static
PATCH 1/2 HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static
From: Aditya Garg <[email protected]>
This commit addresses the sparse warning flagged by the kernel test robot.
Reported-by kernel test robot <[email protected]>
Signed-off-by Aditya Garg <[email protected]>
--- drivers/hid/hid-appletb-kbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-appletb-kbd.c +2 -2
@@ -4,7 +4,7 @@* * Copyright (c) 2017-2018 Ronald Tschalär * Copyright (c) 2022-2023 Kerem Karabay <[email protected]> -* Copyright (c) 2024 Aditya Garg <[email protected]> +* Copyright (c) 2024-2025 Aditya Garg <[email protected]> */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt
@@ -143,7 +143,7 @@ static ssize_t mode_store(struct device *dev, }static DEVICE_ATTR_RW (mode); -struct attribute *appletb_kbd_attrs[] = { +static struct attribute *appletb_kbd_attrs[] = { &dev_attr_mode.attr,NULL };
Signature · 1 line
2.43.0
PATCH 2/2 HID: hid-appletb-bl: use appletb_bl_brightness_map instead of magic numbers to set default brightness
From: Aditya Garg <[email protected]>
This commit makes use of appletb_bl_brightness_map instead of using if statements and magic numbers to set default brightness, and thus simplifies the code.
Signed-off-by Aditya Garg <[email protected]>
--- drivers/hid/hid-appletb-bl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/hid/hid-appletb-bl.c +2 -6
@@ -141,12 +141,8 @@ static int appletb_bl_probe(struct hid_device *hdev, const struct hid_device_id bl->aux1_field = aux1_field; bl->brightness_field = brightness_field; -if (appletb_bl_def_brightness ==0 ) - ret =appletb_bl_set_brightness (bl,APPLETB_BL_OFF ); -else if (appletb_bl_def_brightness ==1 ) - ret =appletb_bl_set_brightness (bl,APPLETB_BL_DIM ); -else - ret =appletb_bl_set_brightness (bl,APPLETB_BL_ON ); + ret =appletb_bl_set_brightness (bl, + appletb_bl_brightness_map[(appletb_bl_def_brightness >2 ) ?2 : appletb_bl_def_brightness]);if (ret) {dev_err_probe (dev, ret,"Failed to set touch bar brightness to off\n" );
Signature · 1 line
2.43.0
Jiri Kosina
maintainerBoth paches now queued in hid.git#for-6.15/apple, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs