summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-10-15 08:50:45 +0000
committerpeter <peter@FreeBSD.org>2000-10-15 08:50:45 +0000
commitaf84d4dcdc600d52abcbf06b7c8d10a58940f3d4 (patch)
tree8c787b24dfb44343a52eda4bca6d7c91ab56c980 /sys/isa
parent9c029c0ce5709535e3b6879728a23184ca809eab (diff)
downloadFreeBSD-src-af84d4dcdc600d52abcbf06b7c8d10a58940f3d4.zip
FreeBSD-src-af84d4dcdc600d52abcbf06b7c8d10a58940f3d4.tar.gz
Untangle some resource matching loops that were getting on my nerves
and seemed to be getting cut/pasted to places they shouldn't be.
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/atkbdc_isa.c15
-rw-r--r--sys/isa/fd.c7
-rw-r--r--sys/isa/isahint.c10
3 files changed, 15 insertions, 17 deletions
diff --git a/sys/isa/atkbdc_isa.c b/sys/isa/atkbdc_isa.c
index 246e274..d2a4021 100644
--- a/sys/isa/atkbdc_isa.c
+++ b/sys/isa/atkbdc_isa.c
@@ -173,6 +173,7 @@ atkbdc_attach(device_t dev)
int error;
int rid;
int i;
+ const char *name;
unit = device_get_unit(dev);
sc = *(atkbdc_softc_t **)device_get_softc(dev);
@@ -213,22 +214,20 @@ atkbdc_attach(device_t dev)
/*
* Add all devices configured to be attached to atkbdc0.
*/
- for (i = resource_query_string(-1, "at", device_get_nameunit(dev));
- i != -1;
- i = resource_query_string(i, "at", device_get_nameunit(dev))) {
+ name = device_get_nameunit(dev);
+ i = -1;
+ while ((i = resource_query_string(i, "at", name)) != -1)
atkbdc_add_device(dev, resource_query_name(i),
resource_query_unit(i));
- }
/*
* and atkbdc?
*/
- for (i = resource_query_string(-1, "at", device_get_name(dev));
- i != -1;
- i = resource_query_string(i, "at", device_get_name(dev))) {
+ name = device_get_name(dev);
+ i = -1;
+ while ((i = resource_query_string(i, "at", name)) != -1)
atkbdc_add_device(dev, resource_query_name(i),
resource_query_unit(i));
- }
bus_generic_attach(dev);
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index c4b6a3c..214aac6 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -838,6 +838,7 @@ fdc_attach(device_t dev)
{
struct fdc_data *fdc;
int i, error;
+ const char *name;
fdc = device_get_softc(dev);
error = fdc_alloc_resources(fdc);
@@ -870,9 +871,9 @@ fdc_attach(device_t dev)
* Probe and attach any children. We should probably detect
* devices from the BIOS unless overridden.
*/
- for (i = resource_query_string(-1, "at", device_get_nameunit(dev));
- i != -1;
- i = resource_query_string(i, "at", device_get_nameunit(dev)))
+ name = device_get_nameunit(dev);
+ i = -1;
+ while ((i = resource_query_string(i, "at", name)) != -1)
fdc_add_child(dev, resource_query_name(i),
resource_query_unit(i));
diff --git a/sys/isa/isahint.c b/sys/isa/isahint.c
index 5a02ccf..6dd9b65 100644
--- a/sys/isa/isahint.c
+++ b/sys/isa/isahint.c
@@ -90,9 +90,8 @@ isahint_identify(driver_t *driver, device_t parent)
* Add all devices configured to be attached to parent.
*/
sprintf(buf, "isa%d", device_get_unit(parent));
- for (i = resource_query_string(-1, "at", buf);
- i != -1;
- i = resource_query_string(i, "at", buf)) {
+ i = -1;
+ ehile ((i = resource_query_string(i, "at", buf)) != -1) {
if (strcmp(resource_query_name(i), "atkbd") == 0)
continue; /* old GENERIC kludge */
isahint_add_device(parent,
@@ -103,9 +102,8 @@ isahint_identify(driver_t *driver, device_t parent)
/*
* and isa?
*/
- for (i = resource_query_string(-1, "at", "isa");
- i != -1;
- i = resource_query_string(i, "at", "isa")) {
+ i = -1;
+ while ((i = resource_query_string(i, "at", "isa")) != -1) {
if (strcmp(resource_query_name(i), "atkbd") == 0)
continue; /* old GENERIC kludge */
isahint_add_device(parent,
OpenPOWER on IntegriCloud