diff options
| author | Emmanuel Vadot <manu@FreeBSD.org> | 2020-11-17 14:59:58 +0000 |
|---|---|---|
| committer | Emmanuel Vadot <manu@FreeBSD.org> | 2020-11-17 14:59:58 +0000 |
| commit | e35c28a24b850afd23beccf9c6683d9cd0b7c4b3 (patch) | |
| tree | 8374bb6724ed5a73afa4d8a682757249553c846f /sys/dev/extres | |
| parent | 891ea2d7b4b8bb7d68ac88024384a931d6630492 (diff) | |
Notes
Diffstat (limited to 'sys/dev/extres')
| -rw-r--r-- | sys/dev/extres/syscon/syscon.c | 15 | ||||
| -rw-r--r-- | sys/dev/extres/syscon/syscon.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sys/dev/extres/syscon/syscon.c b/sys/dev/extres/syscon/syscon.c index 2ab1bec4f140e..9bae304328805 100644 --- a/sys/dev/extres/syscon/syscon.c +++ b/sys/dev/extres/syscon/syscon.c @@ -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) { diff --git a/sys/dev/extres/syscon/syscon.h b/sys/dev/extres/syscon/syscon.h index ff742937ac1e2..cb138ed5ded53 100644 --- a/sys/dev/extres/syscon/syscon.h +++ b/sys/dev/extres/syscon/syscon.h @@ -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 */ |
