From 27b16ba9a8d255994c02ece150dfe324f21c064e Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sat, 1 Oct 2005 06:36:11 +0000 Subject: [PATCH] - make declaration of ed_get_packet(), ed_ring_copy(), ed_hpp_readmem() and ed_hpp_writemem() consistent with their definition - remove unused stack variable `sc' in ed_isa_probe() - ANSIfy Submitted-by: Matthias Schmidt - use u_short and u_char instead of "unsigned {short, char}" --- sys/dev/netif/ed/if_ed.c | 200 +++++++++----------------------- sys/dev/netif/ed/if_ed_isa.c | 9 +- sys/dev/netif/ed/if_ed_pccard.c | 16 +-- sys/dev/netif/ed/if_edvar.h | 10 +- 4 files changed, 69 insertions(+), 166 deletions(-) diff --git a/sys/dev/netif/ed/if_ed.c b/sys/dev/netif/ed/if_ed.c index 06f36e2c93..1e7cae60c3 100644 --- a/sys/dev/netif/ed/if_ed.c +++ b/sys/dev/netif/ed/if_ed.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ed/if_ed.c,v 1.224 2003/12/08 07:54:12 obrien Exp $ - * $DragonFly: src/sys/dev/netif/ed/if_ed.c,v 1.25 2005/06/20 15:10:40 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ed/if_ed.c,v 1.26 2005/10/01 06:36:11 sephe Exp $ */ /* @@ -91,22 +91,18 @@ static void ed_tick (void *); static void ds_getmcaf (struct ed_softc *, u_int32_t *); -static void ed_get_packet (struct ed_softc *, char *, /* u_short */ int); +static void ed_get_packet (struct ed_softc *, char *, u_short); static __inline void ed_rint (struct ed_softc *); static __inline void ed_xmit (struct ed_softc *); static __inline char * ed_ring_copy (struct ed_softc *, char *, char *, - /* u_short */ int); + u_short); static void ed_hpp_set_physical_link (struct ed_softc *); -static void ed_hpp_readmem (struct ed_softc *, int, unsigned char *, - /* u_short */ int); -static void ed_hpp_writemem (struct ed_softc *, unsigned char *, - /* u_short */ int, /* u_short */ int); -static u_short ed_hpp_write_mbufs (struct ed_softc *, struct mbuf *, - int); +static void ed_hpp_readmem (struct ed_softc *, u_short, u_char *, u_short); +static void ed_hpp_writemem (struct ed_softc *, u_char *, u_short, u_short); +static u_short ed_hpp_write_mbufs (struct ed_softc *, struct mbuf *, int); -static u_short ed_pio_write_mbufs (struct ed_softc *, struct mbuf *, - int); +static u_short ed_pio_write_mbufs (struct ed_softc *, struct mbuf *, int); static void ed_setrcr (struct ed_softc *); @@ -117,7 +113,7 @@ DECLARE_DUMMY_MODULE(if_ed); /* * Interrupt conversion table for WD/SMC ASIC/83C584 */ -static unsigned short ed_intr_val[] = { +static u_short ed_intr_val[] = { 9, 3, 5, @@ -131,7 +127,7 @@ static unsigned short ed_intr_val[] = { /* * Interrupt conversion table for 83C790 */ -static unsigned short ed_790_intr_val[] = { +static u_short ed_790_intr_val[] = { 0, 9, 3, @@ -146,7 +142,7 @@ static unsigned short ed_790_intr_val[] = { * Interrupt conversion table for the HP PC LAN+ */ -static unsigned short ed_hpp_intr_val[] = { +static u_short ed_hpp_intr_val[] = { 0, /* 0 */ 0, /* 1 */ 0, /* 2 */ @@ -189,8 +185,7 @@ static unsigned short ed_hpp_intr_val[] = { */ int -ed_probe_generic8390(sc) - struct ed_softc *sc; +ed_probe_generic8390(struct ed_softc *sc) { if ((ed_nic_inb(sc, ED_P0_CR) & (ED_CR_RD2 | ED_CR_TXP | ED_CR_STA | ED_CR_STP)) != @@ -206,10 +201,7 @@ ed_probe_generic8390(sc) * Probe and vendor-specific initialization routine for SMC/WD80x3 boards */ int -ed_probe_WD80x3_generic(dev, flags, intr_vals) - device_t dev; - int flags; - unsigned short *intr_vals[]; +ed_probe_WD80x3_generic(device_t dev, int flags, u_short *intr_vals[]) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -613,14 +605,11 @@ ed_probe_WD80x3_generic(dev, flags, intr_vals) } int -ed_probe_WD80x3(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_WD80x3(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; - static unsigned short *intr_vals[] = {ed_intr_val, ed_790_intr_val}; + static u_short *intr_vals[] = {ed_intr_val, ed_790_intr_val}; error = ed_alloc_port(dev, port_rid, ED_WD_IO_PORTS); if (error) @@ -636,10 +625,7 @@ ed_probe_WD80x3(dev, port_rid, flags) * Probe and vendor-specific initialization routine for 3Com 3c503 boards */ int -ed_probe_3Com(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_3Com(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -912,8 +898,9 @@ ed_probe_3Com(dev, port_rid, flags) for (i = 0; i < memsize; ++i) if (sc->mem_start[i]) { - device_printf(dev, "failed to clear shared memory at %llx - check configuration\n", - (unsigned long long)kvtop(sc->mem_start + i)); + device_printf(dev, "failed to clear shared memory " + "at %llx - check configuration\n", + (unsigned long long)kvtop(sc->mem_start + i)); return (ENXIO); } return (0); @@ -923,10 +910,7 @@ ed_probe_3Com(dev, port_rid, flags) * Probe and vendor-specific initialization routine for SIC boards */ int -ed_probe_SIC(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_SIC(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -1037,9 +1021,7 @@ ed_probe_SIC(dev, port_rid, flags) * Probe and vendor-specific initialization routine for NE1000/2000 boards */ int -ed_probe_Novell_generic(dev, flags) - device_t dev; - int flags; +ed_probe_Novell_generic(device_t dev, int flags) { struct ed_softc *sc = device_get_softc(dev); u_int memsize, n; @@ -1247,10 +1229,7 @@ ed_probe_Novell_generic(dev, flags) } int -ed_probe_Novell(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_Novell(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -1290,10 +1269,7 @@ ed_probe_Novell(dev, port_rid, flags) * command line. */ int -ed_probe_HP_pclanp(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_HP_pclanp(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -1606,10 +1582,7 @@ ed_hpp_set_physical_link(struct ed_softc *sc) * Allocate a port resource with the given resource id. */ int -ed_alloc_port(dev, rid, size) - device_t dev; - int rid; - int size; +ed_alloc_port(device_t dev, int rid, int size) { struct ed_softc *sc = device_get_softc(dev); struct resource *res; @@ -1630,10 +1603,7 @@ ed_alloc_port(dev, rid, size) * Allocate a memory resource with the given resource id. */ int -ed_alloc_memory(dev, rid, size) - device_t dev; - int rid; - int size; +ed_alloc_memory(device_t dev, int rid, int size) { struct ed_softc *sc = device_get_softc(dev); struct resource *res; @@ -1654,10 +1624,7 @@ ed_alloc_memory(dev, rid, size) * Allocate an irq resource with the given resource id. */ int -ed_alloc_irq(dev, rid, flags) - device_t dev; - int rid; - int flags; +ed_alloc_irq(device_t dev, int rid, int flags) { struct ed_softc *sc = device_get_softc(dev); struct resource *res; @@ -1677,8 +1644,7 @@ ed_alloc_irq(dev, rid, flags) * Release all resources */ void -ed_release_resources(dev) - device_t dev; +ed_release_resources(device_t dev) { struct ed_softc *sc = device_get_softc(dev); @@ -1786,8 +1752,7 @@ ed_attach(device_t dev) * Reset interface. */ static void -ed_reset(ifp) - struct ifnet *ifp; +ed_reset(struct ifnet *ifp) { struct ed_softc *sc = ifp->if_softc; @@ -1811,8 +1776,7 @@ ed_reset(ifp) * Take interface offline. */ void -ed_stop(sc) - struct ed_softc *sc; +ed_stop(struct ed_softc *sc) { int n = 5000; @@ -1840,8 +1804,7 @@ ed_stop(sc) * generate an interrupt after a transmit has been started on it. */ static void -ed_watchdog(ifp) - struct ifnet *ifp; +ed_watchdog(struct ifnet *ifp) { struct ed_softc *sc = ifp->if_softc; @@ -1855,8 +1818,7 @@ ed_watchdog(ifp) #ifndef ED_NO_MIIBUS static void -ed_tick(arg) - void *arg; +ed_tick(void *arg) { struct ed_softc *sc = arg; struct mii_data *mii; @@ -1883,8 +1845,7 @@ ed_tick(arg) * Initialize device. */ static void -ed_init(xsc) - void *xsc; +ed_init(void *xsc) { struct ed_softc *sc = xsc; struct ifnet *ifp = &sc->arpcom.ac_if; @@ -2048,11 +2009,10 @@ ed_init(xsc) * This routine actually starts the transmission on the interface */ static __inline void -ed_xmit(sc) - struct ed_softc *sc; +ed_xmit(struct ed_softc *sc) { struct ifnet *ifp = (struct ifnet *)sc; - unsigned short len; + u_short len; if (sc->gone) return; @@ -2104,8 +2064,7 @@ ed_xmit(sc) * (i.e. that the output part of the interface is idle) */ static void -ed_start(ifp) - struct ifnet *ifp; +ed_start(struct ifnet *ifp) { struct ed_softc *sc = ifp->if_softc; struct mbuf *m0, *m; @@ -2253,8 +2212,7 @@ outloop: * Ethernet interface receiver interrupt. */ static __inline void -ed_rint(sc) - struct ed_softc *sc; +ed_rint(struct ed_softc *sc) { struct ifnet *ifp = &sc->arpcom.ac_if; u_char boundry; @@ -2388,8 +2346,7 @@ ed_rint(sc) * Ethernet interface interrupt processor */ void -edintr(arg) - void *arg; +edintr(void *arg) { struct ed_softc *sc = (struct ed_softc*) arg; struct ifnet *ifp = (struct ifnet *)sc; @@ -2656,11 +2613,7 @@ edintr(arg) * pretty ugly. */ static int -ed_ioctl(ifp, command, data, cr) - struct ifnet *ifp; - u_long command; - caddr_t data; - struct ucred *cr; +ed_ioctl(struct ifnet *ifp, u_long command, caddr_t data, struct ucred *cr) { struct ed_softc *sc = ifp->if_softc; #ifndef ED_NO_MIIBUS @@ -2752,11 +2705,7 @@ ed_ioctl(ifp, command, data, cr) * ring-wrap. */ static __inline char * -ed_ring_copy(sc, src, dst, amount) - struct ed_softc *sc; - char *src; - char *dst; - u_short amount; +ed_ring_copy(struct ed_softc *sc, char *src, char *dst, u_short amount) { u_short tmp_amount; @@ -2787,10 +2736,7 @@ ed_ring_copy(sc, src, dst, amount) * ether_input(). */ static void -ed_get_packet(sc, buf, len) - struct ed_softc *sc; - char *buf; - u_short len; +ed_get_packet(struct ed_softc *sc, char *buf, u_short len) { struct ifnet *ifp = &sc->arpcom.ac_if; struct ether_header *eh; @@ -2855,11 +2801,7 @@ ed_get_packet(sc, buf, len) * This routine is currently Novell-specific. */ void -ed_pio_readmem(sc, src, dst, amount) - struct ed_softc *sc; - int src; - unsigned char *dst; - unsigned short amount; +ed_pio_readmem(struct ed_softc *sc, int src, u_char *dst, u_short amount) { /* HP PC Lan+ cards need special handling */ if (sc->vendor == ED_VENDOR_HP && sc->type == ED_TYPE_HP_PCLANPLUS) { @@ -2898,11 +2840,7 @@ ed_pio_readmem(sc, src, dst, amount) * be even. */ void -ed_pio_writemem(sc, src, dst, len) - struct ed_softc *sc; - char *src; - unsigned short dst; - unsigned short len; +ed_pio_writemem(struct ed_softc *sc, char *src, u_short dst, u_short len) { int maxwait = 200; /* about 240us */ @@ -2944,13 +2882,10 @@ ed_pio_writemem(sc, src, dst, len) * programmed I/O. */ static u_short -ed_pio_write_mbufs(sc, m, dst) - struct ed_softc *sc; - struct mbuf *m; - int dst; +ed_pio_write_mbufs(struct ed_softc *sc, struct mbuf *m, int dst) { struct ifnet *ifp = (struct ifnet *)sc; - unsigned short total_len, dma_len; + u_short total_len, dma_len; struct mbuf *mp; int maxwait = 200; /* about 240us */ @@ -3002,9 +2937,9 @@ ed_pio_write_mbufs(sc, m, dst) } } else { /* NE2000s are a pain */ - unsigned char *data; + u_char *data; int len, wantbyte; - unsigned char savebyte[2]; + u_char savebyte[2]; wantbyte = 0; @@ -3070,11 +3005,7 @@ ed_pio_write_mbufs(sc, m, dst) */ static void -ed_hpp_readmem(sc, src, dst, amount) - struct ed_softc *sc; - unsigned short src; - unsigned char *dst; - unsigned short amount; +ed_hpp_readmem(struct ed_softc *sc, u_short src, u_char *dst, u_short amount) { int use_32bit_access = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS); @@ -3173,11 +3104,7 @@ ed_hpp_readmem(sc, src, dst, amount) * be even. */ static void -ed_hpp_writemem(sc, src, dst, len) - struct ed_softc *sc; - unsigned char *src; - unsigned short dst; - unsigned short len; +ed_hpp_writemem(struct ed_softc *sc, u_char *src, u_short dst, u_short len) { /* reset remote DMA complete flag */ ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC); @@ -3229,8 +3156,8 @@ static u_short ed_hpp_write_mbufs(struct ed_softc *sc, struct mbuf *m, int dst) { int len, wantbyte; - unsigned short total_len; - unsigned char savebyte[2]; + u_short total_len; + u_char savebyte[2]; volatile u_short * const d = (volatile u_short *) sc->hpp_mem_start; int use_32bit_accesses = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS); @@ -3346,9 +3273,7 @@ ed_hpp_write_mbufs(struct ed_softc *sc, struct mbuf *m, int dst) * MII bus support routines. */ int -ed_miibus_readreg(dev, phy, reg) - device_t dev; - int phy, reg; +ed_miibus_readreg(device_t dev, int phy, int reg) { struct ed_softc *sc = device_get_softc(dev); int failed, val; @@ -3376,9 +3301,7 @@ ed_miibus_readreg(dev, phy, reg) } void -ed_miibus_writereg(dev, phy, reg, data) - device_t dev; - int phy, reg, data; +ed_miibus_writereg(device_t dev, int phy, int reg, int data) { struct ed_softc *sc = device_get_softc(dev); @@ -3402,8 +3325,7 @@ ed_miibus_writereg(dev, phy, reg, data) } int -ed_ifmedia_upd(ifp) - struct ifnet *ifp; +ed_ifmedia_upd(struct ifnet *ifp) { struct ed_softc *sc; struct mii_data *mii; @@ -3417,9 +3339,7 @@ ed_ifmedia_upd(ifp) } void -ed_ifmedia_sts(ifp, ifmr) - struct ifnet *ifp; - struct ifmediareq *ifmr; +ed_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { struct ed_softc *sc; struct mii_data *mii; @@ -3435,9 +3355,7 @@ ed_ifmedia_sts(ifp, ifmr) } void -ed_child_detached(dev, child) - device_t dev; - device_t child; +ed_child_detached(device_t dev, device_t child) { struct ed_softc *sc; @@ -3448,8 +3366,7 @@ ed_child_detached(dev, child) #endif static void -ed_setrcr(sc) - struct ed_softc *sc; +ed_setrcr(struct ed_softc *sc) { struct ifnet *ifp = (struct ifnet *)sc; int i; @@ -3528,8 +3445,7 @@ ed_setrcr(sc) * Compute crc for ethernet address */ static uint32_t -ds_mchash(addr) - const uint8_t *addr; +ds_mchash(const uint8_t *addr) { #define ED_POLYNOMIAL 0x04c11db6 uint32_t crc = 0xffffffff; @@ -3553,9 +3469,7 @@ ds_mchash(addr) * list of multicast addresses we need to listen to. */ static void -ds_getmcaf(sc, mcaf) - struct ed_softc *sc; - u_int32_t *mcaf; +ds_getmcaf(struct ed_softc *sc, u_int32_t *mcaf) { u_int32_t index; u_char *af = (u_char *) mcaf; diff --git a/sys/dev/netif/ed/if_ed_isa.c b/sys/dev/netif/ed/if_ed_isa.c index faa26ce0af..8d6111a356 100644 --- a/sys/dev/netif/ed/if_ed_isa.c +++ b/sys/dev/netif/ed/if_ed_isa.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ed/if_ed_isa.c,v 1.15 2003/10/31 18:31:58 brooks Exp $ - * $DragonFly: src/sys/dev/netif/ed/if_ed_isa.c,v 1.10 2005/08/29 10:19:51 sephe Exp $ + * $DragonFly: src/sys/dev/netif/ed/if_ed_isa.c,v 1.11 2005/10/01 06:36:11 sephe Exp $ */ #include @@ -63,10 +63,8 @@ static struct isa_pnp_id ed_ids[] = { }; static int -ed_isa_probe(dev) - device_t dev; +ed_isa_probe(device_t dev) { - struct ed_softc *sc = device_get_softc(dev); int flags = device_get_flags(dev); int error = 0; @@ -119,8 +117,7 @@ end: } static int -ed_isa_attach(dev) - device_t dev; +ed_isa_attach(device_t dev) { struct ed_softc *sc = device_get_softc(dev); int error; diff --git a/sys/dev/netif/ed/if_ed_pccard.c b/sys/dev/netif/ed/if_ed_pccard.c index bae040a492..3a48809e8f 100644 --- a/sys/dev/netif/ed/if_ed_pccard.c +++ b/sys/dev/netif/ed/if_ed_pccard.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.55 2003/12/31 04:25:00 kato Exp $ - * $DragonFly: src/sys/dev/netif/ed/if_ed_pccard.c,v 1.11 2005/05/24 20:59:01 dillon Exp $ + * $DragonFly: src/sys/dev/netif/ed/if_ed_pccard.c,v 1.12 2005/10/01 06:36:11 sephe Exp $ */ #include "opt_ed.h" @@ -295,7 +295,7 @@ ax88190_geteprom(struct ed_softc *sc) int prom[16],i; u_char tmp; struct { - unsigned char offset, value; + u_char offset, value; } pg_seq[] = { {ED_P0_CR, ED_CR_RD2|ED_CR_STP}, /* Select Page0 */ {ED_P0_DCR, 0x01}, @@ -442,8 +442,7 @@ ed_pccard_ax88190(device_t dev) ed_asic_inb(sc, ED_DLINK_MIIBUS) & ~(x)) static void -ed_pccard_dlink_mii_reset(sc) - struct ed_softc *sc; +ed_pccard_dlink_mii_reset(struct ed_softc *sc) { ed_asic_outb(sc, ED_DLINK_MIIBUS, 0); DELAY(10); @@ -458,10 +457,7 @@ ed_pccard_dlink_mii_reset(sc) } static void -ed_pccard_dlink_mii_writebits(sc, val, nbits) - struct ed_softc *sc; - u_int val; - int nbits; +ed_pccard_dlink_mii_writebits(struct ed_softc *sc, u_int val, int nbits) { int i; @@ -481,9 +477,7 @@ ed_pccard_dlink_mii_writebits(sc, val, nbits) } static u_int -ed_pccard_dlink_mii_readbits(sc, nbits) - struct ed_softc *sc; - int nbits; +ed_pccard_dlink_mii_readbits(struct ed_softc *sc, int nbits) { int i; u_int val = 0; diff --git a/sys/dev/netif/ed/if_edvar.h b/sys/dev/netif/ed/if_edvar.h index 1a6e50f1bf..5235be7f8a 100644 --- a/sys/dev/netif/ed/if_edvar.h +++ b/sys/dev/netif/ed/if_edvar.h @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ed/if_edvar.h,v 1.16 2003/10/31 18:31:58 brooks Exp $ - * $DragonFly: src/sys/dev/netif/ed/if_edvar.h,v 1.6 2004/09/14 23:01:20 joerg Exp $ + * $DragonFly: src/sys/dev/netif/ed/if_edvar.h,v 1.7 2005/10/01 06:36:11 sephe Exp $ */ #ifndef SYS_DEV_NETIF_ED_EDVAR_H @@ -199,7 +199,7 @@ int ed_alloc_irq (device_t, int, int); int ed_probe_generic8390 (struct ed_softc *); int ed_probe_WD80x3 (device_t, int, int); -int ed_probe_WD80x3_generic (device_t, int, unsigned short *[]); +int ed_probe_WD80x3_generic (device_t, int, u_short *[]); int ed_probe_3Com (device_t, int, int); int ed_probe_SIC (device_t, int, int); int ed_probe_Novell (device_t, int, int); @@ -208,10 +208,8 @@ int ed_probe_HP_pclanp (device_t, int, int); int ed_attach (device_t); void ed_stop (struct ed_softc *); -void ed_pio_readmem (struct ed_softc *, int, unsigned char *, - unsigned short); -void ed_pio_writemem (struct ed_softc *, char *, - unsigned short, unsigned short); +void ed_pio_readmem (struct ed_softc *, int, u_char *, u_short); +void ed_pio_writemem (struct ed_softc *, char *, u_short, u_short); #ifndef ED_NO_MIIBUS int ed_miibus_readreg (device_t, int, int); void ed_miibus_writereg (device_t, int, int, int); -- 2.41.0