- no need to use device_parent() because device_t parent is passed

via config_attach(9)
- use device_is_a() rather than strcmp() for readability
This commit is contained in:
tsutsui 2009-06-17 15:42:00 +00:00
parent 3152f584bd
commit a86f73dc93

View File

@ -1,4 +1,4 @@
/* $NetBSD: brgphy.c,v 1.46 2009/05/12 14:31:27 cegger Exp $ */
/* $NetBSD: brgphy.c,v 1.47 2009/06/17 15:42:00 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.46 2009/05/12 14:31:27 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.47 2009/06/17 15:42:00 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -207,7 +207,6 @@ brgphyattach(device_t parent, device_t self, void *aux)
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
prop_dictionary_t dict;
const char *devname;
mpd = mii_phy_match(ma, brgphys);
aprint_naive(": Media interface\n");
@ -238,14 +237,12 @@ brgphyattach(device_t parent, device_t self, void *aux)
mii_phy_add_media(sc);
aprint_normal("\n");
parent = device_parent(sc->mii_dev);
devname = parent->dv_cfdriver->cd_name;
if (strcmp(devname, "bge") == 0) {
if (device_is_a(parent, "bge")) {
bsc->sc_isbge = 1;
dict = device_properties(parent);
prop_dictionary_get_uint32(dict, "phyflags",
&bsc->sc_bge_flags);
} else if (strcmp(devname, "bnx") == 0) {
} else if (device_is_a(parent, "bnx")) {
bsc->sc_isbnx = 1;
dict = device_properties(parent);
prop_dictionary_get_uint32(dict, "phyflags",