* [PATCH 1/2] HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static
@ 2025-02-09 7:26 Aditya Garg
2025-02-09 7:27 ` [PATCH 2/2] HID: hid-appletb-bl: use appletb_bl_brightness_map instead of magic numbers to set default brightness Aditya Garg
2025-02-10 7:24 ` [PATCH 1/2] HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static Jiri Kosina
0 siblings, 2 replies; 3+ messages in thread
From: Aditya Garg @ 2025-02-09 7:26 UTC (permalink / raw)
To: Jiri Kosina, jkosina, Benjamin Tissoires, bentiss
Cc: Orlando Chamberlain, Kerem Karabay, linux-input,
Linux Kernel Mailing List
From: Aditya Garg <gargaditya08@live.com>
This commit addresses the sparse warning flagged by the kernel test robot.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502091105.ZsLoBSIh-lkp@intel.com/
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/hid/hid-appletb-kbd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-appletb-kbd.c b/drivers/hid/hid-appletb-kbd.c
index fa28a691d..38fc0e58c 100644
--- a/drivers/hid/hid-appletb-kbd.c
+++ b/drivers/hid/hid-appletb-kbd.c
@@ -4,7 +4,7 @@
*
* Copyright (c) 2017-2018 Ronald Tschalär
* Copyright (c) 2022-2023 Kerem Karabay <kekrby@gmail.com>
- * Copyright (c) 2024 Aditya Garg <gargaditya08@live.com>
+ * Copyright (c) 2024-2025 Aditya Garg <gargaditya08@live.com>
*/
#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
};
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] HID: hid-appletb-bl: use appletb_bl_brightness_map instead of magic numbers to set default brightness
2025-02-09 7:26 [PATCH 1/2] HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static Aditya Garg
@ 2025-02-09 7:27 ` Aditya Garg
2025-02-10 7:24 ` [PATCH 1/2] HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Aditya Garg @ 2025-02-09 7:27 UTC (permalink / raw)
To: Jiri Kosina, jkosina, Benjamin Tissoires, bentiss
Cc: Orlando Chamberlain, Kerem Karabay, linux-input,
Linux Kernel Mailing List
From: Aditya Garg <gargaditya08@live.com>
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 <gargaditya08@live.com>
---
drivers/hid/hid-appletb-bl.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/hid/hid-appletb-bl.c b/drivers/hid/hid-appletb-bl.c
index 819157686..1a3dcd44b 100644
--- a/drivers/hid/hid-appletb-bl.c
+++ b/drivers/hid/hid-appletb-bl.c
@@ -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");
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static
2025-02-09 7:26 [PATCH 1/2] HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static Aditya Garg
2025-02-09 7:27 ` [PATCH 2/2] HID: hid-appletb-bl: use appletb_bl_brightness_map instead of magic numbers to set default brightness Aditya Garg
@ 2025-02-10 7:24 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2025-02-10 7:24 UTC (permalink / raw)
To: Aditya Garg
Cc: Benjamin Tissoires, bentiss, Orlando Chamberlain, Kerem Karabay,
linux-input, Linux Kernel Mailing List
Both paches now queued in hid.git#for-6.15/apple, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-10 7:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-09 7:26 [PATCH 1/2] HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static Aditya Garg
2025-02-09 7:27 ` [PATCH 2/2] HID: hid-appletb-bl: use appletb_bl_brightness_map instead of magic numbers to set default brightness Aditya Garg
2025-02-10 7:24 ` [PATCH 1/2] HID: hid-appletb-kbd: make struct attribute *appletb_kbd_attrs[] static Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®