summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-09-04 03:19:33 +0000
committerjhb <jhb@FreeBSD.org>2002-09-04 03:19:33 +0000
commit2ab71599b84317a27680c6710032943c65bd10a9 (patch)
treefb7baade2f3ed2837b1e81a98553e3d6e8a0e28f /sys/i386
parent9b9a63123d964a69ecc775b9e7f749c58dce551c (diff)
downloadFreeBSD-src-2ab71599b84317a27680c6710032943c65bd10a9.zip
FreeBSD-src-2ab71599b84317a27680c6710032943c65bd10a9.tar.gz
Use resource_list_print_type() instead of duplicating the code in
nexus_print_resources().
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/legacy.c36
-rw-r--r--sys/i386/i386/nexus.c36
2 files changed, 6 insertions, 66 deletions
diff --git a/sys/i386/i386/legacy.c b/sys/i386/i386/legacy.c
index d4fa131..cd45080 100644
--- a/sys/i386/i386/legacy.c
+++ b/sys/i386/i386/legacy.c
@@ -88,8 +88,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,
@@ -267,34 +265,6 @@ 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 */
- SLIST_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);
@@ -304,9 +274,9 @@ nexus_print_all_resources(device_t dev)
if (SLIST_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");
+ 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");
return retval;
}
diff --git a/sys/i386/i386/nexus.c b/sys/i386/i386/nexus.c
index d4fa131..cd45080 100644
--- a/sys/i386/i386/nexus.c
+++ b/sys/i386/i386/nexus.c
@@ -88,8 +88,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,
@@ -267,34 +265,6 @@ 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 */
- SLIST_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);
@@ -304,9 +274,9 @@ nexus_print_all_resources(device_t dev)
if (SLIST_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");
+ 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");
return retval;
}
OpenPOWER on IntegriCloud