From: Jonathan Brophy <Professor_jonny@hotmail.com>
To: Andriy Shevencho <andriy.shevchenko@linux.intel.com>,
Jonathan Brophy <professorjonny98@gmail.com>
Cc: lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Radoslav Tsvetkov <rtsvetkov@gradotech.eu>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: Re: [RFC PATCH 0/2] leds: Add optional instance identifier for deterministic naming
Date: Sun, 28 Dec 2025 19:14:09 +0000 [thread overview]
Message-ID: <DS0PR84MB3746809655135654882AF9D39FBEA@DS0PR84MB3746.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <aVF3ZTxqSXWVcCVN@smile.fi.intel.com>
>Hmm... I think the research missed the udev + sysfs approach as done for the
>networking devices. Hence the question: do we have enough data in sysfs for
>leds to understand their HW connections / semantics?
>--
>With Best Regards,
>Andy Shevchenko
I looked at that also but I don't see a way of it working with the current led attributes:
**Current LED sysfs attributes:**
For a typical LED, we have:
/sys/class/leds/lan:green/
├── brightness
├── max_brightness
├── trigger
└── device -> ../../../gpio-leds (generic, not port-specific)
The problem is that **there's no stable identifier** that maps to the hardware:
- The device symlink points to the LED controller (e.g., gpio-leds), not the
specific port/function
- There's no DT path or hardware identifier exposed
- Multiple identical LEDs (lan:green, lan:green_1, lan:green_2) all have
identical sysfs attributes except their names
I don't think udev can't help here either:
Network devices work because they have unique identifiers:
- MAC addresses (globally unique)
- PCI bus addresses (stable per-slot)
- Device tree paths (but not exposed for LEDs)
LEDs in a run of the mill 48-port switch generally have:
- Same GPIO controller
- Same function (LED_FUNCTION_LAN)
- Same color (LED_COLOR_ID_GREEN)
- Same trigger options
- **Nothing unique** except the name
**What we'd need for udev to work:**
We'd need to expose something like:
/sys/class/leds/lan:green_23/dt_path -> /leds/led-port23
/sys/class/leds/lan:green_23/hardware_id
But this has problems:
1. Not all platforms use DT (ACPI systems)
2. Adds complexity to LED core for every driver
3. Requires userspace policy to parse and create symlinks
4. Still depends on non-deterministic suffix
The instance identifier solves this with much less effort.
Instead of:
1. Kernel creates "lan:green_23" (non-deterministic)
2. Kernel exposes DT path in sysfs
3. Udev reads DT path
4. Udev creates symlink "lan-port23" -> "lan:green_23"
5. Userspace uses symlink
We get:
1. Kernel creates "lan:green:port23" (deterministic, from DT)
2. Userspace uses it directly
This is simpler, works on non-DT platforms, and follows the existing
function:color naming convention by extending it rather than working around it.
**Precedent:**
The networking subsystem itself had to solve this with predictable interface
names (enp3s0) because MAC addresses aren't in DT and PCI enumeration order
can change.
With this patch we're solving the same problem, but for LEDs the solution is
simpler: put the identifier in the name from the start.
I don't know of another suitable way to make it work without much change
and from my research it really does not bring much to the table and adds a lot
of complexity when there is a simple solution.
Regards
Jonathan Brophy
next prev parent reply other threads:[~2025-12-28 19:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-28 18:22 Jonathan Brophy
2025-12-28 18:22 ` [RFC PATCH 1/2] leds: core: Add support for led-instance property Jonathan Brophy
2025-12-28 18:35 ` Andriy Shevencho
2025-12-28 18:43 ` Jonathan Brophy
2025-12-28 19:56 ` Andriy Shevencho
2025-12-28 18:22 ` [RFC PATCH 2/2] dt-bindings: leds: common: Add " Jonathan Brophy
2025-12-30 18:28 ` Rob Herring (Arm)
2026-01-02 10:12 ` Krzysztof Kozlowski
2025-12-28 18:31 ` [RFC PATCH 0/2] leds: Add optional instance identifier for deterministic naming Andriy Shevencho
2025-12-28 19:14 ` Jonathan Brophy [this message]
2025-12-28 19:59 ` Andriy Shevencho
2025-12-28 20:03 ` Andriy Shevencho
2025-12-29 11:16 ` Jacek Anaszewski
2025-12-29 12:30 ` Andriy Shevencho
2025-12-29 14:28 ` Jacek Anaszewski
2025-12-29 14:45 ` Andriy Shevencho
2025-12-29 23:59 ` Jonathan Brophy
2025-12-30 16:35 ` Jacek Anaszewski
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=DS0PR84MB3746809655135654882AF9D39FBEA@DS0PR84MB3746.NAMPRD84.PROD.OUTLOOK.COM \
--to=professor_jonny@hotmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=professorjonny98@gmail.com \
--cc=robh@kernel.org \
--cc=rtsvetkov@gradotech.eu \
/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 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®