aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2003-07-02 16:09:02 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2003-07-02 16:09:02 +0000
commit8a9bc9c03ba8dfc43d5f5ca07166c6a40b54f5e6 (patch)
tree24843831a3541cd5733aaad746e1a57206e1e21f /sys/dev
parent6591b310403469e94313efd7659f95f747192712 (diff)
downloadsrc-8a9bc9c03ba8dfc43d5f5ca07166c6a40b54f5e6.tar.gz
src-8a9bc9c03ba8dfc43d5f5ca07166c6a40b54f5e6.zip
- Use the new resource_disabled() helper function to see if devices are
disabled. - Change the apm driver to match the acpi driver's behavior by checking to see if the device is disabled in the identify routine instead of in the probe routine. This way if the device is disabled it is never created. Note that a few places (ips(4), Alpha SMP) used "disable" instead of "disabled" for their hint names, and these hints must be changed to "disabled". If this is a big problem, resource_disabled() can always be changed to honor both names.
Notes
Notes: svn path=/head/; revision=117167
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi.c7
-rw-r--r--sys/dev/atkbdc/atkbd.c3
-rw-r--r--sys/dev/atkbdc/atkbdc_isa.c2
-rw-r--r--sys/dev/atkbdc/atkbdc_subr.c2
-rw-r--r--sys/dev/fdc/fdc.c5
-rw-r--r--sys/dev/ips/ips_pci.c5
-rw-r--r--sys/dev/kbd/atkbd.c3
-rw-r--r--sys/dev/sio/sio.c8
8 files changed, 12 insertions, 23 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index c5f920e7cbc8..4d4b22183a02 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -215,8 +215,7 @@ acpi_identify(driver_t *driver, device_t parent)
/*
* Check that we haven't been disabled with a hint.
*/
- if (!resource_int_value("acpi", 0, "disabled", &error) &&
- (error != 0))
+ if (resource_disabled("acpi", 0))
return_VOID;
/*
@@ -2175,13 +2174,11 @@ out:
static void
acpi_pm_register(void *arg)
{
- int error;
if (!cold)
return;
- if (!resource_int_value("acpi", 0, "disabled", &error) &&
- (error != 0))
+ if (resource_disabled("acpi", 0))
return;
power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, NULL);
diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c
index edf6489310f8..569f14bbd227 100644
--- a/sys/dev/atkbdc/atkbd.c
+++ b/sys/dev/atkbdc/atkbd.c
@@ -277,8 +277,7 @@ atkbd_configure(int flags)
atkbdc_configure();
/* if the driver is disabled, unregister the keyboard if any */
- if ((resource_int_value("atkbd", ATKBD_DEFAULT, "disabled", &i) == 0)
- && i != 0) {
+ if (resource_disabled("atkbd", ATKBD_DEFAULT)) {
i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT);
if (i >= 0) {
kbd = kbd_get_keyboard(i);
diff --git a/sys/dev/atkbdc/atkbdc_isa.c b/sys/dev/atkbdc/atkbdc_isa.c
index 7dbe02a02bc4..2618adfed7c3 100644
--- a/sys/dev/atkbdc/atkbdc_isa.c
+++ b/sys/dev/atkbdc/atkbdc_isa.c
@@ -255,7 +255,7 @@ atkbdc_add_child(device_t bus, int order, char *name, int unit)
if (resource_int_value(name, unit, "flags", &t) == 0)
device_set_flags(child, t);
- if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
+ if (resource_disabled(name, unit))
device_disable(child);
device_set_ivars(child, ivar);
diff --git a/sys/dev/atkbdc/atkbdc_subr.c b/sys/dev/atkbdc/atkbdc_subr.c
index 7dbe02a02bc4..2618adfed7c3 100644
--- a/sys/dev/atkbdc/atkbdc_subr.c
+++ b/sys/dev/atkbdc/atkbdc_subr.c
@@ -255,7 +255,7 @@ atkbdc_add_child(device_t bus, int order, char *name, int unit)
if (resource_int_value(name, unit, "flags", &t) == 0)
device_set_flags(child, t);
- if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
+ if (resource_disabled(name, unit))
device_disable(child);
device_set_ivars(child, ivar);
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 7d30d8f90c1e..5346144d8181 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -973,7 +973,7 @@ fdc_detach(device_t dev)
static void
fdc_add_child(device_t dev, const char *name, int unit)
{
- int disabled, flags;
+ int flags;
struct fdc_ivars *ivar;
device_t child;
@@ -990,8 +990,7 @@ fdc_add_child(device_t dev, const char *name, int unit)
device_set_ivars(child, ivar);
if (resource_int_value(name, unit, "flags", &flags) == 0)
device_set_flags(child, flags);
- if (resource_int_value(name, unit, "disabled", &disabled) == 0
- && disabled != 0)
+ if (resource_disabled(name, unit))
device_disable(child);
}
diff --git a/sys/dev/ips/ips_pci.c b/sys/dev/ips/ips_pci.c
index 81fa0e6655e3..8cda989bf5a0 100644
--- a/sys/dev/ips/ips_pci.c
+++ b/sys/dev/ips/ips_pci.c
@@ -50,13 +50,10 @@ static int ips_pci_probe(device_t dev)
static int ips_pci_attach(device_t dev)
{
u_int32_t command;
- int tval;
ips_softc_t *sc;
- tval = 0;
- if (resource_int_value(device_get_name(dev), device_get_unit(dev),
- "disable", &tval) == 0 && tval) {
+ if (resource_disabled(device_get_name(dev), device_get_unit(dev))) {
device_printf(dev, "device is disabled\n");
/* but return 0 so the !$)$)*!$*) unit isn't reused */
return (0);
diff --git a/sys/dev/kbd/atkbd.c b/sys/dev/kbd/atkbd.c
index edf6489310f8..569f14bbd227 100644
--- a/sys/dev/kbd/atkbd.c
+++ b/sys/dev/kbd/atkbd.c
@@ -277,8 +277,7 @@ atkbd_configure(int flags)
atkbdc_configure();
/* if the driver is disabled, unregister the keyboard if any */
- if ((resource_int_value("atkbd", ATKBD_DEFAULT, "disabled", &i) == 0)
- && i != 0) {
+ if (resource_disabled("atkbd", ATKBD_DEFAULT)) {
i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT);
if (i >= 0) {
kbd = kbd_get_keyboard(i);
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 330407852584..898a6667287d 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -2967,11 +2967,9 @@ siocnprobe(cp)
for (unit = 0; unit < 16; unit++) { /* XXX need to know how many */
int flags;
- int disabled;
- if (resource_int_value("sio", unit, "disabled", &disabled) == 0) {
- if (disabled)
- continue;
- }
+
+ if (resource_disabled("sio", unit))
+ continue;
if (resource_int_value("sio", unit, "flags", &flags))
continue;
if (COM_CONSOLE(flags) || COM_DEBUGGER(flags)) {