All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.