Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by msait...
details: https://anonhg.NetBSD.org/src/rev/a5f4d5582256
branches: netbsd-8
changeset: 434411:a5f4d5582256
user: martin <martin%NetBSD.org@localhost>
date: Wed Nov 22 14:36:55 2017 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #370):
sys/net/if_media.c: revision 1.33
sys/net/if_media.c: revision 1.34
No functional change:
- Simplify ifmedia_removeall using with ifmedia_delete_instance(IFM_INST_ANY).
- KNF.
Clear ifm_cur and ifm_media after removing all ifmedia entries(IFM_INST_ANY)
in ifmedia_delete_instance() like if_media.c rev. 1.32.
Now if_media_delete_instance(IFM_INST_ANY) is the same as ifmedia_removeall().
diffstat:
sys/net/if_media.c | 31 +++++++++++++------------------
1 files changed, 13 insertions(+), 18 deletions(-)
diffs (96 lines):
diff -r b6b28b890b5c -r a5f4d5582256 sys/net/if_media.c
--- a/sys/net/if_media.c Wed Nov 22 14:33:23 2017 +0000
+++ b/sys/net/if_media.c Wed Nov 22 14:36:55 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.32.6.1 2017/11/22 14:36:55 martin 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.32.6.1 2017/11/22 14:36:55 martin 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)) {
@@ -407,20 +405,17 @@
free(ife, M_IFMEDIA);
}
}
+ if (inst == IFM_INST_ANY) {
+ ifm->ifm_cur = NULL;
+ ifm->ifm_media = IFM_NONE;
+ }
}
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);
- }
- ifm->ifm_cur = NULL;
- ifm->ifm_media = IFM_NONE;
+ ifmedia_delete_instance(ifm, IFM_INST_ANY);
}
@@ -443,7 +438,7 @@
}
/* Not known. */
- return (0);
+ return 0;
}
#ifdef IFMEDIA_DEBUG
Home |
Main Index |
Thread Index |
Old Index