Skip to content

Commit 92fa16e

Browse files
Mani-SadhasivamBartosz Golaszewski
authored andcommitted
serdev: Do not return -ENODEV from of_serdev_register_devices() if external connector is used
If an external connector like M.2 is connected to the serdev controller in DT, then the serdev devices may be created dynamically by the connector driver. So do not return -ENODEV from of_serdev_register_devices() if the static nodes are not found and the graph node is used. Tested-by: Hans de Goede <johannes.goede@oss.qualcomm.com> # ThinkPad T14s gen6 (arm64) Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Link: https://patch.msgid.link/20260326-pci-m2-e-v7-3-43324a7866e6@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
1 parent a2b4814 commit 92fa16e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/tty/serdev/core.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/kernel.h>
1313
#include <linux/module.h>
1414
#include <linux/of.h>
15+
#include <linux/of_graph.h>
1516
#include <linux/of_device.h>
1617
#include <linux/pm_domain.h>
1718
#include <linux/pm_runtime.h>
@@ -561,7 +562,13 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl)
561562
} else
562563
found = true;
563564
}
564-
if (!found)
565+
566+
/*
567+
* When the serdev controller is connected to an external connector like
568+
* M.2 in DT, then the serdev devices may be created dynamically by the
569+
* connector driver.
570+
*/
571+
if (!found && !of_graph_is_present(dev_of_node(&ctrl->dev)))
565572
return -ENODEV;
566573

567574
return 0;

0 commit comments

Comments
 (0)