Re: [PATCH] serdev: handle devices without an ACPI or device tree node

From: An Wu

Date: Mon Oct 19 2026 - 02:46:48 EST


cc linux-kernel@xxxxxxxxxxxxxxx and jirislaby@xxxxxxxxxx

On Mon, Oct 19, 2026 at 1:45 PM ChunAn Wu <an.wu@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx>
> ---
> 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
>