* [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
2026-10-19 6:43 ` An Wu
0 siblings, 2 replies; 3+ 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] 3+ 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
1 sibling, 0 replies; 3+ 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] 3+ 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
1 sibling, 0 replies; 3+ 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] 3+ messages in thread
end of thread, other threads:[~2026-10-19 6:43 UTC | newest]
Thread overview: 3+ 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
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.