Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net No functional change:
details: https://anonhg.NetBSD.org/src/rev/e07305b2d47c
branches: trunk
changeset: 356907:e07305b2d47c
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Fri Oct 20 08:04:39 2017 +0000
description:
No functional change:
- Simplify ifmedia_removeall using with ifmedia_delete_instance(IFM_INST_ANY).
- KNF.
diffstat:
sys/net/if_media.c | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
diffs (85 lines):
diff -r 964d0031083f -r e07305b2d47c sys/net/if_media.c
--- a/sys/net/if_media.c Fri Oct 20 07:06:05 2017 +0000
+++ b/sys/net/if_media.c Fri Oct 20 08:04:39 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_media.c,v 1.32 2017/01/25 07:19:24 msaitoh Exp $ */
+/* $NetBSD: if_media.c,v 1.33 2017/10/20 08:04:39 msaitoh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.32 2017/01/25 07:19:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.33 2017/10/20 08:04:39 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -206,9 +206,8 @@
if (match == NULL) {
ifmedia_add(ifm, target, 0, NULL);
match = ifmedia_match(ifm, target, ifm->ifm_mask);
- if (match == NULL) {
+ if (match == NULL)
panic("ifmedia_set failed");
- }
}
}
ifm->ifm_cur = match;
@@ -265,7 +264,7 @@
newmedia);
}
#endif
- return (EINVAL);
+ return EINVAL;
}
/*
@@ -355,10 +354,10 @@
}
default:
- return (EINVAL);
+ return EINVAL;
}
- return (error);
+ return error;
}
/*
@@ -398,8 +397,7 @@
{
struct ifmedia_entry *ife, *nife;
- for (ife = TAILQ_FIRST(&ifm->ifm_list); ife != NULL;
- ife = nife) {
+ for (ife = TAILQ_FIRST(&ifm->ifm_list); ife != NULL; ife = nife) {
nife = TAILQ_NEXT(ife, ifm_list);
if (inst == IFM_INST_ANY ||
inst == IFM_INST(ife->ifm_media)) {
@@ -412,13 +410,8 @@
void
ifmedia_removeall(struct ifmedia *ifm)
{
- struct ifmedia_entry *ife, *nife;
- for (ife = TAILQ_FIRST(&ifm->ifm_list); ife != NULL; ife = nife) {
- nife = TAILQ_NEXT(ife, ifm_list);
- TAILQ_REMOVE(&ifm->ifm_list, ife, ifm_list);
- free(ife, M_IFMEDIA);
- }
+ ifmedia_delete_instance(ifm, IFM_INST_ANY);
ifm->ifm_cur = NULL;
ifm->ifm_media = IFM_NONE;
}
@@ -443,7 +436,7 @@
}
/* Not known. */
- return (0);
+ return 0;
}
#ifdef IFMEDIA_DEBUG
Home |
Main Index |
Thread Index |
Old Index