[PATCH v6 3/3] platform/x86: lenovo-yoga-tab2-pro-1380-fastcharger: Bind through normal serdev matching
From: ChunAn Wu
Date: Sat Oct 24 2026 - 22:04:45 EST
The software-node-backed serdev client cannot be matched through ACPI or
device tree and is force-attached to its driver.
Pass the modalias to serdev_device_add() and give the serdev driver a
matching id_table, so that the serdev core binds the two through normal
matching. Deferred probing is then handled by the driver core, so the
-EAGAIN translation is no longer needed.
A failing serdev probe no longer propagates out of the platform probe;
as for any other bus, the client is simply left unbound.
Signed-off-by: ChunAn Wu <an.wu@xxxxxxxxxxxxx>
Reviewed-by: Markus Probst <markus.probst@xxxxxxxxx>
---
.../lenovo/yoga-tab2-pro-1380-fastcharger.c | 25 ++++++-------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
index 5e568fe1162d..ecac3eb3f336 100644
--- a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
+++ b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
@@ -219,11 +219,17 @@ static int yt2_1380_fc_serdev_probe(struct serdev_device *serdev)
return 0;
}
+static const struct serdev_device_id yt2_1380_fc_serdev_id[] = {
+ { KBUILD_MODNAME },
+ { }
+};
+
static struct serdev_device_driver yt2_1380_fc_serdev_driver = {
.probe = yt2_1380_fc_serdev_probe,
.driver = {
.name = KBUILD_MODNAME,
},
+ .id_table = yt2_1380_fc_serdev_id,
};
static const struct pinctrl_map yt2_1380_fc_pinctrl_map[] = {
@@ -260,25 +266,12 @@ static int yt2_1380_fc_pdev_probe(struct platform_device *pdev)
/* The fwnode is a managed node, so it will be auto-put on serdev_device_put() */
fwnode_handle_get(dev_fwnode(&serdev->dev));
- ret = serdev_device_add(serdev, NULL);
+ ret = serdev_device_add(serdev, KBUILD_MODNAME);
if (ret) {
serdev_device_put(serdev);
return dev_err_probe(&pdev->dev, ret, "adding serdev\n");
}
- /*
- * serdev device <-> driver matching relies on OF or ACPI matches and
- * neither is available here, manually bind the driver.
- */
- ret = device_driver_attach(&yt2_1380_fc_serdev_driver.driver, &serdev->dev);
- if (ret) {
- /* device_driver_attach() maps EPROBE_DEFER to EAGAIN, map it back */
- serdev_device_remove(serdev);
- return dev_err_probe(&pdev->dev,
- (ret == -EAGAIN) ? -EPROBE_DEFER : ret,
- "attaching serdev driver\n");
- }
-
/* So that yt2_1380_fc_pdev_remove() can remove the serdev */
platform_set_drvdata(pdev, serdev);
return 0;
@@ -304,10 +297,6 @@ static int __init yt2_1380_fc_module_init(void)
{
int ret;
- /*
- * serdev driver MUST be registered first because pdev driver calls
- * device_driver_attach() on the serdev, serdev-driver pair.
- */
ret = serdev_device_driver_register(&yt2_1380_fc_serdev_driver);
if (ret)
return ret;
--
2.34.1