From f5207c77ac701a420a99fa6a25878f61312ef8c9 Mon Sep 17 00:00:00 2001 From: dyoung Date: Sat, 29 Dec 2007 08:19:35 +0000 Subject: [PATCH] Use LIST_FOREACH(). --- sys/dev/mii/mii.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c index a45962720d4c..1453c8e931c0 100644 --- a/sys/dev/mii/mii.c +++ b/sys/dev/mii/mii.c @@ -1,4 +1,4 @@ -/* $NetBSD: mii.c,v 1.41 2007/07/09 21:00:51 ad Exp $ */ +/* $NetBSD: mii.c,v 1.42 2007/12/29 08:19:35 dyoung Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.41 2007/07/09 21:00:51 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.42 2007/12/29 08:19:35 dyoung Exp $"); #include #include @@ -94,8 +94,7 @@ mii_attach(struct device *parent, struct mii_data *mii, int capmask, * address. This allows mii_attach() to be called * multiple times. */ - for (child = LIST_FIRST(&mii->mii_phys); child != NULL; - child = LIST_NEXT(child, mii_list)) { + LIST_FOREACH(child, &mii->mii_phys, mii_list) { if (child->mii_phy == ma.mii_phyno) { /* * Yes, there is already something @@ -169,8 +168,7 @@ mii_activate(struct mii_data *mii, enum devact act, int phyloc, int offloc) if ((mii->mii_flags & MIIF_INITDONE) == 0) return; - for (child = LIST_FIRST(&mii->mii_phys); - child != NULL; child = LIST_NEXT(child, mii_list)) { + LIST_FOREACH(child, &mii->mii_phys, mii_list) { if (phyloc != MII_PHY_ANY || offloc != MII_OFFSET_ANY) { if (phyloc != MII_PHY_ANY && phyloc != child->mii_phy) @@ -245,8 +243,7 @@ mii_mediachg(struct mii_data *mii) mii->mii_media_status = 0; mii->mii_media_active = IFM_NONE; - for (child = LIST_FIRST(&mii->mii_phys); child != NULL; - child = LIST_NEXT(child, mii_list)) { + LIST_FOREACH(child, &mii->mii_phys, mii_list) { rv = PHY_SERVICE(child, mii, MII_MEDIACHG); if (rv) return (rv); @@ -262,8 +259,7 @@ mii_tick(struct mii_data *mii) { struct mii_softc *child; - for (child = LIST_FIRST(&mii->mii_phys); child != NULL; - child = LIST_NEXT(child, mii_list)) + LIST_FOREACH(child, &mii->mii_phys, mii_list) (void) PHY_SERVICE(child, mii, MII_TICK); } @@ -278,8 +274,7 @@ mii_pollstat(struct mii_data *mii) mii->mii_media_status = 0; mii->mii_media_active = IFM_NONE; - for (child = LIST_FIRST(&mii->mii_phys); child != NULL; - child = LIST_NEXT(child, mii_list)) + LIST_FOREACH(child, &mii->mii_phys, mii_list) (void) PHY_SERVICE(child, mii, MII_POLLSTAT); } @@ -291,8 +286,7 @@ mii_down(struct mii_data *mii) { struct mii_softc *child; - for (child = LIST_FIRST(&mii->mii_phys); child != NULL; - child = LIST_NEXT(child, mii_list)) + LIST_FOREACH(child, &mii->mii_phys, mii_list) (void) PHY_SERVICE(child, mii, MII_DOWN); }