Use device_is_a()

This commit is contained in:
thorpej 2006-02-26 05:24:52 +00:00
parent 2817b4e30f
commit 132ce1f07f
17 changed files with 110 additions and 120 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: armadillo9_machdep.c,v 1.5 2006/02/18 05:04:11 thorpej Exp $ */
/* $NetBSD: armadillo9_machdep.c,v 1.6 2006/02/26 05:24:52 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc.
@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: armadillo9_machdep.c,v 1.5 2006/02/18 05:04:11 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: armadillo9_machdep.c,v 1.6 2006/02/26 05:24:52 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -318,7 +318,7 @@ armadillo9_device_register(device_t dev, void *aux)
{
/* MAC address for the built-in Ethernet. */
if (strcmp(dev->dv_cfdata->cf_name, "epe") == 0) {
if (device_is_a(dev, "epe")) {
if (devprop_set(dev, "mac-addr", armadillo9_ethaddr,
ETHER_ADDR_LEN, PROP_ARRAY, 0) != 0) {
printf("WARNING: unable to set mac-addr property "

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.10 2006/02/18 05:04:11 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.11 2006/02/26 05:24:52 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.10 2006/02/18 05:04:11 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.11 2006/02/26 05:24:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -80,8 +80,6 @@ cpu_rootconf(void)
void
device_register(struct device *dev, void *aux)
{
struct cfdata *cf = dev->dv_cfdata;
const char *name = cf->cf_name;
struct aubus_attach_args *aa = aux;
/*
@ -90,7 +88,7 @@ device_register(struct device *dev, void *aux)
*/
/* Fetch the MAC addresses from YAMON. */
if (strcmp(name, "aumac") == 0) {
if (device_is_a(dev, "aumac")) {
uint8_t ethaddr[ETHER_ADDR_LEN];
const char *cp;
char *cp0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.8 2006/02/21 04:32:38 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.9 2006/02/26 05:24:52 thorpej Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.8 2006/02/21 04:32:38 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2006/02/26 05:24:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -87,7 +87,7 @@ findroot(void)
for (dv = alldevs.tqh_first; dv != NULL;
dv = dv->dv_list.tqe_next)
if (device_class(dv) == DV_DISK &&
!strcmp(dv->dv_cfdata->cf_name, "wd"))
device_is_a(dv, "wd"))
booted_device = dv;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: obsled.c,v 1.4 2005/12/11 12:17:13 christos Exp $ */
/* $NetBSD: obsled.c,v 1.5 2006/02/26 05:24:52 thorpej Exp $ */
/*
* Copyright (c) 2004 Shigeyuki Fukushima.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: obsled.c,v 1.4 2005/12/11 12:17:13 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: obsled.c,v 1.5 2006/02/26 05:24:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -186,8 +186,7 @@ obs266_led_set(int led)
* Do you have something better idea?
*/
for (dp = TAILQ_FIRST(dlp); dp != NULL; dp = TAILQ_NEXT(dp, dv_list)) {
if (dp->dv_cfdata != NULL
&& strcmp(dp->dv_cfdata->cf_name, "obsled") == 0) {
if (device_is_a(dp, "obsles")) {
struct obsled_softc *sc = (struct obsled_softc *)dp;
sc->sc_led_state =
(led & (1 << dp->dv_unit)) >> dp->dv_unit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: obs405_autoconf.c,v 1.3 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: obs405_autoconf.c,v 1.4 2006/02/26 05:24:52 thorpej Exp $ */
/*
* Copyright 2004 Shigeyuki Fukushima.
@ -33,7 +33,7 @@
* DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: obs405_autoconf.c,v 1.3 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: obs405_autoconf.c,v 1.4 2006/02/26 05:24:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -58,8 +58,7 @@ obs405_device_register(struct device *dev, void *aux, int com_freq)
struct device *parent = device_parent(dev);
/* register "com" device */
if (strcmp(dev->dv_cfdata->cf_name, "com") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
if (device_is_a(dev, "com") && device_is_a(parent, "opb")) {
/* Set the frequency of the on-chip UART. */
com_opb_device_register(dev, com_freq);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.11 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.12 2006/02/26 05:24:52 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.11 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.12 2006/02/26 05:24:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -95,8 +95,7 @@ device_register(struct device *dev, void *aux)
{
struct device *parent = device_parent(dev);
if (strcmp(dev->dv_cfdata->cf_name, "com") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
if (device_is_a(dev, "com") && device_is_a(parent, "opb")) {
/* Set the frequency of the on-chip UART. */
int freq = COM_FREQ * 6;
@ -107,8 +106,7 @@ device_register(struct device *dev, void *aux)
return;
}
if (strcmp(dev->dv_cfdata->cf_name, "emac") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
if (device_is_a(dev, "emac") && device_is_a(parent, "opb")) {
/* Set the mac-addr of the on-chip Ethernet. */
/* XXX 405GP only has one; what about CPUs with two? */
if (devprop_set(dev, "mac-addr",

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.76 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.77 2006/02/26 05:31:54 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc.
@ -143,7 +143,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.76 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.77 2006/02/26 05:31:54 thorpej Exp $");
#include "hil.h"
#include "dvbox.h"
@ -472,16 +472,16 @@ device_register(struct device *dev, void *aux)
goto linkup;
}
if (memcmp(dev->dv_xname, "fhpib", 5) == 0 ||
memcmp(dev->dv_xname, "nhpib", 5) == 0 ||
memcmp(dev->dv_xname, "spc", 3) == 0) {
if (device_is_a(dev, "fhpib") ||
device_is_a(dev, "nhpib") ||
device_is_a(dev, "spc")) {
struct dio_attach_args *da = aux;
dd->dd_scode = da->da_scode;
goto linkup;
}
if (memcmp(dev->dv_xname, "rd", 2) == 0) {
if (device_is_a(dev, "rd")) {
struct hpibbus_attach_args *ha = aux;
dd->dd_slave = ha->ha_slave;
@ -489,7 +489,7 @@ device_register(struct device *dev, void *aux)
goto linkup;
}
if (memcmp(dev->dv_xname, "sd", 2) == 0) {
if (device_is_a(dev, "sd")) {
struct scsipibus_attach_args *sa = aux;
dd->dd_slave = sa->sa_periph->periph_target;
@ -506,13 +506,13 @@ device_register(struct device *dev, void *aux)
linkup:
LIST_INSERT_HEAD(&dev_data_list, dd, dd_list);
if (memcmp(dev->dv_xname, "fhpib", 5) == 0 ||
memcmp(dev->dv_xname, "nhpib", 5) == 0) {
if (device_is_a(dev, "fhpib") ||
device_is_a(dev, "nhpib")) {
dev_data_insert(dd, &dev_data_list_hpib);
return;
}
if (memcmp(dev->dv_xname, "spc", 3) == 0) {
if (device_is_a(dev, "spc")) {
dev_data_insert(dd, &dev_data_list_scsi);
return;
}
@ -576,8 +576,8 @@ findbootdev(void)
/*
* Sanity check.
*/
if ((type == 0 && memcmp(booted_device->dv_xname, "ct", 2)) ||
(type == 2 && memcmp(booted_device->dv_xname, "rd", 2))) {
if ((type == 0 && !device_is_a(booted_device, "ct")) ||
(type == 2 && !device_is_a(booted_device, "rd"))) {
printf("WARNING: boot device/type mismatch!\n");
printf("device = %s, type = %d\n",
booted_device->dv_xname, type);
@ -598,7 +598,7 @@ findbootdev(void)
/*
* Sanity check.
*/
if ((type == 4 && memcmp(booted_device->dv_xname, "sd", 2))) {
if ((type == 4 && !device_is_a(booted_device, "sd"))) {
printf("WARNING: boot device/type mismatch!\n");
printf("device = %s, type = %d\n",
booted_device->dv_xname, type);
@ -694,11 +694,11 @@ setbootdev(void)
/*
* Determine device type.
*/
if (memcmp(root_device->dv_xname, "rd", 2) == 0)
if (device_is_a(root_device, "rd") == 0)
type = 2;
else if (memcmp(root_device->dv_xname, "sd", 2) == 0)
else if (device_is_a(root_device, "sd") == 0)
type = 4;
else if (memcmp(root_device->dv_xname, "md", 2) == 0)
else if (device_is_a(root_device, "md") == 0)
goto out;
else {
printf("WARNING: strange root device!\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.21 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.22 2006/02/26 05:31:54 thorpej Exp $ */
/* $OpenBSD: autoconf.c,v 1.15 2001/06/25 00:43:10 mickey Exp $ */
@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.21 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.22 2006/02/26 05:31:54 thorpej Exp $");
#include "opt_kgdb.h"
#include "opt_useleds.h"
@ -338,7 +338,7 @@ device_register(struct device *dev, void *aux)
* controller's struct dev in boot_device. The SCSI device is located
* later, see below.
*/
if (strcmp(pdev->dv_cfdata->cf_name, "gsc") == 0
if (device_is_a(pdev, "gsc")
&& (hppa_hpa_t)PAGE0->mem_boot.pz_hpa ==
((struct gsc_attach_args *)aux)->ga_ca.ca_hpa)
/* This is (the controller of) the boot device. */
@ -357,7 +357,7 @@ device_register(struct device *dev, void *aux)
* on a match. In case of a SCSI boot device we have to do the same
* check when SCSI devices are attached like on GSC SCSI controllers.
*/
if (strcmp(dev->dv_cfdata->cf_name, "dino") == 0) {
if (device_is_a(dev, "dino")) {
struct confargs *ca = (struct confargs *)aux;
int i, n;
@ -384,7 +384,7 @@ device_register(struct device *dev, void *aux)
boot_device = dev;
}
/* XXX Guesswork. No hardware to test how firmware handles a ppb. */
if (strcmp(dev->dv_cfdata->cf_name, "ppb") == 0
if (device_is_a(dev, "ppb")
&& boot_device == device_parent(pdev)
&& ((struct pci_attach_args*)aux)->pa_device
== PAGE0->mem_boot.pz_dp.dp_bc[3]
@ -392,7 +392,7 @@ device_register(struct device *dev, void *aux)
== PAGE0->mem_boot.pz_dp.dp_bc[4])
/* This is the PCI - PCI bridge in front of the boot device. */
boot_device = dev;
if (strcmp(pdev->dv_cfdata->cf_name, "pci") == 0
if (device_is_a(pdev, "pci")
&& boot_device == device_parent(pdev)
&& ((struct pci_attach_args*)aux)->pa_device
== PAGE0->mem_boot.pz_dp.dp_bc[5]
@ -406,7 +406,7 @@ device_register(struct device *dev, void *aux)
* the SCSI ID and LUN with the DP layer information. If they match
* we found the boot device.
*/
if (strcmp(pdev->dv_cfdata->cf_name, "scsibus") == 0
if (device_is_a(pdev, "scsibus")
&& boot_device == device_parent(pdev)
&& ((struct scsipibus_attach_args *)aux)->sa_periph->periph_target
== PAGE0->mem_boot.pz_dp.dp_layers[0]
@ -446,8 +446,7 @@ cpu_rootconf(void)
#endif /* DEBUG */
if (boot_device != NULL)
printf("boot device: %s%d\n", boot_device->dv_cfdata->cf_name,
boot_device->dv_unit);
printf("boot device: %s\n", boot_device->dv_xname );
setroot(boot_device, 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.3 2006/02/22 00:23:52 gavan Exp $ */
/* $NetBSD: autoconf.c,v 1.4 2006/02/26 05:31:54 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2006/02/22 00:23:52 gavan Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2006/02/26 05:31:54 thorpej Exp $");
#include "opt_md.h"
@ -111,8 +111,10 @@ cpu_configure(void)
void
device_register(struct device *dev, void *aux)
{
if (dev->dv_parent != NULL &&
strcmp(dev->dv_parent->dv_cfdata->cf_name, "pci") == 0) {
struct device *pdev;
if ((pdev = device_parent(dev)) != NULL &&
device_is_a(pdev, "pci") == 0) {
struct pci_attach_args *pa = aux;
if (BUILTIN_ETHERNET_P(pa)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.41 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.42 2006/02/26 05:31:54 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.41 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.42 2006/02/26 05:31:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -152,13 +152,11 @@ device_register(dev, aux)
static struct device *controller;
static int foundboot;
struct device *parent = device_parent(dev);
const char *name = dev->dv_cfdata->cf_name;
if (foundboot)
return;
if (controller == NULL && parent) {
const char *pname = parent->dv_cfdata->cf_name;
switch (machineid) {
#ifdef MVME147
@ -168,17 +166,17 @@ device_register(dev, aux)
* onboard scsi and ethernet. So ensure this
* device's parent is the PCC driver.
*/
if (strcmp(pname, "pcc"))
if (!device_is_a(parent, "pcc"))
return;
if (bootaddr == PCC_PADDR(PCC_WDSC_OFF) &&
strcmp(name, "wdsc") == 0) {
device_is_a(dev, "wdsc")) {
controller = dev;
return;
}
if (bootaddr == PCC_PADDR(PCC_LE_OFF) &&
strcmp(name, "le") == 0) {
device_is_a(dev, "le")) {
booted_device = dev;
foundboot = 1;
return;
@ -197,17 +195,17 @@ device_register(dev, aux)
* 17x onboard scsi and ethernet. So ensure this
* device's parent is the PCCTWO driver.
*/
if (strcmp(pname, "pcctwo"))
if (!device_is_a(parent, "pcctwo"))
return;
if (bootaddr == PCCTWO_PADDR(PCCTWO_NCRSC_OFF) &&
strcmp(name, "osiop") == 0) {
device_is_a(dev, "osiop")) {
controller = dev;
return;
}
if (bootaddr == PCCTWO_PADDR(PCCTWO_IE_OFF) &&
strcmp(name, "ie") == 0) {
device_is_a(dev, "ie")) {
booted_device = dev;
foundboot = 1;
return;
@ -226,9 +224,9 @@ device_register(dev, aux)
/*
* Find out which device on the scsibus we booted from
*/
if (strcmp(name, "sd") == 0 ||
strcmp(name, "cd") == 0 ||
strcmp(name, "st") == 0) {
if (device_is_a(dev, "sd") ||
device_is_a(dev, "cd") ||
device_is_a(dev, "st")) {
struct scsipibus_attach_args *sa = aux;
if (device_parent(parent) != controller ||

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.41 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.42 2006/02/26 05:31:54 thorpej Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.41 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.42 2006/02/26 05:31:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -109,7 +109,6 @@ device_register(dev, aux)
static int found;
static struct device *booted_controller;
struct device *parent = device_parent(dev);
const char *name = dev->dv_cfdata->cf_name;
if (found)
return;
@ -117,7 +116,7 @@ device_register(dev, aux)
/*
* Check for NCR SCSI controller.
*/
if (strcmp(name, "ncr") == 0) {
if (device_is_a(dev, "ncr")) {
booted_controller = dev;
return;
}
@ -128,8 +127,9 @@ device_register(dev, aux)
* If we found the boot controller, if check disk/cdrom device
* on that controller matches.
*/
if (booted_controller && (strcmp(name, "sd") == 0 ||
strcmp(name, "cd") == 0)) {
if (booted_controller &&
(device_is_a(dev, "sd") ||
device_is_a(dev, "cd") == 0)) {
struct scsipibus_attach_args *sa = aux;
if (device_parent(parent) != booted_controller)

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.69 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.70 2006/02/26 05:31:54 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.69 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.70 2006/02/26 05:31:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -204,8 +204,6 @@ device_register(dev, aux)
static int found, initted, scsiboot, netboot;
static struct device *ioasicdev;
struct device *parent = device_parent(dev);
struct cfdata *cf = dev->dv_cfdata;
const char *name = cf->cf_name;
if (found)
return;
@ -220,7 +218,7 @@ device_register(dev, aux)
/*
* Check if IOASIC was the boot slot.
*/
if (strcmp(name, "ioasic") == 0) {
if (device_is_a(dev, "ioasic")) {
struct tc_attach_args *ta = aux;
if (ta->ta_slot == booted_slot)
@ -231,7 +229,7 @@ device_register(dev, aux)
/*
* Check for ASC controller on either IOASIC or TC option card.
*/
if (scsiboot && strcmp(name, "asc") == 0) {
if (scsiboot && device_is_a(dev, "asc")) {
struct tc_attach_args *ta = aux;
/*
@ -251,7 +249,7 @@ device_register(dev, aux)
* If an SII device is configured, it's currently the only
* possible SCSI boot device.
*/
if (scsiboot && strcmp(name, "sii") == 0) {
if (scsiboot && device_is_a(dev, "sii")) {
booted_controller = dev;
return;
}
@ -260,9 +258,10 @@ device_register(dev, aux)
* If we found the boot controller, if check disk/tape/cdrom device
* on that controller matches.
*/
if (booted_controller && (strcmp(name, "sd") == 0 ||
strcmp(name, "st") == 0 ||
strcmp(name, "cd") == 0)) {
if (booted_controller &&
(device_is_a(dev, "sd") ||
device_is_a(dev, "st") ||
device_is_a(dev, "cd"))) {
struct scsipibus_attach_args *sa = aux;
if (device_parent(parent) != booted_controller)
@ -287,15 +286,15 @@ device_register(dev, aux)
#endif
/* Only one Ethernet interface at IOASIC. */
parent == ioasicdev)
&& strcmp(name, "le") == 0) {
&& device_is_a(dev, "le")) {
booted_device = dev;
found = 1;
return;
}
/* allow any TC network adapter */
if (dev->dv_cfdriver->cd_class == DV_IFNET &&
strcmp(parent->dv_cfdriver->cd_name, "tc") == 0 &&
if (device_class(dev) == DV_IFNET &&
device_is_a(parent, "tc") &&
ta->ta_slot == booted_slot) {
booted_device = dev;
found = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibm4xx_autoconf.c,v 1.6 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: ibm4xx_autoconf.c,v 1.7 2006/02/26 05:31:54 thorpej Exp $ */
/* Original Tag: ibm4xxgpx_autoconf.c,v 1.2 2004/10/23 17:12:22 thorpej Exp $ */
/*
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.6 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.7 2006/02/26 05:31:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -52,8 +52,8 @@ ibm4xx_device_register(struct device *dev, void *aux)
{
struct device *parent = device_parent(dev);
if (strcmp(dev->dv_cfdata->cf_name, "emac") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
if (device_is_a(dev, "emac") == 0 &&
device_is_a(parent, "opb") == 0) {
/* Set the mac-addr of the on-chip Ethernet. */
struct opb_attach_args *oaa = aux;

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.26 2006/02/23 05:37:47 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.27 2006/02/26 05:31:54 thorpej Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.26 2006/02/23 05:37:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.27 2006/02/26 05:31:54 thorpej Exp $");
#include "opt_ddb.h"
@ -173,8 +173,6 @@ device_register(struct device *dev, void *aux)
{
static int found, initted, scsiboot, netboot;
struct device *parent = device_parent(dev);
struct cfdata *cf = dev->dv_cfdata;
const char *name = cf->cf_name;
if (found)
return;
@ -190,8 +188,8 @@ device_register(struct device *dev, void *aux)
* wdsc -- IP12/22/24
* ahc -- IP32
*/
if ( (scsiboot && strcmp(name, "wdsc") == 0) ||
(scsiboot && strcmp(name, "ahc") == 0) ) {
if ( (scsiboot && device_is_a(dev, "wdsc")) ||
(scsiboot && device_is_a(dev, "ahc")) ) {
if (dev->dv_unit == booted_slot)
booted_controller = dev;
return;
@ -201,9 +199,10 @@ device_register(struct device *dev, void *aux)
* If we found the boot controller, if check disk/tape/cdrom device
* on that controller matches.
*/
if (booted_controller && (strcmp(name, "sd") == 0 ||
strcmp(name, "st") == 0 ||
strcmp(name, "cd") == 0)) {
if (booted_controller &&
(device_is_a(dev, "sd") ||
device_is_a(dev, "st") ||
device_is_a(dev, "cd"))) {
struct scsipibus_attach_args *sa = aux;
if (device_parent(parent) != booted_controller)
@ -218,8 +217,9 @@ device_register(struct device *dev, void *aux)
/*
* Check if netboot device.
*/
if (netboot && (strcmp(name, "sq") == 0 ||
strcmp(name, "mec") == 0)) {
if (netboot &&
(device_is_a(dev, "sq") ||
device_is_a(dev, "mec"))) {
/* XXX Check unit number? (Which we don't parse yet) */
booted_device = dev;
found = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: opms.c,v 1.15 2005/12/11 12:19:05 christos Exp $ */
/* $NetBSD: opms.c,v 1.16 2006/02/26 05:31:54 thorpej Exp $ */
/*
* Copyright 1997
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: opms.c,v 1.15 2005/12/11 12:19:05 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: opms.c,v 1.16 2006/02/26 05:31:54 thorpej Exp $");
#include "opms.h"
#if NOPMS > 1
@ -270,9 +270,9 @@ opmsprobe(parent, match, aux)
** the console drivers. (We really wish we could be the
** child of a real keyboard controller driver.)
*/
if ((parent != NULL) &&
(!strcmp(parent->dv_cfdata->cf_name, "pc") ||
(!strcmp(parent->dv_cfdata->cf_name, "vt"))))
if (parent != NULL &&
(device_is_a(parent, "pc") ||
device_is_a(parent, "vt")))
{
/*
** The mouse shares registers with the parent, so

View File

@ -1,4 +1,4 @@
/* $NetBSD: scr.c,v 1.15 2005/12/11 12:19:05 christos Exp $ */
/* $NetBSD: scr.c,v 1.16 2006/02/26 05:31:54 thorpej Exp $ */
/*
* Copyright 1997
@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scr.c,v 1.15 2005/12/11 12:19:05 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: scr.c,v 1.16 2006/02/26 05:31:54 thorpej Exp $");
#include "opt_ddb.h"
@ -712,8 +712,7 @@ int scrprobe(parent, match, aux)
KERN_DEBUG (scrdebug, SCRPROBE_DEBUG_INFO,("scrprobe: called, name = %s\n",
parent->dv_cfdata->cf_name));
if (strcmp(parent->dv_cfdata->cf_name, "ofisascr") == 0 &&
devices == 0)
if (device_is_a(parent, "ofisascr") && devices == 0)
{
/* set "devices" to ensure that we respond only once */
devices++;
@ -776,7 +775,7 @@ void scrattach(parent, self, aux)
struct scr_softc *sc = (void *)self;
printf("\n");
if (!strcmp(parent->dv_cfdata->cf_name, "ofisascr"))
if (device_is_a(parent, "ofisascr"))
{
KERN_DEBUG (scrdebug, SCRATTACH_DEBUG_INFO,("scrattach: called \n"));

View File

@ -1,4 +1,4 @@
/* $NetBSD: shark_machdep.c,v 1.22 2006/02/23 05:37:48 thorpej Exp $ */
/* $NetBSD: shark_machdep.c,v 1.23 2006/02/26 05:31:54 thorpej Exp $ */
/*
* Copyright 1997
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: shark_machdep.c,v 1.22 2006/02/23 05:37:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: shark_machdep.c,v 1.23 2006/02/26 05:31:54 thorpej Exp $");
#include "opt_ddb.h"
@ -389,7 +389,6 @@ ofw_device_register(struct device *dev, void *aux)
#endif
static char *boot_component;
struct ofbus_attach_args *oba;
const char *cd_name = dev->dv_cfdata->cf_name;
char name[64];
int i;
@ -419,26 +418,26 @@ ofw_device_register(struct device *dev, void *aux)
|| boot_component[0] == '\0')
return;
if (!strcmp(cd_name, "ofbus") || !strcmp(cd_name, "ofisa")) {
if (device_is_a(dev, "ofbus") || device_is_a(dev, "ofisa")) {
oba = aux;
} else if (parent == NULL) {
return;
} else if (parent == device_parent(dev)
&& !strcmp(parent->dv_cfdata->cf_name, "ofisa")) {
&& device_is_a(parent, "ofisa")) {
struct ofisa_attach_args *aa = aux;
oba = &aa->oba;
#if NWD > 0 || NSD > 0 || NCD > 0
} else if (device_parent(device_parent(dev)) != NULL
&& parent == device_parent(device_parent(dev))
&& !strcmp(parent->dv_cfdata->cf_name, "wdc")) {
&& device_is_a(parent, "wdc")) {
#if NSD > 0 || NCD > 0
if (!strcmp(cd_name, "atapibus")) {
if (device_is_a(dev, "atapibus")) {
scsipidev = dev;
return;
}
#endif
#if NWD > 0
if (!strcmp(cd_name, "wd")) {
if (device_is_a(dev, "wd")) {
struct ata_device *adev = aux;
char *cp = strchr(boot_component, '@');
if (cp != NULL
@ -452,7 +451,7 @@ ofw_device_register(struct device *dev, void *aux)
#endif /* NWD > 0 */
#if NSD > 0 || NCD > 0
} else if (scsipidev == device_parent(dev)
&& (!strcmp(cd_name, "sd") || !strcmp(cd_name, "cd"))) {
&& (device_is_a(dev, "sd") || device_is_a(dev, "cd"))) {
struct scsipibus_attach_args *sa = aux;
char *cp = strchr(boot_component, '@');
if (cp != NULL