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

Configure Feed

Select the types of activity you want to include in your feed.

serdev: Add an API to find the serdev controller associated with the devicetree node

Add of_find_serdev_controller_by_node() API to find the serdev controller
device associated with the devicetree node.

Tested-by: Hans de Goede <johannes.goede@oss.qualcomm.com> # ThinkPad T14s gen6 (arm64)
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
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-2-43324a7866e6@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

authored by

Manivannan Sadhasivam and committed by
Bartosz Golaszewski
a2b48141 e7fef850

+28
+19
drivers/tty/serdev/core.c
··· 514 514 } 515 515 EXPORT_SYMBOL_GPL(serdev_controller_alloc); 516 516 517 + #ifdef CONFIG_OF 518 + /** 519 + * of_find_serdev_controller_by_node() - Find the serdev controller associated 520 + * with the devicetree node 521 + * @node: Devicetree node 522 + * 523 + * Return: Pointer to the serdev controller associated with the node. NULL if 524 + * the controller is not found. Caller is responsible for calling 525 + * serdev_controller_put() to drop the reference. 526 + */ 527 + struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node) 528 + { 529 + struct device *dev = bus_find_device_by_of_node(&serdev_bus_type, node); 530 + 531 + return (dev && dev->type == &serdev_ctrl_type) ? to_serdev_controller(dev) : NULL; 532 + } 533 + EXPORT_SYMBOL_GPL(of_find_serdev_controller_by_node); 534 + #endif 535 + 517 536 static int of_serdev_register_devices(struct serdev_controller *ctrl) 518 537 { 519 538 struct device_node *node;
+9
include/linux/serdev.h
··· 334 334 } 335 335 #endif /* CONFIG_ACPI */ 336 336 337 + #ifdef CONFIG_OF 338 + struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node); 339 + #else 340 + static inline struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node) 341 + { 342 + return NULL; 343 + } 344 + #endif /* CONFIG_OF */ 345 + 337 346 #endif /*_LINUX_SERDEV_H */