* [PATCH] serdev: handle devices without an ACPI or device tree node
@ 2026-10-19 5:45 ChunAn Wu
2026-10-19 6:03 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: ChunAn Wu @ 2026-10-19 5:45 UTC (permalink / raw)
To: linux-serial; +Cc: markus.probst, gregkh
Some drivers, such as dell-uart-backlight, manually instantiate serdev
clients without an ACPI companion or device tree node.
For these devices, both modalias helpers return -ENODEV. This makes the
modalias sysfs read fail and suppresses the device add uevent, even
though the device is registered and bound to its driver.
Return success with no modalias when neither metadata source exists.
Devices with ACPI or device tree metadata keep their existing alias
generation and error handling.
Signed-off-by: ChunAn Wu <an.wu@canonical.com>
---
drivers/tty/serdev/core.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 7500efcdfc21..366c6d906233 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -26,11 +26,26 @@
static bool is_registered;
static DEFINE_IDA(ctrl_ida);
+static bool serdev_device_has_modalias_node(const struct device *dev)
+{
+ if (ACPI_COMPANION(dev))
+ return true;
+
+ return dev->of_node && !dev_of_node_reused(dev);
+}
+
static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
int len;
+ /*
+ * Serdev devices instantiated by a driver instead of by firmware have
+ * no node to derive a modalias from, which is not an error.
+ */
+ if (!serdev_device_has_modalias_node(dev))
+ return 0;
+
len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1);
if (len != -ENODEV)
return len;
@@ -51,6 +66,9 @@ static int serdev_device_uevent(const struct device *dev, struct kobj_uevent_env
/* TODO: platform modalias */
+ if (!serdev_device_has_modalias_node(dev))
+ return 0;
+
rc = acpi_device_uevent_modalias(dev, env);
if (rc != -ENODEV)
return rc;
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] serdev: handle devices without an ACPI or device tree node
2026-10-19 5:45 [PATCH] serdev: handle devices without an ACPI or device tree node ChunAn Wu
@ 2026-10-19 6:03 ` sashiko-bot
2026-10-19 6:43 ` An Wu
2026-10-20 16:42 ` Markus Probst
2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-10-19 6:03 UTC (permalink / raw)
To: ChunAn Wu, linux-serial
> Some drivers, such as dell-uart-backlight, manually instantiate serdev
> clients without an ACPI companion or device tree node.
>
> For these devices, both modalias helpers return -ENODEV. This makes the
> modalias sysfs read fail and suppresses the device add uevent, even
> though the device is registered and bound to its driver.
>
> Return success with no modalias when neither metadata source exists.
> Devices with ACPI or device tree metadata keep their existing alias
> generation and error handling.
>
> Signed-off-by: ChunAn Wu <an.wu@canonical.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019054513.1966382-1-an.wu@canonical.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serdev: handle devices without an ACPI or device tree node
2026-10-19 5:45 [PATCH] serdev: handle devices without an ACPI or device tree node ChunAn Wu
2026-10-19 6:03 ` sashiko-bot
@ 2026-10-19 6:43 ` An Wu
2026-10-20 16:42 ` Markus Probst
2 siblings, 0 replies; 4+ messages in thread
From: An Wu @ 2026-10-19 6:43 UTC (permalink / raw)
To: linux-serial; +Cc: markus.probst, gregkh, linux-kernel, jirislaby
cc linux-kernel@vger.kernel.org and jirislaby@kernel.org
On Mon, Oct 19, 2026 at 1:45 PM ChunAn Wu <an.wu@canonical.com> wrote:
>
> Some drivers, such as dell-uart-backlight, manually instantiate serdev
> clients without an ACPI companion or device tree node.
>
> For these devices, both modalias helpers return -ENODEV. This makes the
> modalias sysfs read fail and suppresses the device add uevent, even
> though the device is registered and bound to its driver.
>
> Return success with no modalias when neither metadata source exists.
> Devices with ACPI or device tree metadata keep their existing alias
> generation and error handling.
>
> Signed-off-by: ChunAn Wu <an.wu@canonical.com>
> ---
> drivers/tty/serdev/core.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index 7500efcdfc21..366c6d906233 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -26,11 +26,26 @@
> static bool is_registered;
> static DEFINE_IDA(ctrl_ida);
>
> +static bool serdev_device_has_modalias_node(const struct device *dev)
> +{
> + if (ACPI_COMPANION(dev))
> + return true;
> +
> + return dev->of_node && !dev_of_node_reused(dev);
> +}
> +
> static ssize_t modalias_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> int len;
>
> + /*
> + * Serdev devices instantiated by a driver instead of by firmware have
> + * no node to derive a modalias from, which is not an error.
> + */
> + if (!serdev_device_has_modalias_node(dev))
> + return 0;
> +
> len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1);
> if (len != -ENODEV)
> return len;
> @@ -51,6 +66,9 @@ static int serdev_device_uevent(const struct device *dev, struct kobj_uevent_env
>
> /* TODO: platform modalias */
>
> + if (!serdev_device_has_modalias_node(dev))
> + return 0;
> +
> rc = acpi_device_uevent_modalias(dev, env);
> if (rc != -ENODEV)
> return rc;
>
> base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] serdev: handle devices without an ACPI or device tree node
2026-10-19 5:45 [PATCH] serdev: handle devices without an ACPI or device tree node ChunAn Wu
2026-10-19 6:03 ` sashiko-bot
2026-10-19 6:43 ` An Wu
@ 2026-10-20 16:42 ` Markus Probst
2 siblings, 0 replies; 4+ messages in thread
From: Markus Probst @ 2026-10-20 16:42 UTC (permalink / raw)
To: ChunAn Wu, linux-serial; +Cc: gregkh
[-- Attachment #1: Type: text/plain, Size: 2446 bytes --]
On Mon, 2026-10-19 at 13:45 +0800, ChunAn Wu wrote:
> Some drivers, such as dell-uart-backlight, manually instantiate serdev
> clients without an ACPI companion or device tree node.
>
> For these devices, both modalias helpers return -ENODEV. This makes the
> modalias sysfs read fail and suppresses the device add uevent, even
> though the device is registered and bound to its driver.
>
> Return success with no modalias when neither metadata source exists.
> Devices with ACPI or device tree metadata keep their existing alias
> generation and error handling.
>
> Signed-off-by: ChunAn Wu <an.wu@canonical.com>
> ---
> drivers/tty/serdev/core.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index 7500efcdfc21..366c6d906233 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -26,11 +26,26 @@
> static bool is_registered;
> static DEFINE_IDA(ctrl_ida);
>
> +static bool serdev_device_has_modalias_node(const struct device *dev)
> +{
> + if (ACPI_COMPANION(dev))
> + return true;
> +
> + return dev->of_node && !dev_of_node_reused(dev);
> +}
> +
> static ssize_t modalias_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> int len;
>
> + /*
> + * Serdev devices instantiated by a driver instead of by firmware have
> + * no node to derive a modalias from, which is not an error.
> + */
> + if (!serdev_device_has_modalias_node(dev))
> + return 0;
> +
> len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1);
> if (len != -ENODEV)
> return len;
> @@ -51,6 +66,9 @@ static int serdev_device_uevent(const struct device *dev, struct kobj_uevent_env
>
> /* TODO: platform modalias */
>
> + if (!serdev_device_has_modalias_node(dev))
> + return 0;
> +
> rc = acpi_device_uevent_modalias(dev, env);
> if (rc != -ENODEV)
> return rc;
>
> base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
There is a todo comment:
/* TODO: platform modalias */
Resolving this should also fix your issue.
Also keep it closer to
- platform_uevent in drivers/base/platform.c
- modalias_show in drivers/base/platform.c
and avoid the extra `serdev_device_has_modalias_node` function.
Please also address the similar todo comment in `serdev_device_match`
in the same process.
Thanks
- Markus Probst
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-20 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 5:45 [PATCH] serdev: handle devices without an ACPI or device tree node ChunAn Wu
2026-10-19 6:03 ` sashiko-bot
2026-10-19 6:43 ` An Wu
2026-10-20 16:42 ` Markus Probst
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.