summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-09-04 03:11:20 +0000
committerjhb <jhb@FreeBSD.org>2002-09-04 03:11:20 +0000
commit63ecc1767c44e2826d7f11e6c57b0b4b27244562 (patch)
tree17e757c7da718f1eccfc8f8e6378c741e655e15d /sys/dev/acpica/acpi.c
parenteadd2de4a6e46f2d7ebf9a6d45e19ebc83fd30dd (diff)
downloadFreeBSD-src-63ecc1767c44e2826d7f11e6c57b0b4b27244562.zip
FreeBSD-src-63ecc1767c44e2826d7f11e6c57b0b4b27244562.tar.gz
Use resource_list_print_types() instead of duplicating the code.
Diffstat (limited to 'sys/dev/acpica/acpi.c')
-rw-r--r--sys/dev/acpica/acpi.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 78eceb6..97294201 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -103,8 +103,6 @@ static void acpi_identify(driver_t *driver, device_t parent);
static int acpi_probe(device_t dev);
static int acpi_attach(device_t dev);
static device_t acpi_add_child(device_t bus, int order, const char *name, int unit);
-static int acpi_print_resources(struct resource_list *rl, const char *name, int type,
- const char *format);
static int acpi_print_child(device_t bus, device_t child);
static int acpi_read_ivar(device_t dev, device_t child, int index, uintptr_t *result);
static int acpi_write_ivar(device_t dev, device_t child, int index, uintptr_t value);
@@ -532,40 +530,6 @@ acpi_add_child(device_t bus, int order, const char *name, int unit)
return(child);
}
-/*
- * Print child device resource usage
- */
-static int
-acpi_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;
-
- if (!SLIST_FIRST(rl))
- return(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
acpi_print_child(device_t bus, device_t child)
{
@@ -574,10 +538,10 @@ acpi_print_child(device_t bus, device_t child)
int retval = 0;
retval += bus_print_child_header(bus, child);
- retval += acpi_print_resources(rl, "port", SYS_RES_IOPORT, "%#lx");
- retval += acpi_print_resources(rl, "iomem", SYS_RES_MEMORY, "%#lx");
- retval += acpi_print_resources(rl, "irq", SYS_RES_IRQ, "%ld");
- retval += acpi_print_resources(rl, "drq", SYS_RES_DRQ, "%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");
+ retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%ld");
retval += bus_print_child_footer(bus, child);
return(retval);
OpenPOWER on IntegriCloud