[PATCH v2 3/3] platform/x86: lenovo-yoga-tab2-pro-1380-fastcharger: Bind through normal serdev matching

From: ChunAn Wu

Date: Wed Oct 21 2026 - 05:25:40 EST


The software-node-backed serdev client cannot match through ACPI or
device tree and is force-attached.

Set its name before adding it so the serdev core matches it normally.
Deferred probing is then handled by the driver core.

Signed-off-by: ChunAn Wu <an.wu@xxxxxxxxxxxxx>
---
.../lenovo/yoga-tab2-pro-1380-fastcharger.c | 21 ++++++-------------
1 file changed, 6 insertions(+), 15 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 8551ab4d2c7d..2eee9ecbcae7 100644
--- a/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
+++ b/drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c
@@ -260,25 +260,14 @@ 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));

+ serdev_device_set_name(serdev, KBUILD_MODNAME);
+
ret = serdev_device_add(serdev);
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;
@@ -305,8 +294,10 @@ 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.
+ * Register the serdev driver first, so that the serdev device added
+ * by the pdev driver's probe() matches it and gets probed. serdev
+ * drivers are probed asynchronously, so that probe may still be
+ * running when the pdev probe() returns.
*/
ret = serdev_device_driver_register(&yt2_1380_fc_serdev_driver);
if (ret)
--
2.34.1