Module Name:    src
Committed By:   tsutsui
Date:           Wed Jun 17 15:42:00 UTC 2009

Modified Files:
        src/sys/dev/mii: brgphy.c

Log Message:
- 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


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/mii/brgphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.46 src/sys/dev/mii/brgphy.c:1.47
--- src/sys/dev/mii/brgphy.c:1.46	Tue May 12 14:31:27 2009
+++ src/sys/dev/mii/brgphy.c	Wed Jun 17 15:42:00 2009
@@ -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 @@
 	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 @@
 		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",

Reply via email to