diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-11-30 17:57:37 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-11-30 17:57:37 +0000 |
commit | e22e77b73198e1184e4fb2fe29579c2e20acdd41 (patch) | |
tree | 52a51f5936f8f07e934e1fd047e00259570d595e /sys/dev/ofw/ofw_misc.c | |
parent | 0de2fe85d5c810b0bfb4e612311c319c78595330 (diff) |
Implement mii_byname().
Diffstat (limited to 'sys/dev/ofw/ofw_misc.c')
-rw-r--r-- | sys/dev/ofw/ofw_misc.c | 23 |
1 files changed, 15 insertions, 8 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); } |