HID: nvidia-shield: Update Thunderstrike LED instance name to use id
authorRahul Rameshbabu <rrameshbabu@nvidia.com>
Mon, 7 Aug 2023 16:36:20 +0000 (09:36 -0700)
committerJiri Kosina <jkosina@suse.cz>
Mon, 14 Aug 2023 09:41:17 +0000 (11:41 +0200)
Previously would let led_classdev handle renaming when name collision
occurred. Now that an ID allocator is used to uniquely identify multiple
Thunderstrike controllers, generate unique led device names.

Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-nvidia-shield.c

index 1612de3..43784bb 100644 (file)
@@ -798,7 +798,8 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts)
 {
        struct led_classdev *led = &ts->led_dev;
 
-       led->name = "thunderstrike:blue:led";
+       led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL,
+                                  "thunderstrike%d:blue:led", ts->id);
        led->max_brightness = 1;
        led->flags = LED_CORE_SUSPENDRESUME;
        led->brightness_get = &thunderstrike_led_get_brightness;