summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-11-30 17:57:37 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-11-30 17:57:37 +0000
commite22e77b73198e1184e4fb2fe29579c2e20acdd41 (patch)
tree52a51f5936f8f07e934e1fd047e00259570d595e /sys
parent0de2fe85d5c810b0bfb4e612311c319c78595330 (diff)
Implement mii_byname().
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ofw/ofw_misc.c23
-rw-r--r--sys/dev/ofw/ofw_misc.h3
2 files changed, 17 insertions, 9 deletions
diff --git a/sys/dev/ofw/ofw_misc.c b/sys/dev/ofw/ofw_misc.c
index c429348b089..b3019b8744e 100644
--- a/sys/dev/ofw/ofw_misc.c
+++ b/sys/dev/ofw/ofw_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_misc.c,v 1.26 2020/11/14 14:07:53 kettenis Exp $ */
+/* $OpenBSD: ofw_misc.c,v 1.27 2020/11/30 17:57:36 kettenis Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis
*
@@ -809,9 +809,21 @@ mii_register(struct mii_bus *md)
}
struct mii_bus *
-mii_byphandle(uint32_t phandle)
+mii_bynode(int node)
{
struct mii_bus *md;
+
+ LIST_FOREACH(md, &mii_busses, md_list) {
+ if (md->md_node == node)
+ return md;
+ }
+
+ return NULL;
+}
+
+struct mii_bus *
+mii_byphandle(uint32_t phandle)
+{
int node;
if (phandle == 0)
@@ -825,10 +837,5 @@ mii_byphandle(uint32_t phandle)
if (node == 0)
return NULL;
- LIST_FOREACH(md, &mii_busses, md_list) {
- if (md->md_node == node)
- return md;
- }
-
- return NULL;
+ return mii_bynode(node);
}
diff --git a/sys/dev/ofw/ofw_misc.h b/sys/dev/ofw/ofw_misc.h
index 75b41587173..48ad8e8356f 100644
--- a/sys/dev/ofw/ofw_misc.h
+++ b/sys/dev/ofw/ofw_misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_misc.h,v 1.16 2020/11/10 19:08:43 kettenis Exp $ */
+/* $OpenBSD: ofw_misc.h,v 1.17 2020/11/30 17:57:36 kettenis Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis
*
@@ -230,6 +230,7 @@ struct mii_bus {
};
void mii_register(struct mii_bus *);
+struct mii_bus *mii_bynode(int);
struct mii_bus *mii_byphandle(uint32_t);
#endif /* _DEV_OFW_MISC_H_ */