Use device_is_a() rathern than testing the dv_cfattach pointer.

This commit is contained in:
thorpej 2006-03-29 04:24:51 +00:00
parent 8077f13805
commit b9f91d66b8
2 changed files with 7 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_xennet.c,v 1.45 2006/03/17 06:04:24 jld Exp $ */
/* $NetBSD: if_xennet.c,v 1.46 2006/03/29 04:24:51 thorpej Exp $ */
/*
*
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_xennet.c,v 1.45 2006/03/17 06:04:24 jld Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_xennet.c,v 1.46 2006/03/29 04:24:51 thorpej Exp $");
#include "opt_inet.h"
#include "opt_nfs_boot.h"
@ -325,8 +325,7 @@ find_device(int handle)
struct xennet_softc *xs = NULL;
for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
if (dv->dv_cfattach == NULL ||
dv->dv_cfattach->ca_attach != xennet_attach)
if (!device_is_a(dv, "xennet"))
continue;
xs = (struct xennet_softc *)dv;
if (xs->sc_ifno == handle)
@ -385,8 +384,7 @@ xennet_driver_count_connected(void)
netctrl.xc_interfaces = netctrl.xc_connected = 0;
for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
if (dv->dv_cfattach == NULL ||
dv->dv_cfattach->ca_attach != xennet_attach)
if (!device_is_a(dv, "xennet"))
continue;
xs = (struct xennet_softc *)dv;
netctrl.xc_interfaces++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: xbd.c,v 1.30 2006/03/28 17:38:29 thorpej Exp $ */
/* $NetBSD: xbd.c,v 1.31 2006/03/29 04:24:51 thorpej Exp $ */
/*
*
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xbd.c,v 1.30 2006/03/28 17:38:29 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: xbd.c,v 1.31 2006/03/29 04:24:51 thorpej Exp $");
#include "xbd_hypervisor.h"
#include "rnd.h"
@ -613,8 +613,7 @@ find_device(vdisk_t *xd)
struct xbd_softc *xs = NULL;
for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
if (dv->dv_cfattach == NULL ||
dv->dv_cfattach->ca_attach != xbd_attach)
if (!device_is_a(dv, "xbd"))
continue;
xs = (struct xbd_softc *)dv;
if (xd == NULL || xs->sc_xd_device == xd->device)