summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2006-10-23 00:38:58 +0000
committermarcel <marcel@FreeBSD.org>2006-10-23 00:38:58 +0000
commit9f9cb15f4e5d798ff371ac4ff29c2878975afa74 (patch)
treecd78b58e68885cf592ff87241bf44e4f9f611f27 /sys
parent2fda6e11e96b7e11228416efe0f63ecae26e904d (diff)
downloadFreeBSD-src-9f9cb15f4e5d798ff371ac4ff29c2878975afa74.zip
FreeBSD-src-9f9cb15f4e5d798ff371ac4ff29c2878975afa74.tar.gz
o Eliminate nexus_print_resources(). Use resource_list_print_type()
instead. o Eliminate nexus_print_all_resources(). Inline the function body in nexus_print_child().
Diffstat (limited to 'sys')
-rw-r--r--sys/ia64/ia64/nexus.c55
1 files changed, 5 insertions, 50 deletions
diff --git a/sys/ia64/ia64/nexus.c b/sys/ia64/ia64/nexus.c
index 23eef4b..7eb4801 100644
--- a/sys/ia64/ia64/nexus.c
+++ b/sys/ia64/ia64/nexus.c
@@ -75,9 +75,6 @@ static struct rman irq_rman, drq_rman, port_rman, mem_rman;
static int nexus_probe(device_t);
static int nexus_attach(device_t);
-static int nexus_print_resources(struct resource_list *rl, const char *name, int type,
- const char *format);
-static int nexus_print_all_resources(device_t dev);
static int nexus_print_child(device_t, device_t);
static device_t nexus_add_child(device_t bus, int order, const char *name,
int unit);
@@ -230,58 +227,16 @@ nexus_attach(device_t dev)
}
static int
-nexus_print_resources(struct resource_list *rl, const char *name, int type,
- const char *format)
-{
- struct resource_list_entry *rle;
- int printed, retval;
-
- printed = 0;
- retval = 0;
- /* Yes, this is kinda cheating */
- STAILQ_FOREACH(rle, rl, link) {
- if (rle->type == type) {
- if (printed == 0)
- retval += printf(" %s ", name);
- else if (printed > 0)
- retval += printf(",");
- printed++;
- retval += printf(format, rle->start);
- if (rle->count > 1) {
- retval += printf("-");
- retval += printf(format, rle->start +
- rle->count - 1);
- }
- }
- }
- return retval;
-}
-
-static int
-nexus_print_all_resources(device_t dev)
-{
- struct nexus_device *ndev = DEVTONX(dev);
- struct resource_list *rl = &ndev->nx_resources;
- int retval = 0;
-
- if (STAILQ_FIRST(rl) || ndev->nx_pcibus != -1)
- retval += printf(" at");
-
- retval += nexus_print_resources(rl, "port", SYS_RES_IOPORT, "%#lx");
- retval += nexus_print_resources(rl, "iomem", SYS_RES_MEMORY, "%#lx");
- retval += nexus_print_resources(rl, "irq", SYS_RES_IRQ, "%ld");
-
- return retval;
-}
-
-static int
nexus_print_child(device_t bus, device_t child)
{
- struct nexus_device *ndev = DEVTONX(child);
+ struct nexus_device *ndev = DEVTONX(child);
+ struct resource_list *rl = &ndev->nx_resources;
int retval = 0;
retval += bus_print_child_header(bus, child);
- retval += nexus_print_all_resources(child);
+ retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx");
+ retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#lx");
+ retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
if (ndev->nx_pcibus != -1)
retval += printf(" pcibus %d", ndev->nx_pcibus);
if (device_get_flags(child))
OpenPOWER on IntegriCloud