Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Manivannan Sadhasivam and committed by
Bartosz Golaszewski
92fa16ec a2b48141

+8 -1
+8 -1
drivers/tty/serdev/core.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/module.h> 14 14 #include <linux/of.h> 15 + #include <linux/of_graph.h> 15 16 #include <linux/of_device.h> 16 17 #include <linux/pm_domain.h> 17 18 #include <linux/pm_runtime.h> ··· 562 561 } else 563 562 found = true; 564 563 } 565 - if (!found) 564 + 565 + /* 566 + * When the serdev controller is connected to an external connector like 567 + * M.2 in DT, then the serdev devices may be created dynamically by the 568 + * connector driver. 569 + */ 570 + if (!found && !of_graph_is_present(dev_of_node(&ctrl->dev))) 566 571 return -ENODEV; 567 572 568 573 return 0;