All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
To: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rahul Rameshbabu <rrameshbabu@nvidia.com>
Subject: [PATCH 3/3] HID: nvidia-shield: Update Thunderstrike LED instance name to use id
Date: Mon,  7 Aug 2023 09:36:20 -0700	[thread overview]
Message-ID: <20230807163620.16855-3-rrameshbabu@nvidia.com> (raw)
In-Reply-To: <20230807163620.16855-1-rrameshbabu@nvidia.com>

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>
---
 drivers/hid/hid-nvidia-shield.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
index 1612de3ef4c5..43784bb57d3f 100644
--- a/drivers/hid/hid-nvidia-shield.c
+++ b/drivers/hid/hid-nvidia-shield.c
@@ -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;
-- 
2.40.1


  parent reply	other threads:[~2023-08-07 16:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 16:36 [PATCH 1/3] HID: nvidia-shield: Remove led_classdev_unregister in thunderstrike_create Rahul Rameshbabu
2023-08-07 16:36 ` [PATCH 2/3] HID: nvidia-shield: Add battery support for Thunderstrike Rahul Rameshbabu
2023-08-07 16:36 ` Rahul Rameshbabu [this message]
2023-08-14  9:41 ` [PATCH 1/3] HID: nvidia-shield: Remove led_classdev_unregister in thunderstrike_create Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230807163620.16855-3-rrameshbabu@nvidia.com \
    --to=rrameshbabu@nvidia.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.