git: 13def8c17d25 - stable/13 - sk: ansify

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 09 Apr 2023 21:35:43 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=13def8c17d2501f24563e0b77501a870a17c900f

commit 13def8c17d2501f24563e0b77501a870a17c900f
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-02-08 00:05:03 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-04-09 15:46:45 +0000

    sk: ansify
    
    Reported by:    clang 15
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 82c519c21f15b7ce4775a7484aa4354f40771480)
---
 sys/dev/sk/if_sk.c | 225 +++++++++++++++--------------------------------------
 1 file changed, 64 insertions(+), 161 deletions(-)

diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c
index 809cfa6f9e14..9a0dc1eab81f 100644
--- a/sys/dev/sk/if_sk.c
+++ b/sys/dev/sk/if_sk.c
@@ -364,9 +364,7 @@ static struct resource_spec sk_res_spec_mem[] = {
 	sk_win_write_2(sc, reg, sk_win_read_2(sc, reg) & ~x)
 
 static u_int32_t
-sk_win_read_4(sc, reg)
-	struct sk_softc		*sc;
-	int			reg;
+sk_win_read_4(struct sk_softc *sc, int reg)
 {
 #ifdef SK_USEIOSPACE
 	CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
@@ -377,9 +375,7 @@ sk_win_read_4(sc, reg)
 }
 
 static u_int16_t
-sk_win_read_2(sc, reg)
-	struct sk_softc		*sc;
-	int			reg;
+sk_win_read_2(struct sk_softc *sc, int reg)
 {
 #ifdef SK_USEIOSPACE
 	CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
@@ -390,9 +386,7 @@ sk_win_read_2(sc, reg)
 }
 
 static u_int8_t
-sk_win_read_1(sc, reg)
-	struct sk_softc		*sc;
-	int			reg;
+sk_win_read_1(struct sk_softc *sc, int reg)
 {
 #ifdef SK_USEIOSPACE
 	CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
@@ -403,10 +397,7 @@ sk_win_read_1(sc, reg)
 }
 
 static void
-sk_win_write_4(sc, reg, val)
-	struct sk_softc		*sc;
-	int			reg;
-	u_int32_t		val;
+sk_win_write_4(struct sk_softc *sc, int reg, u_int32_t val)
 {
 #ifdef SK_USEIOSPACE
 	CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
@@ -418,10 +409,7 @@ sk_win_write_4(sc, reg, val)
 }
 
 static void
-sk_win_write_2(sc, reg, val)
-	struct sk_softc		*sc;
-	int			reg;
-	u_int32_t		val;
+sk_win_write_2(struct sk_softc *sc, int reg, u_int32_t val)
 {
 #ifdef SK_USEIOSPACE
 	CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
@@ -433,10 +421,7 @@ sk_win_write_2(sc, reg, val)
 }
 
 static void
-sk_win_write_1(sc, reg, val)
-	struct sk_softc		*sc;
-	int			reg;
-	u_int32_t		val;
+sk_win_write_1(struct sk_softc *sc, int reg, u_int32_t val)
 {
 #ifdef SK_USEIOSPACE
 	CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
@@ -448,9 +433,7 @@ sk_win_write_1(sc, reg, val)
 }
 
 static int
-sk_miibus_readreg(dev, phy, reg)
-	device_t		dev;
-	int			phy, reg;
+sk_miibus_readreg(device_t dev, int phy, int reg)
 {
 	struct sk_if_softc	*sc_if;
 	int			v;
@@ -477,9 +460,7 @@ sk_miibus_readreg(dev, phy, reg)
 }
 
 static int
-sk_miibus_writereg(dev, phy, reg, val)
-	device_t		dev;
-	int			phy, reg, val;
+sk_miibus_writereg(device_t dev, int phy, int reg, int val)
 {
 	struct sk_if_softc	*sc_if;
 	int			v;
@@ -506,8 +487,7 @@ sk_miibus_writereg(dev, phy, reg, val)
 }
 
 static void
-sk_miibus_statchg(dev)
-	device_t		dev;
+sk_miibus_statchg(device_t dev)
 {
 	struct sk_if_softc	*sc_if;
 
@@ -530,9 +510,7 @@ sk_miibus_statchg(dev)
 }
 
 static int
-sk_xmac_miibus_readreg(sc_if, phy, reg)
-	struct sk_if_softc	*sc_if;
-	int			phy, reg;
+sk_xmac_miibus_readreg(struct sk_if_softc *sc_if, int phy, int reg)
 {
 	int			i;
 
@@ -558,9 +536,7 @@ sk_xmac_miibus_readreg(sc_if, phy, reg)
 }
 
 static int
-sk_xmac_miibus_writereg(sc_if, phy, reg, val)
-	struct sk_if_softc	*sc_if;
-	int			phy, reg, val;
+sk_xmac_miibus_writereg(struct sk_if_softc *sc_if, int phy, int reg, int val)
 {
 	int			i;
 
@@ -588,8 +564,7 @@ sk_xmac_miibus_writereg(sc_if, phy, reg, val)
 }
 
 static void
-sk_xmac_miibus_statchg(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_xmac_miibus_statchg(struct sk_if_softc *sc_if)
 {
 	struct mii_data		*mii;
 
@@ -609,9 +584,7 @@ sk_xmac_miibus_statchg(sc_if)
 }
 
 static int
-sk_marv_miibus_readreg(sc_if, phy, reg)
-	struct sk_if_softc	*sc_if;
-	int			phy, reg;
+sk_marv_miibus_readreg(struct sk_if_softc *sc_if, int phy, int reg)
 {
 	u_int16_t		val;
 	int			i;
@@ -642,9 +615,7 @@ sk_marv_miibus_readreg(sc_if, phy, reg)
 }
 
 static int
-sk_marv_miibus_writereg(sc_if, phy, reg, val)
-	struct sk_if_softc	*sc_if;
-	int			phy, reg, val;
+sk_marv_miibus_writereg(struct sk_if_softc *sc_if, int phy, int reg, int val)
 {
 	int			i;
 
@@ -664,8 +635,7 @@ sk_marv_miibus_writereg(sc_if, phy, reg, val)
 }
 
 static void
-sk_marv_miibus_statchg(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_marv_miibus_statchg(struct sk_if_softc *sc_if)
 {
 	return;
 }
@@ -673,8 +643,7 @@ sk_marv_miibus_statchg(sc_if)
 #define HASH_BITS		6
 
 static u_int32_t
-sk_xmchash(addr)
-	const uint8_t *addr;
+sk_xmchash(const uint8_t *addr)
 {
 	uint32_t crc;
 
@@ -685,10 +654,7 @@ sk_xmchash(addr)
 }
 
 static void
-sk_setfilt(sc_if, addr, slot)
-	struct sk_if_softc	*sc_if;
-	u_int16_t		*addr;
-	int			slot;
+sk_setfilt(struct sk_if_softc *sc_if, u_int16_t *addr, int slot)
 {
 	int			base;
 
@@ -702,8 +668,7 @@ sk_setfilt(sc_if, addr, slot)
 }
 
 static void
-sk_rxfilter(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_rxfilter(struct sk_if_softc *sc_if)
 {
 	struct sk_softc		*sc;
 
@@ -826,8 +791,7 @@ sk_rxfilter_yukon(struct sk_if_softc *sc_if)
 }
 
 static int
-sk_init_rx_ring(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_init_rx_ring(struct sk_if_softc *sc_if)
 {
 	struct sk_ring_data	*rd;
 	bus_addr_t		addr;
@@ -859,8 +823,7 @@ sk_init_rx_ring(sc_if)
 }
 
 static int
-sk_init_jumbo_rx_ring(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_init_jumbo_rx_ring(struct sk_if_softc *sc_if)
 {
 	struct sk_ring_data	*rd;
 	bus_addr_t		addr;
@@ -893,8 +856,7 @@ sk_init_jumbo_rx_ring(sc_if)
 }
 
 static void
-sk_init_tx_ring(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_init_tx_ring(struct sk_if_softc *sc_if)
 {
 	struct sk_ring_data	*rd;
 	struct sk_txdesc	*txd;
@@ -926,9 +888,7 @@ sk_init_tx_ring(sc_if)
 }
 
 static __inline void
-sk_discard_rxbuf(sc_if, idx)
-	struct sk_if_softc	*sc_if;
-	int			idx;
+sk_discard_rxbuf(struct sk_if_softc *sc_if, int idx)
 {
 	struct sk_rx_desc	*r;
 	struct sk_rxdesc	*rxd;
@@ -941,9 +901,7 @@ sk_discard_rxbuf(sc_if, idx)
 }
 
 static __inline void
-sk_discard_jumbo_rxbuf(sc_if, idx)
-	struct sk_if_softc	*sc_if;
-	int			idx;
+sk_discard_jumbo_rxbuf(struct sk_if_softc *sc_if, int idx)
 {
 	struct sk_rx_desc	*r;
 	struct sk_rxdesc	*rxd;
@@ -956,9 +914,7 @@ sk_discard_jumbo_rxbuf(sc_if, idx)
 }
 
 static int
-sk_newbuf(sc_if, idx)
-	struct sk_if_softc	*sc_if;
-	int 			idx;
+sk_newbuf(struct sk_if_softc *sc_if, int idx)
 {
 	struct sk_rx_desc	*r;
 	struct sk_rxdesc	*rxd;
@@ -1001,9 +957,7 @@ sk_newbuf(sc_if, idx)
 }
 
 static int
-sk_jumbo_newbuf(sc_if, idx)
-	struct sk_if_softc	*sc_if;
-	int			idx;
+sk_jumbo_newbuf(struct sk_if_softc *sc_if, int idx)
 {
 	struct sk_rx_desc	*r;
 	struct sk_rxdesc	*rxd;
@@ -1055,8 +1009,7 @@ sk_jumbo_newbuf(sc_if, idx)
  * Set media options.
  */
 static int
-sk_ifmedia_upd(ifp)
-	struct ifnet		*ifp;
+sk_ifmedia_upd(struct ifnet *ifp)
 {
 	struct sk_if_softc	*sc_if = ifp->if_softc;
 	struct mii_data		*mii;
@@ -1072,9 +1025,7 @@ sk_ifmedia_upd(ifp)
  * Report current media status.
  */
 static void
-sk_ifmedia_sts(ifp, ifmr)
-	struct ifnet		*ifp;
-	struct ifmediareq	*ifmr;
+sk_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
 	struct sk_if_softc	*sc_if;
 	struct mii_data		*mii;
@@ -1090,10 +1041,7 @@ sk_ifmedia_sts(ifp, ifmr)
 }
 
 static int
-sk_ioctl(ifp, command, data)
-	struct ifnet		*ifp;
-	u_long			command;
-	caddr_t			data;
+sk_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
 {
 	struct sk_if_softc	*sc_if = ifp->if_softc;
 	struct ifreq		*ifr = (struct ifreq *) data;
@@ -1181,8 +1129,7 @@ sk_ioctl(ifp, command, data)
  * IDs against our list and return a device name if we find a match.
  */
 static int
-skc_probe(dev)
-	device_t		dev;
+skc_probe(device_t dev)
 {
 	const struct sk_type	*t = sk_devs;
 
@@ -1213,8 +1160,7 @@ skc_probe(dev)
  * Force the GEnesis into reset, then bring it out of reset.
  */
 static void
-sk_reset(sc)
-	struct sk_softc		*sc;
+sk_reset(struct sk_softc *sc)
 {
 
 	CSR_WRITE_2(sc, SK_CSR, SK_CSR_SW_RESET);
@@ -1271,8 +1217,7 @@ sk_reset(sc)
 }
 
 static int
-sk_probe(dev)
-	device_t		dev;
+sk_probe(device_t dev)
 {
 	struct sk_softc		*sc;
 
@@ -1303,8 +1248,7 @@ sk_probe(dev)
  * Single port cards will have only one logical interface of course.
  */
 static int
-sk_attach(dev)
-	device_t		dev;
+sk_attach(device_t dev)
 {
 	struct sk_softc		*sc;
 	struct sk_if_softc	*sc_if;
@@ -1539,8 +1483,7 @@ fail:
  * setup and ethernet/BPF attach.
  */
 static int
-skc_attach(dev)
-	device_t		dev;
+skc_attach(device_t dev)
 {
 	struct sk_softc		*sc;
 	int			error = 0, *port;
@@ -1815,8 +1758,7 @@ fail:
  * allocated.
  */
 static int
-sk_detach(dev)
-	device_t		dev;
+sk_detach(device_t dev)
 {
 	struct sk_if_softc	*sc_if;
 	struct ifnet		*ifp;
@@ -1857,8 +1799,7 @@ sk_detach(dev)
 }
 
 static int
-skc_detach(dev)
-	device_t		dev;
+skc_detach(device_t dev)
 {
 	struct sk_softc		*sc;
 
@@ -1899,11 +1840,7 @@ struct sk_dmamap_arg {
 };
 
 static void
-sk_dmamap_cb(arg, segs, nseg, error)
-	void			*arg;
-	bus_dma_segment_t	*segs;
-	int			nseg;
-	int			error;
+sk_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
 {
 	struct sk_dmamap_arg	*ctx;
 
@@ -1924,8 +1861,7 @@ sk_dmamap_cb(arg, segs, nseg, error)
  * excessive amount of additional code.
  */
 static int
-sk_dma_alloc(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_dma_alloc(struct sk_if_softc *sc_if)
 {
 	struct sk_dmamap_arg	ctx;
 	struct sk_txdesc	*txd;
@@ -2112,8 +2048,7 @@ fail:
 }
 
 static int
-sk_dma_jumbo_alloc(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_dma_jumbo_alloc(struct sk_if_softc *sc_if)
 {
 	struct sk_dmamap_arg	ctx;
 	struct sk_rxdesc	*jrxd;
@@ -2214,8 +2149,7 @@ jumbo_fail:
 }
 
 static void
-sk_dma_free(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_dma_free(struct sk_if_softc *sc_if)
 {
 	struct sk_txdesc	*txd;
 	struct sk_rxdesc	*rxd;
@@ -2288,8 +2222,7 @@ sk_dma_free(sc_if)
 }
 
 static void
-sk_dma_jumbo_free(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_dma_jumbo_free(struct sk_if_softc *sc_if)
 {
 	struct sk_rxdesc	*jrxd;
 	int			i;
@@ -2331,10 +2264,7 @@ sk_dma_jumbo_free(sc_if)
 }
 
 static void
-sk_txcksum(ifp, m, f)
-	struct ifnet		*ifp;
-	struct mbuf		*m;
-	struct sk_tx_desc	*f;
+sk_txcksum(struct ifnet *ifp, struct mbuf *m, struct sk_tx_desc *f)
 {
 	struct ip		*ip;
 	u_int16_t		offset;
@@ -2377,9 +2307,7 @@ sendit:
 }
 
 static int
-sk_encap(sc_if, m_head)
-        struct sk_if_softc	*sc_if;
-        struct mbuf		**m_head;
+sk_encap(struct sk_if_softc *sc_if, struct mbuf **m_head)
 {
 	struct sk_txdesc	*txd;
 	struct sk_tx_desc	*f = NULL;
@@ -2469,8 +2397,7 @@ sk_encap(sc_if, m_head)
 }
 
 static void
-sk_start(ifp)
-	struct ifnet		*ifp;
+sk_start(struct ifnet *ifp)
 {
 	struct sk_if_softc *sc_if;
 
@@ -2484,8 +2411,7 @@ sk_start(ifp)
 }
 
 static void
-sk_start_locked(ifp)
-	struct ifnet		*ifp;
+sk_start_locked(struct ifnet *ifp)
 {
         struct sk_softc		*sc;
         struct sk_if_softc	*sc_if;
@@ -2534,8 +2460,7 @@ sk_start_locked(ifp)
 }
 
 static void
-sk_watchdog(arg)
-	void			*arg;
+sk_watchdog(void *arg)
 {
 	struct sk_if_softc	*sc_if;
 	struct ifnet		*ifp;
@@ -2567,8 +2492,7 @@ done:
 }
 
 static int
-skc_shutdown(dev)
-	device_t		dev;
+skc_shutdown(device_t dev)
 {
 	struct sk_softc		*sc;
 
@@ -2589,8 +2513,7 @@ skc_shutdown(dev)
 }
 
 static int
-skc_suspend(dev)
-	device_t		dev;
+skc_suspend(device_t dev)
 {
 	struct sk_softc		*sc;
 	struct sk_if_softc	*sc_if0, *sc_if1;
@@ -2618,8 +2541,7 @@ skc_suspend(dev)
 }
 
 static int
-skc_resume(dev)
-	device_t		dev;
+skc_resume(device_t dev)
 {
 	struct sk_softc		*sc;
 	struct sk_if_softc	*sc_if0, *sc_if1;
@@ -2661,10 +2583,7 @@ skc_resume(dev)
  * TCP/UDP checksum offload support.
  */
 static __inline void
-sk_rxcksum(ifp, m, csum)
-	struct ifnet		*ifp;
-	struct mbuf		*m;
-	u_int32_t		csum;
+sk_rxcksum(struct ifnet *ifp, struct mbuf *m, u_int32_t csum)
 {
 	struct ether_header	*eh;
 	struct ip		*ip;
@@ -2713,9 +2632,7 @@ sk_rxcksum(ifp, m, csum)
 }
 
 static __inline int
-sk_rxvalid(sc, stat, len)
-	struct sk_softc		*sc;
-	u_int32_t		stat, len;
+sk_rxvalid(struct sk_softc *sc, u_int32_t stat, u_int32_t len)
 {
 
 	if (sc->sk_type == SK_GENESIS) {
@@ -2735,8 +2652,7 @@ sk_rxvalid(sc, stat, len)
 }
 
 static void
-sk_rxeof(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_rxeof(struct sk_if_softc *sc_if)
 {
 	struct sk_softc		*sc;
 	struct mbuf		*m;
@@ -2802,8 +2718,7 @@ sk_rxeof(sc_if)
 }
 
 static void
-sk_jumbo_rxeof(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_jumbo_rxeof(struct sk_if_softc *sc_if)
 {
 	struct sk_softc		*sc;
 	struct mbuf		*m;
@@ -2870,8 +2785,7 @@ sk_jumbo_rxeof(sc_if)
 }
 
 static void
-sk_txeof(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_txeof(struct sk_if_softc *sc_if)
 {
 	struct sk_txdesc	*txd;
 	struct sk_tx_desc	*cur_tx;
@@ -2920,8 +2834,7 @@ sk_txeof(sc_if)
 }
 
 static void
-sk_tick(xsc_if)
-	void			*xsc_if;
+sk_tick(void *xsc_if)
 {
 	struct sk_if_softc	*sc_if;
 	struct mii_data		*mii;
@@ -2965,8 +2878,7 @@ sk_tick(xsc_if)
 }
 
 static void
-sk_yukon_tick(xsc_if)
-	void			*xsc_if;
+sk_yukon_tick(void *xsc_if)
 {
 	struct sk_if_softc	*sc_if;
 	struct mii_data		*mii;
@@ -2979,8 +2891,7 @@ sk_yukon_tick(xsc_if)
 }
 
 static void
-sk_intr_bcom(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_intr_bcom(struct sk_if_softc *sc_if)
 {
 	struct mii_data		*mii;
 	struct ifnet		*ifp;
@@ -3033,8 +2944,7 @@ sk_intr_bcom(sc_if)
 }
 
 static void
-sk_intr_xmac(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_intr_xmac(struct sk_if_softc *sc_if)
 {
 	struct sk_softc		*sc;
 	u_int16_t		status;
@@ -3069,8 +2979,7 @@ sk_intr_xmac(sc_if)
 }
 
 static void
-sk_intr_yukon(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_intr_yukon(struct sk_if_softc *sc_if)
 {
 	u_int8_t status;
 
@@ -3088,8 +2997,7 @@ sk_intr_yukon(sc_if)
 }
 
 static void
-sk_intr(xsc)
-	void			*xsc;
+sk_intr(void *xsc)
 {
 	struct sk_softc		*sc = xsc;
 	struct sk_if_softc	*sc_if0, *sc_if1;
@@ -3179,8 +3087,7 @@ done_locked:
 }
 
 static void
-sk_init_xmac(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_init_xmac(struct sk_if_softc *sc_if)
 {
 	struct sk_softc		*sc;
 	struct ifnet		*ifp;
@@ -3341,8 +3248,7 @@ sk_init_xmac(sc_if)
 }
 
 static void
-sk_init_yukon(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_init_yukon(struct sk_if_softc *sc_if)
 {
 	u_int32_t		phy, v;
 	u_int16_t		reg;
@@ -3475,8 +3381,7 @@ sk_init_yukon(sc_if)
  * you first have to take it out of reset mode.
  */
 static void
-sk_init(xsc)
-	void			*xsc;
+sk_init(void *xsc)
 {
 	struct sk_if_softc	*sc_if = xsc;
 
@@ -3488,8 +3393,7 @@ sk_init(xsc)
 }
 
 static void
-sk_init_locked(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_init_locked(struct sk_if_softc *sc_if)
 {
 	struct sk_softc		*sc;
 	struct ifnet		*ifp;
@@ -3688,8 +3592,7 @@ sk_init_locked(sc_if)
 }
 
 static void
-sk_stop(sc_if)
-	struct sk_if_softc	*sc_if;
+sk_stop(struct sk_if_softc *sc_if)
 {
 	int			i;
 	struct sk_softc		*sc;