Skip to contentSkip to conversation

MII bus API for PHY devices

PATCH In review Jason McMullan 2 participants 2 messages Nov 11, 2004 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MII bus API for PHY devices

First patch for consolidation of PHY handling into one location.

Date:        Thu, 11 Nov 2004 14:12:46 -0500
Depends:     linux-2.6.9
Description: This add a new API, in include/linux/mii_bus.h,

that allows common PHY handing code, and wrappers for IRQ and polling based PHY status. It's based off of the sungem.c interface.

###############################

Index of changes:

 drivers/net/Makefile          |    2 
 linux/drivers/net/mii_bus.c   |  857 ++++++++++++++++++++++++++++++++++++++++++
 linux/include/linux/mii_bus.h |  132 ++++++
 3 files changed, 990 insertions(+), 1 deletion(-)
drivers/net/Makefile +1 -1
@@ -62,7 +62,7 @@
 # end link order section
 #
 
-obj-$(CONFIG_MII) += mii.o
+obj-$(CONFIG_MII) += mii.o mii_bus.o
 
 obj-$(CONFIG_SUNDANCE) += sundance.o
 obj-$(CONFIG_HAMACHI) += hamachi.o
drivers/net/mii_bus.c new file +857 -0

857 lines not on this page · raw message

include/linux/mii_bus.h new file +132 -0

132 lines not on this page · raw message

Signature · 2 lines
Jason McMullan <[email protected]>
TimeSys Corporation
#1 lore raw

Jason McMullan <[email protected]> :

Quoted 1 line

First patch for consolidation of PHY handling into one location.

A little pass of polish could make it more cool imho:
- macro abuse;
- unchecked malloc;
- use plain old style multi-lines C comments (/* ...\n * ... \n * ... \n */) ?
- whitespace/tabulation damage (search for series of 2 or more spaces);
- hidden return: please put them on a separate line;
- no need to BUG_ON when there is an immediate dereference;
- mixed case variables/names (pLEAse DO not dO tHAT);
- unneeded checks ? How could VALID_BUS() in mii_bus_write() fail ?
- use goto when locking primitives are used (btw the last check in mii_bus_register is not needed and you can s/mii_bus[bus_id]/bus/ a few times in this function) ?
- add a break in mii_bus_unregister() ?
- I'd probably favor ternary operators here and there (your choice, really)
- u32 and uint16_t in the same file: choose one style ?

--
Ueimor