[PATCH v6 0/3] serdev: handle devices without an ACPI or device tree node
From: ChunAn Wu
Date: Sat Oct 24 2026 - 22:03:45 EST
Driver-created serdev clients without an ACPI companion or device tree
node currently have no modalias and cannot be matched to a driver:
their modalias sysfs read returns -ENODEV and their creators force a
bind with device_driver_attach().
Backlight function on dell-uart-backlight is not affected: that class
device is registered independently and gets its own add uevent. The
user-visible breakage is the failing modalias read on an existing
serdev child -- Checkbox dkms_info_attachment aborts with
"OSError: [Errno 19] No such device".
Resolve the two long-standing serdev-core TODOs by letting the creator
pass a modalias to serdev_device_add() and giving the serdev driver an
id_table, modelled on the SPI bus. ACPI and OF match first and are
unchanged. Convert dell-uart-backlight and the Lenovo Yoga Tab 2 Pro
fastcharger to this path and drop their force-attach workarounds.
Changes in v6:
- Patch 1: switch dell-uart-backlight and yoga-tab2-pro-1380
fastcharger over to the new serdev_device_add() signature with
modalias=NULL so the tree keeps building through patch 1; patches
2/3 then switch them to a real modalias. Fixes the bisect break
that sashiko-bot flagged (true positive, Markus Probst confirmed).
- Patch 1: wire up struct serdev_device_id in modpost, modelled on
the SPI bus: new DEVID() + DEVID_FIELD() entries in
scripts/mod/devicetable-offsets.c, do_serdev_entry() and devtable[]
entry in scripts/mod/file2alias.c, and the device-id/serdev.h
include in include/linux/mod_devicetable.h. Also add
serdev_device_id to scripts/coccinelle/misc/of_table.cocci.
Reported by sashiko-bot; the two in-tree firmware-less clients do
not need MODULE_DEVICE_TABLE(serdev, ...) because the same module
creates and drives their serdev child, but the plumbing matches
the other buses in case out-of-tree users want it. Markus Probst
confirmed as true positive.
- Patch 1: drop the unused `#include <linux/string.h>` from
include/linux/serdev.h. strscpy() is used only in core.c, which
already pulls string.h transitively. Reported by Markus Probst.
- Patch 1: drop Markus's v5 Reviewed-by. The modpost wiring and the
dell/yoga NULL-stub bisect fix are new code he has not seen; the
tag belongs on code that was actually reviewed.
- Patch 3: drop the "serdev driver MUST be registered first" comment
in yt2_1380_fc_module_init(). With id_table matching the order of
driver_register vs device_add no longer matters. Reported by
Markus Probst.
Changes in v5:
- Patch 1: restore is_serdev_device() guard at the top of
serdev_device_match(). Dropping it was correct when match only
called acpi/of helpers, but Patch 1 also adds
serdev_match_id(sdrv->id_table, serdev->modalias), which
dereferences serdev_device-only memory. Since serdev_controller
shares serdev_bus_type, the driver core calls .match on controllers
too; without the guard, serdev->modalias on a controller reads bytes
from inside host/nr/serdev/ops, and strcmp() can walk past the end of
the controller struct. Reported by sashiko-bot on 2/3 and 3/3.
Changes in v4:
- Patch 1: drop the dead is_serdev_device() guard from the match
callback, and dereference serdev once at the top
- Patch 1: drop the "large enough" comment on SERDEV_NAME_SIZE
- Patch 1: in struct serdev_device_driver, place id_table right under
driver, next to driver->of_match_table and driver->acpi_match_table
- Patch 1: merge serdev_device_set_modalias() into serdev_device_add()
so the modalias is set at the only point where forgetting it would
matter; internal firmware callers pass NULL
- All three patches: tightened commit messages and moved the v2/v3
changelog narrative out of Patch 1 into this cover letter
Changes in v3:
- Rename struct serdev_device::name to ::modalias; dev_name() is
unchanged
- Model matching on the SPI bus: add struct serdev_device_id and
id_table; drop driver->name matching
- Add serdev_device_set_modalias() helper and SERDEV_MODULE_PREFIX
- No MODULE_DEVICE_TABLE(serdev, ...) support: both in-tree
firmware-less clients are created by the same module that provides
their driver, so udev has nothing to autoload
Changes in v2:
- Instead of silently returning success with no modalias, use a
creator-supplied name as a "serial:<name>" modalias fallback and as
the matching key, so clients can bind through normal serdev matching
v5: https://lore.kernel.org/lkml/cover.1792831564.git.an.wu@xxxxxxxxxxxxx/
v4: https://lore.kernel.org/lkml/20261024022930.2704030-1-an.wu@xxxxxxxxxxxxx/
v3: https://lore.kernel.org/lkml/20261023052717.2577234-1-an.wu@xxxxxxxxxxxxx/
v2: https://lore.kernel.org/lkml/20261022032842.2492572-1-an.wu@xxxxxxxxxxxxx/
v1: https://lore.kernel.org/lkml/20261021092124.2306053-1-an.wu@xxxxxxxxxxxxx/
ChunAn Wu (3):
serdev: handle devices without an ACPI or device tree node
platform/x86: dell-uart-backlight: Bind through normal serdev matching
platform/x86: lenovo-yoga-tab2-pro-1380-fastcharger: Bind through
normal serdev matching
MAINTAINERS | 1 +
.../platform/x86/dell/dell-uart-backlight.c | 18 +++---
.../lenovo/yoga-tab2-pro-1380-fastcharger.c | 25 +++-----
.../platform/x86/x86-android-tablets/core.c | 2 +-
drivers/power/sequencing/pwrseq-pcie-m2.c | 2 +-
drivers/tty/serdev/core.c | 62 ++++++++++++++++---
include/linux/device-id/serdev.h | 19 ++++++
include/linux/mod_devicetable.h | 1 +
include/linux/serdev.h | 11 +++-
scripts/coccinelle/misc/of_table.cocci | 16 ++---
scripts/mod/devicetable-offsets.c | 3 +
scripts/mod/file2alias.c | 9 +++
12 files changed, 120 insertions(+), 49 deletions(-)
create mode 100644 include/linux/device-id/serdev.h
base-commit: 9e947d96915af63e28896caae85a81b74855621b
--
2.34.1