Skip to content

Commit 1e5c229

Browse files
jwrdegoedeJiri Kosina
authored andcommitted
HID: lg-g15: Make the LED-name used by lg_g15_register_led() a parameter
Make the LED-name used by lg_g15_register_led() a parameter. This is a preparation patch for adding support for the LCD menu keys + LCD brightness control on the Logitech Z-10 speakers (with LCD) which use the same protocol as the G15 keyboards. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 614d34f commit 1e5c229

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

drivers/hid/hid-lg-g15.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -652,19 +652,10 @@ static void lg_g15_input_close(struct input_dev *dev)
652652
hid_hw_close(hdev);
653653
}
654654

655-
static int lg_g15_register_led(struct lg_g15_data *g15, int i)
655+
static int lg_g15_register_led(struct lg_g15_data *g15, int i, const char *name)
656656
{
657-
static const char * const led_names[] = {
658-
"g15::kbd_backlight",
659-
"g15::lcd_backlight",
660-
"g15::macro_preset1",
661-
"g15::macro_preset2",
662-
"g15::macro_preset3",
663-
"g15::macro_record",
664-
};
665-
666657
g15->leds[i].led = i;
667-
g15->leds[i].cdev.name = led_names[i];
658+
g15->leds[i].cdev.name = name;
668659

669660
switch (g15->model) {
670661
case LG_G15:
@@ -733,6 +724,14 @@ static void lg_g15_init_input_dev(struct hid_device *hdev, struct input_dev *inp
733724

734725
static int lg_g15_probe(struct hid_device *hdev, const struct hid_device_id *id)
735726
{
727+
static const char * const led_names[] = {
728+
"g15::kbd_backlight",
729+
"g15::lcd_backlight",
730+
"g15::macro_preset1",
731+
"g15::macro_preset2",
732+
"g15::macro_preset3",
733+
"g15::macro_record",
734+
};
736735
u8 gkeys_settings_output_report = 0;
737736
u8 gkeys_settings_feature_report = 0;
738737
struct hid_report_enum *rep_enum;
@@ -874,7 +873,7 @@ static int lg_g15_probe(struct hid_device *hdev, const struct hid_device_id *id)
874873

875874
/* Register LED devices */
876875
for (i = 0; i < LG_G15_LED_MAX; i++) {
877-
ret = lg_g15_register_led(g15, i);
876+
ret = lg_g15_register_led(g15, i, led_names[i]);
878877
if (ret)
879878
goto error_hw_stop;
880879
}

0 commit comments

Comments
 (0)