Date: Tue, 17 Nov 2020 14:59:58 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367767 - head/sys/dev/extres/syscon Message-ID: <202011171459.0AHExwZ9030762@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: manu Date: Tue Nov 17 14:59:58 2020 New Revision: 367767 URL: https://svnweb.freebsd.org/changeset/base/367767 Log: syscon: Add syscon_get_by_ofw_node This allow to get a syscon node defined under a specific fdt node (which isn't always the device one). Modified: head/sys/dev/extres/syscon/syscon.c head/sys/dev/extres/syscon/syscon.h Modified: head/sys/dev/extres/syscon/syscon.c ============================================================================== --- head/sys/dev/extres/syscon/syscon.c Tue Nov 17 14:58:30 2020 (r367766) +++ head/sys/dev/extres/syscon/syscon.c Tue Nov 17 14:59:58 2020 (r367767) @@ -264,6 +264,21 @@ syscon_get_ofw_node(struct syscon *syscon) } int +syscon_get_by_ofw_node(device_t cdev, phandle_t node, struct syscon **syscon) +{ + + SYSCON_TOPO_SLOCK(); + *syscon = syscon_find_by_ofw_node(node); + if (*syscon == NULL) { + SYSCON_TOPO_UNLOCK(); + device_printf(cdev, "Failed to find syscon node\n"); + return (ENODEV); + } + SYSCON_TOPO_UNLOCK(); + return (0); +} + +int syscon_get_by_ofw_property(device_t cdev, phandle_t cnode, char *name, struct syscon **syscon) { Modified: head/sys/dev/extres/syscon/syscon.h ============================================================================== --- head/sys/dev/extres/syscon/syscon.h Tue Nov 17 14:58:30 2020 (r367766) +++ head/sys/dev/extres/syscon/syscon.h Tue Nov 17 14:59:58 2020 (r367767) @@ -73,6 +73,7 @@ struct syscon *syscon_create_ofw_node(device_t pdev, phandle_t syscon_get_ofw_node(struct syscon *syscon); int syscon_get_by_ofw_property(device_t consumer, phandle_t node, char *name, struct syscon **syscon); +int syscon_get_by_ofw_node(device_t cdev, phandle_t node, struct syscon **syscon); #endif #endif /* DEV_SYSCON_H */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011171459.0AHExwZ9030762>