Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/next68k/dev KNF. No functional change.
details: https://anonhg.NetBSD.org/src/rev/5e2d4ed352d6
branches: trunk
changeset: 450723:5e2d4ed352d6
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed Apr 24 07:32:50 2019 +0000
description:
KNF. No functional change.
diffstat:
sys/arch/next68k/dev/mb8795.c | 186 +++++++++++++++++++++--------------------
1 files changed, 95 insertions(+), 91 deletions(-)
diffs (truncated from 489 to 300 lines):
diff -r 972cf149a97b -r 5e2d4ed352d6 sys/arch/next68k/dev/mb8795.c
--- a/sys/arch/next68k/dev/mb8795.c Wed Apr 24 07:09:44 2019 +0000
+++ b/sys/arch/next68k/dev/mb8795.c Wed Apr 24 07:32:50 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mb8795.c,v 1.61 2019/02/05 06:17:01 msaitoh Exp $ */
+/* $NetBSD: mb8795.c,v 1.62 2019/04/24 07:32:50 msaitoh Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.61 2019/02/05 06:17:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.62 2019/04/24 07:32:50 msaitoh Exp $");
#include "opt_inet.h"
@@ -87,10 +87,10 @@
* and the Fujitsu Manchester Encoder/Decoder (MB502).
*/
-void mb8795_shutdown(void *);
+void mb8795_shutdown(void *);
bus_dmamap_t mb8795_txdma_restart(bus_dmamap_t, void *);
-void mb8795_start_dma(struct mb8795_softc *);
+void mb8795_start_dma(struct mb8795_softc *);
int mb8795_mediachange(struct ifnet *);
void mb8795_mediastatus(struct ifnet *, struct ifmediareq *);
@@ -100,7 +100,7 @@
{
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
- DPRINTF(("%s: mb8795_config()\n",device_xname(sc->sc_dev)));
+ DPRINTF(("%s: mb8795_config()\n", device_xname(sc->sc_dev)));
/* Initialize ifnet structure. */
memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
@@ -119,22 +119,22 @@
ifmedia_add(&sc->sc_media, media[i], 0, NULL);
ifmedia_set(&sc->sc_media, defmedia);
} else {
- ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL);
- ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL);
+ ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
+ ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL);
}
- /* Attach the interface. */
- if_attach(ifp);
- ether_ifattach(ifp, sc->sc_enaddr);
+ /* Attach the interface. */
+ if_attach(ifp);
+ ether_ifattach(ifp, sc->sc_enaddr);
- sc->sc_sh = shutdownhook_establish(mb8795_shutdown, sc);
- if (sc->sc_sh == NULL)
- panic("mb8795_config: can't establish shutdownhook");
+ sc->sc_sh = shutdownhook_establish(mb8795_shutdown, sc);
+ if (sc->sc_sh == NULL)
+ panic("mb8795_config: can't establish shutdownhook");
- rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
- RND_TYPE_NET, RND_FLAG_DEFAULT);
+ rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
+ RND_TYPE_NET, RND_FLAG_DEFAULT);
- DPRINTF(("%s: leaving mb8795_config()\n",device_xname(sc->sc_dev)));
+ DPRINTF(("%s: leaving mb8795_config()\n", device_xname(sc->sc_dev)));
}
/*
@@ -147,14 +147,14 @@
int data;
if (turbo)
- return (0);
+ return 0;
switch IFM_SUBTYPE(sc->sc_media.ifm_media) {
case IFM_AUTO:
- if ((bus_space_read_1(sc->sc_bmap_bst, sc->sc_bmap_bsh, BMAP_DATA) &
- BMAP_DATA_UTPENABLED_MASK) ||
- !(bus_space_read_1(sc->sc_bmap_bst, sc->sc_bmap_bsh, BMAP_DATA) &
- BMAP_DATA_UTPCARRIER_MASK)) {
+ if ((bus_space_read_1(sc->sc_bmap_bst, sc->sc_bmap_bsh,
+ BMAP_DATA) & BMAP_DATA_UTPENABLED_MASK) ||
+ !(bus_space_read_1(sc->sc_bmap_bst, sc->sc_bmap_bsh,
+ BMAP_DATA) & BMAP_DATA_UTPCARRIER_MASK)) {
data = BMAP_DATA_UTPENABLE;
sc->sc_media.ifm_cur->ifm_data = IFM_ETHER|IFM_10_T;
} else {
@@ -169,7 +169,7 @@
data = BMAP_DATA_BNCENABLE;
break;
default:
- return (1);
+ return 1;
break;
}
@@ -178,7 +178,7 @@
bus_space_write_1(sc->sc_bmap_bst, sc->sc_bmap_bsh,
BMAP_DATA, data);
- return (0);
+ return 0;
}
/*
@@ -192,17 +192,17 @@
if (turbo)
return;
- if (IFM_SUBTYPE(ifmr->ifm_active) == IFM_AUTO) {
+ if (IFM_SUBTYPE(ifmr->ifm_active) == IFM_AUTO)
ifmr->ifm_active = sc->sc_media.ifm_cur->ifm_data;
- }
+
if (IFM_SUBTYPE(ifmr->ifm_active) == IFM_10_T) {
ifmr->ifm_status = IFM_AVALID;
- if (!(bus_space_read_1(sc->sc_bmap_bst, sc->sc_bmap_bsh, BMAP_DATA) &
- BMAP_DATA_UTPCARRIER_MASK))
+ if (!(bus_space_read_1(sc->sc_bmap_bst, sc->sc_bmap_bsh,
+ BMAP_DATA) & BMAP_DATA_UTPCARRIER_MASK))
ifmr->ifm_status |= IFM_ACTIVE;
- } else {
+ } else
ifmr->ifm_status &= ~IFM_AVALID; /* don't know for 10_2 */
- }
+
return;
}
@@ -223,11 +223,14 @@
if ((i+1) % 16 == 0) {
printf(" %c", '|');
for(j=0; j<16; j++) {
- printf("%c", pkt[i-15+j]>=32 && pkt[i-15+j]<127?pkt[i-15+j]:'.');
+ printf("%c",
+ (pkt[i-15+j] >= 32 && pkt[i-15+j] < 127)
+ ? pkt[i-15+j] : '.');
}
printf("%c\n%c%c%c%c%c%c%c%c ", '|',
- XCHR((i+1)>>28),XCHR((i+1)>>24),XCHR((i+1)>>20),XCHR((i+1)>>16),
- XCHR((i+1)>>12), XCHR((i+1)>>8), XCHR((i+1)>>4), XCHR(i+1));
+ XCHR((i+1)>>28), XCHR((i+1)>>24), XCHR((i+1)>>20),
+ XCHR((i+1)>>16), XCHR((i+1)>>12), XCHR((i+1)>>8),
+ XCHR((i+1)>>4), XCHR(i+1));
}
}
printf("\n");
@@ -253,32 +256,27 @@
MB_WRITE_REG(sc, MB8795_RXSTAT, MB8795_RXSTAT_CLEAR);
if (rxstat & MB8795_RXSTAT_RESET) {
- DPRINTF(("%s: rx reset packet\n",
- device_xname(sc->sc_dev)));
+ DPRINTF(("%s: rx reset packet\n", device_xname(sc->sc_dev)));
error++;
}
if (rxstat & MB8795_RXSTAT_SHORT) {
- DPRINTF(("%s: rx short packet\n",
- device_xname(sc->sc_dev)));
+ DPRINTF(("%s: rx short packet\n", device_xname(sc->sc_dev)));
error++;
}
if (rxstat & MB8795_RXSTAT_ALIGNERR) {
- DPRINTF(("%s: rx alignment error\n",
- device_xname(sc->sc_dev)));
+ DPRINTF(("%s: rx alignment error\n",device_xname(sc->sc_dev)));
#if 0
error++;
#endif
}
if (rxstat & MB8795_RXSTAT_CRCERR) {
- DPRINTF(("%s: rx CRC error\n",
- device_xname(sc->sc_dev)));
+ DPRINTF(("%s: rx CRC error\n", device_xname(sc->sc_dev)));
#if 0
error++;
#endif
}
if (rxstat & MB8795_RXSTAT_OVERFLOW) {
- DPRINTF(("%s: rx overflow error\n",
- device_xname(sc->sc_dev)));
+ DPRINTF(("%s: rx overflow error\n", device_xname(sc->sc_dev)));
#if 0
error++;
#endif
@@ -306,11 +304,15 @@
#if defined(MB8795_DEBUG)
/* Peek at the packet */
DPRINTF(("%s: received packet, at VA %p-%p,len %d\n",
- device_xname(sc->sc_dev),mtod(m,u_char *),mtod(m,u_char *)+m->m_len,m->m_len));
+ device_xname(sc->sc_dev), mtod(m,u_char *),
+ mtod(m,u_char *) + m->m_len, m->m_len));
if (mb8795_debug > 3) {
- mb8795_hex_dump(mtod(m,u_char *), m->m_pkthdr.len);
+ mb8795_hex_dump(mtod(m,u_char *),
+ m->m_pkthdr.len);
} else if (mb8795_debug > 2) {
- mb8795_hex_dump(mtod(m,u_char *), m->m_pkthdr.len < 255 ? m->m_pkthdr.len : 128 );
+ mb8795_hex_dump(mtod(m,u_char *),
+ m->m_pkthdr.len < 255
+ ? m->m_pkthdr.len : 128);
}
#endif
@@ -318,7 +320,6 @@
if_percpuq_enqueue(ifp->if_percpuq, m);
s = spldma();
-
}
splx(s);
@@ -373,8 +374,9 @@
/* MB_WRITE_REG(sc, MB8795_TXMASK, txmask & ~MB8795_TXMASK_READYIE); */
/* MB_WRITE_REG(sc, MB8795_TXMASK, txmask & ~MB8795_TXMASK_TXRXIE); */
MB_WRITE_REG(sc, MB8795_TXMASK, 0);
- if ((ifp->if_flags & IFF_RUNNING) && !IF_IS_EMPTY(&sc->sc_tx_snd)) {
- void mb8795_start_dma(struct mb8795_softc *); /* XXXX */
+ if ((ifp->if_flags & IFF_RUNNING)
+ && !IF_IS_EMPTY(&sc->sc_tx_snd)) {
+ void mb8795_start_dma(struct mb8795_softc *); /* XXX */
/* printf ("Z"); */
mb8795_start_dma(sc);
}
@@ -408,7 +410,8 @@
device_xname(sc->sc_dev), sbuf);
/* turn interrupt off */
- MB_WRITE_REG(sc, MB8795_TXMASK, txmask & ~MB8795_TXMASK_READYIE);
+ MB_WRITE_REG(sc, MB8795_TXMASK,
+ txmask & ~MB8795_TXMASK_READYIE);
}
#endif
@@ -425,7 +428,7 @@
s = splnet();
- DPRINTF (("%s: mb8795_reset()\n",device_xname(sc->sc_dev)));
+ DPRINTF (("%s: mb8795_reset()\n", device_xname(sc->sc_dev)));
sc->sc_ethercom.ec_if.if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
sc->sc_ethercom.ec_if.if_timer = 0;
@@ -440,8 +443,8 @@
* causing a loop @@@
*/
MB_WRITE_REG(sc, MB8795_TXMASK,
- MB8795_TXMASK_UNDERFLOWIE | MB8795_TXMASK_COLLIE | MB8795_TXMASK_COLL16IE
- | MB8795_TXMASK_PARERRIE);
+ MB8795_TXMASK_UNDERFLOWIE | MB8795_TXMASK_COLLIE
+ | MB8795_TXMASK_COLL16IE | MB8795_TXMASK_PARERRIE);
#else
MB_WRITE_REG(sc, MB8795_TXMASK, 0);
#endif
@@ -449,21 +452,22 @@
#if 0
MB_WRITE_REG(sc, MB8795_RXMASK,
- MB8795_RXMASK_OKIE | MB8795_RXMASK_RESETIE | MB8795_RXMASK_SHORTIE |
- MB8795_RXMASK_ALIGNERRIE | MB8795_RXMASK_CRCERRIE | MB8795_RXMASK_OVERFLOWIE);
+ MB8795_RXMASK_OKIE | MB8795_RXMASK_RESETIE | MB8795_RXMASK_SHORTIE
+ | MB8795_RXMASK_ALIGNERRIE | MB8795_RXMASK_CRCERRIE
+ | MB8795_RXMASK_OVERFLOWIE);
#else
MB_WRITE_REG(sc, MB8795_RXMASK,
- MB8795_RXMASK_OKIE | MB8795_RXMASK_RESETIE | MB8795_RXMASK_SHORTIE);
+ MB8795_RXMASK_OKIE | MB8795_RXMASK_RESETIE
+ | MB8795_RXMASK_SHORTIE);
#endif
MB_WRITE_REG(sc, MB8795_RXSTAT, MB8795_RXSTAT_CLEAR);
- for(i=0;i<sizeof(sc->sc_enaddr);i++) {
+ for(i=0;i<sizeof(sc->sc_enaddr);i++)
MB_WRITE_REG(sc, MB8795_ENADDR+i, sc->sc_enaddr[i]);
- }
- DPRINTF(("%s: initializing ethernet %02x:%02x:%02x:%02x:%02x:%02x, size=%d\n",
- device_xname(sc->sc_dev),
+ DPRINTF(("%s: initializing ethernet %02x:%02x:%02x:%02x:%02x:%02x, "
+ "size=%d\n", device_xname(sc->sc_dev),
sc->sc_enaddr[0],sc->sc_enaddr[1],sc->sc_enaddr[2],
sc->sc_enaddr[3],sc->sc_enaddr[4],sc->sc_enaddr[5],
sizeof(sc->sc_enaddr)));
@@ -482,7 +486,7 @@
++ifp->if_oerrors;
DPRINTF(("%s: %lld input errors, %lld input packets\n",
- device_xname(sc->sc_dev), ifp->if_ierrors, ifp->if_ipackets));
+ device_xname(sc->sc_dev), ifp->if_ierrors, ifp->if_ipackets));
ifp->if_flags &= ~IFF_RUNNING;
mb8795_init(sc);
Home |
Main Index |
Thread Index |
Old Index