Module Name:    src
Committed By:   msaitoh
Date:           Wed Apr 24 08:11:35 UTC 2019

Modified Files:
        src/sys/dev/ic: mb86950.c

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/mb86950.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mb86950.c
diff -u src/sys/dev/ic/mb86950.c:1.29 src/sys/dev/ic/mb86950.c:1.30
--- src/sys/dev/ic/mb86950.c:1.29	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/ic/mb86950.c	Wed Apr 24 08:11:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb86950.c,v 1.29 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: mb86950.c,v 1.30 2019/04/24 08:11:35 msaitoh Exp $	*/
 
 /*
  * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -67,7 +67,7 @@
   */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.29 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.30 2019/04/24 08:11:35 msaitoh Exp $");
 
 /*
  * Device driver for Fujitsu mb86950 based Ethernet cards.
@@ -227,14 +227,13 @@ mb86950_stop(struct mb86950_softc *sc)
 	bus_space_write_1(bst, bsh, DLCR_RX_STAT, 0xff);
 
 	/* Clear DMA Bit */
-    bus_space_write_2(bst, bsh, BMPR_DMA, 0);
+	bus_space_write_2(bst, bsh, BMPR_DMA, 0);
 
-    /* accept no packets */
+	/* accept no packets */
 	bus_space_write_1(bst, bsh, DLCR_TX_MODE, 0);
 	bus_space_write_1(bst, bsh, DLCR_RX_MODE, 0);
 
-    mb86950_drain_fifo(sc);
-
+	mb86950_drain_fifo(sc);
 }
 
 void
@@ -257,8 +256,7 @@ mb86950_drain_fifo(struct mb86950_softc 
  * Install interface into kernel networking data structures
  */
 void
-mb86950_config(struct mb86950_softc *sc, int *media,
-    int nmedia, int defmedia)
+mb86950_config(struct mb86950_softc *sc, int *media, int nmedia, int defmedia)
 {
 	struct ifnet *ifp = &sc->sc_ec.ec_if;
 	bus_space_tag_t bst = sc->sc_bst;
@@ -278,7 +276,8 @@ mb86950_config(struct mb86950_softc *sc,
 	/* XXX The Tiara LANCard uses board jumpers to change media.
 	 *       This code may have to be changed for other cards.
 	 */
-	ifmedia_init(&sc->sc_media, 0, mb86950_mediachange, mb86950_mediastatus);
+	ifmedia_init(&sc->sc_media, 0, mb86950_mediachange,
+	    mb86950_mediastatus);
 	ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
 	ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL);
 
@@ -287,7 +286,8 @@ mb86950_config(struct mb86950_softc *sc,
 	if_deferred_start_init(ifp, NULL);
 
 	/* Feed the chip the station address. */
-	bus_space_write_region_1(bst, bsh, DLCR_NODE_ID, sc->sc_enaddr, ETHER_ADDR_LEN);
+	bus_space_write_region_1(bst, bsh, DLCR_NODE_ID, sc->sc_enaddr,
+	    ETHER_ADDR_LEN);
 
 	ether_ifattach(ifp, sc->sc_enaddr);
 
@@ -338,9 +338,9 @@ mb86950_mediachange(struct ifnet *ifp)
 	struct mb86950_softc *sc = ifp->if_softc;
 
 	if (sc->sc_mediachange)
-		return ((*sc->sc_mediachange)(sc));
+		return (*sc->sc_mediachange)(sc);
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -389,8 +389,8 @@ mb86950_watchdog(struct ifnet *ifp)
 	bus_space_handle_t bsh = sc->sc_bsh;
 	u_int8_t tstat;
 
-	/* verbose watchdog messages for debugging timeouts */
-    if ((tstat = bus_space_read_1(bst, bsh, DLCR_TX_STAT)) != 0) {
+	/* Verbose watchdog messages for debugging timeouts */
+	if ((tstat = bus_space_read_1(bst, bsh, DLCR_TX_STAT)) != 0) {
 		if (tstat & TX_CR_LOST) {
 			if ((tstat & (TX_COL | TX_16COL)) == 0) {
 				 log(LOG_ERR, "%s: carrier lost\n",
@@ -407,17 +407,16 @@ mb86950_watchdog(struct ifnet *ifp)
 			log(LOG_ERR, "%s: transmit error\n",
 			    device_xname(sc->sc_dev));
 		}
-	} else {
+	} else
 		log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	}
 
-	/* Don't know how many packets are lost by this accident.
+	/*
+	 * Don't know how many packets are lost by this accident.
 	 *  ... So just errors = errors + 1
 	 */
 	ifp->if_oerrors++;
 
 	mb86950_reset(sc);
-
 }
 
 /*
@@ -516,7 +515,7 @@ mb86950_ioctl(struct ifnet *ifp, unsigne
 	}
 
 	splx(s);
-	return (error);
+	return error;
 }
 
 /*
@@ -550,15 +549,14 @@ mb86950_init(struct mb86950_softc *sc)
 
 	/* ...and attempt to start output. */
 	mb86950_start(ifp);
-
 }
 
 void
 mb86950_start(struct ifnet *ifp)
 {
 	struct mb86950_softc *sc = ifp->if_softc;
-    bus_space_tag_t bst = sc->sc_bst;
-    bus_space_handle_t bsh = sc->sc_bsh;
+	bus_space_tag_t bst = sc->sc_bst;
+	bus_space_handle_t bsh = sc->sc_bsh;
 	struct mbuf *m;
 	int len;
 
@@ -577,8 +575,10 @@ mb86950_start(struct ifnet *ifp)
 	m_freem(m);
 
 	/* XXX bus_space_barrier here ? */
-	if (bus_space_read_1(bst, bsh, DLCR_TX_STAT) & (TX_UNDERFLO | TX_BUS_WR_ERR)) {
-		log(LOG_ERR, "%s: tx fifo underflow/overflow\n", device_xname(sc->sc_dev));
+	if (bus_space_read_1(bst, bsh, DLCR_TX_STAT)
+	    & (TX_UNDERFLO | TX_BUS_WR_ERR)) {
+		log(LOG_ERR, "%s: tx fifo underflow/overflow\n",
+		    device_xname(sc->sc_dev));
 	}
 
 	bus_space_write_2(bst, bsh, BMPR_TX_LENGTH, len | TRANSMIT_START);
@@ -620,7 +620,8 @@ mb86950_put_fifo(struct mb86950_softc *s
 			/* Finish the last word. */
 			if (wantbyte) {
 				savebyte[1] = *((u_char *)data);
-				bus_space_write_2(bst, bsh, BMPR_FIFO, *savebyte);
+				bus_space_write_2(bst, bsh, BMPR_FIFO,
+				    *savebyte);
 				data = (u_short *)((u_char *)data + 1);
 				len--;
 				wantbyte = 0;
@@ -628,7 +629,8 @@ mb86950_put_fifo(struct mb86950_softc *s
 			/* Output contiguous words. */
 			if (len > 1) {
 				len1 = len/2;
-				bus_space_write_multi_stream_2(bst, bsh, BMPR_FIFO, data, len1);
+				bus_space_write_multi_stream_2(bst, bsh,
+				    BMPR_FIFO, data, len1);
 				data += len1;
 				len &= 1;
 			}
@@ -650,14 +652,15 @@ mb86950_put_fifo(struct mb86950_softc *s
 		/* Fill the rest of the packet with zeros. */
 		/* XXX Replace this mess with something else, eats CPU */
 		/* The zero fill and last byte ought to be combined somehow */
-		for(len = totlen + 1; len < (ETHER_MIN_LEN - ETHER_CRC_LEN); len += 2)
+		for (len = totlen + 1; len < (ETHER_MIN_LEN - ETHER_CRC_LEN);
+		     len += 2)
 	  		bus_space_write_2(bst, bsh, BMPR_FIFO, 0);
 		/* XXX                                       */
 
 		totlen = (ETHER_MIN_LEN - ETHER_CRC_LEN);
 	}
 
-	return (totlen);
+	return totlen;
 }
 
 /*
@@ -677,7 +680,7 @@ mb86950_intr(void *arg)
 	tstat = bus_space_read_1(bst, bsh, DLCR_TX_STAT);
 	rstat = bus_space_read_1(bst, bsh, DLCR_RX_STAT);
 
-	if (tstat == 0 && rstat == 0) return (0);
+	if (tstat == 0 && rstat == 0) return 0;
 
 	/* Disable etherstar interrupts so that we won't miss anything. */
 	bus_space_write_1(bst, bsh, DLCR_TX_INT_EN, 0);
@@ -723,7 +726,7 @@ mb86950_intr(void *arg)
 	/* Set receive interrupts back */
 	bus_space_write_1(bst, bsh, DLCR_RX_INT_EN, RX_MASK);
 
-	return(1);
+	return 1;
 }
 
 /* Transmission interrupt handler */
@@ -740,7 +743,7 @@ mb86950_tint(struct mb86950_softc *sc, u
 		ifp->if_oerrors++;
 	}
 
-	/* excessive collision */
+	/* Excessive collision */
 	if (tstat & TX_16COL) {
 		ifp->if_collisions += 16;
 		/* 16 collisions means that the packet has been thrown away. */
@@ -748,16 +751,17 @@ mb86950_tint(struct mb86950_softc *sc, u
 			sc->txb_sched--;
 	}
 
-	/* transmission complete. */
+	/* Transmission complete. */
 	if (tstat & TX_DONE) {
-		/* successfully transmitted packets ++. */
+		/* Successfully transmitted packets ++. */
 		ifp->if_opackets++;
 		if (sc->txb_sched > 0)
 			sc->txb_sched--;
 
 		/* Collision count valid only when TX_DONE is set */
 		if (tstat & TX_COL) {
-			col = (bus_space_read_1(bst, bsh, DLCR_TX_MODE) & COL_MASK) >> 4;
+			col = (bus_space_read_1(bst, bsh, DLCR_TX_MODE)
+			    & COL_MASK) >> 4;
 			ifp->if_collisions = ifp->if_collisions + col;
 		}
 	}
@@ -769,7 +773,7 @@ mb86950_tint(struct mb86950_softc *sc, u
 	}
 }
 
-/* receiver interrupt. */
+/* Receiver interrupt. */
 void
 mb86950_rint(struct mb86950_softc *sc, u_int8_t rstat)
 {
@@ -782,7 +786,8 @@ mb86950_rint(struct mb86950_softc *sc, u
 	 /* Update statistics if this interrupt is caused by an error. */
 	 if (rstat & RX_ERR_MASK) {
 
-		/* tried to read past end of fifo, should be harmless
+		/*
+		 * Tried to read past end of fifo, should be harmless
 		 * count everything else
 		 */
 		if ((rstat & RX_BUS_RD_ERR) == 0) {
@@ -805,10 +810,10 @@ mb86950_rint(struct mb86950_softc *sc, u
 		if (bus_space_read_1(bst, bsh, DLCR_RX_MODE) & RX_BUF_EMTY)
 			break;
 
-		/* receive packet status */
+		/* Receive packet status */
 		status = bus_space_read_2(bst, bsh, BMPR_FIFO);
 
-		/* bad packet? */
+		/* Bad packet? */
 		if ((status & GOOD_PKT) == 0) {
 			ifp->if_ierrors++;
 			mb86950_drain_fifo(sc);
@@ -818,7 +823,8 @@ mb86950_rint(struct mb86950_softc *sc, u
 		/* Length valid ? */
 		len = bus_space_read_2(bst, bsh, BMPR_FIFO);
 
-		if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN) || len < ETHER_HDR_LEN) {
+		if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN)
+		    || len < ETHER_HDR_LEN) {
 			ifp->if_ierrors++;
 			mb86950_drain_fifo(sc);
 			continue;
@@ -850,11 +856,9 @@ mb86950_get_fifo(struct mb86950_softc *s
 	/* Allocate a header mbuf. */
 	MGETHDR(m, M_DONTWAIT, MT_DATA);
 	if (m == 0)
-		return (-1);
+		return -1;
 
-	/*
-	 * Round len to even value.
-	 */
+	/* Round len to even value. */
 	if (len & 1)
 		len++;
 
@@ -881,7 +885,7 @@ mb86950_get_fifo(struct mb86950_softc *s
 		MCLGET(m, M_DONTWAIT);
 		if ((m->m_flags & M_EXT) == 0) {
 			m_freem(m);
-			return (-1);
+			return -1;
 		}
 	}
 
@@ -895,10 +899,11 @@ mb86950_get_fifo(struct mb86950_softc *s
 	m->m_len = len;
 
 	/* Get a packet. */
-	bus_space_read_multi_stream_2(bst, bsh, BMPR_FIFO, mtod(m, u_int16_t *), (len + 1) >> 1);
+	bus_space_read_multi_stream_2(bst, bsh, BMPR_FIFO,
+	    mtod(m, u_int16_t *), (len + 1) >> 1);
 
 	if_percpuq_enqueue(ifp->if_percpuq, m);
-	return (0);
+	return 0;
 }
 
 /*
@@ -911,12 +916,12 @@ mb86950_enable(struct mb86950_softc *sc)
 	if ((sc->sc_stat & ESTAR_STAT_ENABLED) == 0 && sc->sc_enable != NULL) {
 		if ((*sc->sc_enable)(sc) != 0) {
 			aprint_error_dev(sc->sc_dev, "device enable failed\n");
-			return (EIO);
+			return EIO;
 		}
 	}
 
 	sc->sc_stat |= ESTAR_STAT_ENABLED;
-	return (0);
+	return 0;
 }
 
 /*
@@ -963,7 +968,7 @@ mb86950_detach(struct mb86950_softc *sc)
 
 	/* Succeed now if there's no work to do. */
 	if ((sc->sc_stat & ESTAR_STAT_ATTACHED) == 0)
-		return (0);
+		return 0;
 
 	/* Delete all media. */
 	ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY);
@@ -974,7 +979,7 @@ mb86950_detach(struct mb86950_softc *sc)
 	ether_ifdetach(ifp);
 	if_detach(ifp);
 
-	return (0);
+	return 0;
 }
 
 #if ESTAR_DEBUG >= 1

Reply via email to