diff options
author | gber <gber@FreeBSD.org> | 2012-09-14 09:36:35 +0000 |
---|---|---|
committer | gber <gber@FreeBSD.org> | 2012-09-14 09:36:35 +0000 |
commit | 5208b599ffd736e8a218cd75703389f729fa1da2 (patch) | |
tree | 63ba1f0f973296b9c2bec198c1b043a99592eb07 /sys/dev/fdt/fdt_common.c | |
parent | 5dd175c3fd9e3e14cbf3982b8553df7c3fbb18f3 (diff) | |
download | FreeBSD-src-5208b599ffd736e8a218cd75703389f729fa1da2.zip FreeBSD-src-5208b599ffd736e8a218cd75703389f729fa1da2.tar.gz |
Add fdt_get_unit() function.
Obtained from: Semihalf
Diffstat (limited to 'sys/dev/fdt/fdt_common.c')
-rw-r--r-- | sys/dev/fdt/fdt_common.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c index cc55c65..706396b 100644 --- a/sys/dev/fdt/fdt_common.c +++ b/sys/dev/fdt/fdt_common.c @@ -697,3 +697,14 @@ fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint32_t *memsize) out: return (rv); } + +int +fdt_get_unit(device_t dev) +{ + const char * name; + + name = ofw_bus_get_name(dev); + name = strchr(name, '@') + 1; + + return (strtol(name,NULL,0)); +} |