Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb -No functional change:
details: https://anonhg.NetBSD.org/src/rev/7dc0f4a43484
branches: trunk
changeset: 999177:7dc0f4a43484
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Thu May 23 10:40:39 2019 +0000
description:
-No functional change:
- Simplify struct ethercom's pointer near ETHER_FIRST_MULTI().
- Simplify MII structure initialization.
- u_int*_t -> uint*_t.
- KNF
diffstat:
sys/arch/arm/imx/if_enet.c | 48 +++++++-------
sys/arch/arm/sunxi/sunxi_emac.c | 41 ++++++------
sys/arch/arm/xscale/ixp425_if_npe.c | 67 ++++++++++----------
sys/arch/mips/sibyte/dev/sbmac.c | 67 +++++++++----------
sys/dev/ic/i82586.c | 48 +++++++-------
sys/dev/ic/mtd803.c | 94 +++++++++++++++-------------
sys/dev/ic/seeq8005.c | 84 +++++++++++++------------
sys/dev/marvell/if_gfe.c | 118 ++++++++++++++++++-----------------
sys/dev/pci/if_kse.c | 9 +-
sys/dev/pci/if_ti.c | 16 ++--
sys/dev/pci/if_vge.c | 90 +++++++++++++-------------
sys/dev/pci/if_vioif.c | 77 ++++++++++++----------
sys/dev/pci/if_vr.c | 76 +++++++++++-----------
sys/dev/usb/if_smsc.c | 21 +++---
14 files changed, 438 insertions(+), 418 deletions(-)
diffs (truncated from 2709 to 300 lines):
diff -r b755ea9dfc43 -r 7dc0f4a43484 sys/arch/arm/imx/if_enet.c
--- a/sys/arch/arm/imx/if_enet.c Thu May 23 10:34:44 2019 +0000
+++ b/sys/arch/arm/imx/if_enet.c Thu May 23 10:40:39 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_enet.c,v 1.19 2019/04/24 11:18:20 msaitoh Exp $ */
+/* $NetBSD: if_enet.c,v 1.20 2019/05/23 10:40:39 msaitoh Exp $ */
/*
* Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.19 2019/04/24 11:18:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.20 2019/05/23 10:40:39 msaitoh Exp $");
#include "vlan.h"
@@ -176,6 +176,7 @@
{
struct enet_softc *sc;
struct ifnet *ifp;
+ struct mii_data * const mii = &sc->sc_mii;
sc = device_private(self);
sc->sc_dev = self;
@@ -283,23 +284,20 @@
IFQ_SET_READY(&ifp->if_snd);
/* setup MII */
- sc->sc_ethercom.ec_mii = &sc->sc_mii;
- sc->sc_mii.mii_ifp = ifp;
- sc->sc_mii.mii_readreg = enet_miibus_readreg;
- sc->sc_mii.mii_writereg = enet_miibus_writereg;
- sc->sc_mii.mii_statchg = enet_miibus_statchg;
- ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
- enet_mediastatus);
+ sc->sc_ethercom.ec_mii = mii;
+ mii->mii_ifp = ifp;
+ mii->mii_readreg = enet_miibus_readreg;
+ mii->mii_writereg = enet_miibus_writereg;
+ mii->mii_statchg = enet_miibus_statchg;
+ ifmedia_init(&mii->mii_media, 0, ether_mediachange, enet_mediastatus);
/* try to attach PHY */
- mii_attach(self, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
- MII_OFFSET_ANY, 0);
- if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
- ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER | IFM_MANUAL,
- 0, NULL);
- ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_MANUAL);
+ mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (LIST_FIRST(&mii->mii_phys) == NULL) {
+ ifmedia_add(&mii->mii_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
+ ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_MANUAL);
} else {
- ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO);
+ ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_AUTO);
}
if_attach(ifp);
@@ -460,9 +458,9 @@
status = ENET_REG_READ(sc, ENET_EIR);
if (sc->sc_imxtype == 7) {
- if (status & (ENET_EIR_TXF|ENET_EIR_TXF1|ENET_EIR_TXF2))
+ if (status & (ENET_EIR_TXF | ENET_EIR_TXF1 | ENET_EIR_TXF2))
enet_tx_intr(arg);
- if (status & (ENET_EIR_RXF|ENET_EIR_RXF1|ENET_EIR_RXF2))
+ if (status & (ENET_EIR_RXF | ENET_EIR_RXF1 | ENET_EIR_RXF2))
enet_rx_intr(arg);
} else {
if (status & ENET_EIR_TXF)
@@ -761,17 +759,16 @@
static void
enet_setmulti(struct enet_softc *sc)
{
- struct ifnet *ifp;
+ struct ethercom *ec = &sc->sc_ethercom;
+ struct ifnet *ifp = &ec->ec_if;
struct ether_multi *enm;
struct ether_multistep step;
int promisc;
uint32_t crc;
uint32_t gaddr[2];
- ifp = &sc->sc_ethercom.ec_if;
-
promisc = 0;
- if ((ifp->if_flags & IFF_PROMISC) || sc->sc_ethercom.ec_multicnt > 0) {
+ if ((ifp->if_flags & IFF_PROMISC) || ec->ec_multicnt > 0) {
ifp->if_flags |= IFF_ALLMULTI;
if (ifp->if_flags & IFF_PROMISC)
promisc = 1;
@@ -779,7 +776,7 @@
} else {
gaddr[0] = gaddr[1] = 0;
- ETHER_FIRST_MULTI(step, &sc->sc_ethercom, enm);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
gaddr[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
@@ -1888,9 +1885,10 @@
sc->sc_rxdesc_dmamap->dm_mapsize, BUS_DMASYNC_PREWRITE);
/* enable interrupts */
- val = ENET_EIMR|ENET_EIR_TXF|ENET_EIR_RXF|ENET_EIR_EBERR;
+ val = ENET_EIMR | ENET_EIR_TXF | ENET_EIR_RXF | ENET_EIR_EBERR;
if (sc->sc_imxtype == 7)
- val |= ENET_EIR_TXF2|ENET_EIR_RXF2|ENET_EIR_TXF1|ENET_EIR_RXF1;
+ val |= ENET_EIR_TXF2 | ENET_EIR_RXF2 | ENET_EIR_TXF1 |
+ ENET_EIR_RXF1;
ENET_REG_WRITE(sc, ENET_EIMR, val);
/* enable ether */
diff -r b755ea9dfc43 -r 7dc0f4a43484 sys/arch/arm/sunxi/sunxi_emac.c
--- a/sys/arch/arm/sunxi/sunxi_emac.c Thu May 23 10:34:44 2019 +0000
+++ b/sys/arch/arm/sunxi/sunxi_emac.c Thu May 23 10:40:39 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.26 2019/05/09 01:46:37 ozaki-r Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.27 2019/05/23 10:40:39 msaitoh Exp $ */
/*-
* Copyright (c) 2016-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
#include "opt_net_mpsafe.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.26 2019/05/09 01:46:37 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.27 2019/05/23 10:40:39 msaitoh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -285,7 +285,7 @@
WR4(sc, EMAC_RX_CTL_0, val);
val = RD4(sc, EMAC_TX_FLOW_CTL);
- val &= ~(PAUSE_TIME|TX_FLOW_CTL_EN);
+ val &= ~(PAUSE_TIME | TX_FLOW_CTL_EN);
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0)
val |= TX_FLOW_CTL_EN;
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
@@ -346,7 +346,7 @@
u_int csum_flags;
error = bus_dmamap_load_mbuf(sc->tx.buf_tag,
- sc->tx.buf_map[index].map, m, BUS_DMA_WRITE|BUS_DMA_NOWAIT);
+ sc->tx.buf_map[index].map, m, BUS_DMA_WRITE | BUS_DMA_NOWAIT);
if (error == EFBIG) {
device_printf(sc->dev,
"TX packet needs too many DMA segments, dropping...\n");
@@ -409,7 +409,7 @@
m_adj(m, ETHER_ALIGN);
error = bus_dmamap_load_mbuf(sc->rx.buf_tag,
- sc->rx.buf_map[index].map, m, BUS_DMA_READ|BUS_DMA_NOWAIT);
+ sc->rx.buf_map[index].map, m, BUS_DMA_READ | BUS_DMA_NOWAIT);
if (error != 0)
return error;
@@ -473,7 +473,7 @@
if (cnt != 0) {
sunxi_emac_dma_sync(sc, sc->tx.desc_tag, sc->tx.desc_map,
start, sc->tx.cur, TX_DESC_COUNT,
- BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
/* Start and run TX DMA */
val = RD4(sc, EMAC_TX_CTL_1);
@@ -525,7 +525,8 @@
static void
sunxi_emac_setup_rxfilter(struct sunxi_emac_softc *sc)
{
- struct ifnet *ifp = &sc->ec.ec_if;
+ struct ethercom *ec = &sc->ec;
+ struct ifnet *ifp = &ec->ec_if;
uint32_t val, crc, hashreg, hashbit, hash[2], machi, maclo;
struct ether_multi *enm;
struct ether_multistep step;
@@ -543,8 +544,8 @@
hash[0] = hash[1] = ~0;
} else {
val |= HASH_MULTICAST;
- ETHER_LOCK(&sc->ec);
- ETHER_FIRST_MULTI(step, &sc->ec, enm);
+ ETHER_LOCK(ec);
+ ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
crc &= 0x7f;
@@ -554,7 +555,7 @@
hash[hashreg] |= (1 << hashbit);
ETHER_NEXT_MULTI(step, enm);
}
- ETHER_UNLOCK(&sc->ec);
+ ETHER_UNLOCK(ec);
}
/* Write our unicast address */
@@ -783,8 +784,8 @@
for (index = sc->rx.cur; ; index = RX_NEXT(index)) {
sunxi_emac_dma_sync(sc, sc->rx.desc_tag, sc->rx.desc_map,
- index, index + 1,
- RX_DESC_COUNT, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
+ index, index + 1, RX_DESC_COUNT,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
status = le32toh(sc->rx.desc_ring[index].status);
if ((status & RX_DESC_CTL) != 0)
@@ -831,7 +832,7 @@
sunxi_emac_dma_sync(sc, sc->rx.desc_tag, sc->rx.desc_map,
index, index + 1,
- RX_DESC_COUNT, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+ RX_DESC_COUNT, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
}
sc->rx.cur = index;
@@ -854,7 +855,7 @@
KASSERT(sc->tx.queued > 0 && sc->tx.queued <= TX_DESC_COUNT);
sunxi_emac_dma_sync(sc, sc->tx.desc_tag, sc->tx.desc_map,
i, i + 1, TX_DESC_COUNT,
- BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
desc = &sc->tx.desc_ring[i];
status = le32toh(desc->status);
if ((status & TX_DESC_CTL) != 0)
@@ -872,7 +873,7 @@
sunxi_emac_setup_txdesc(sc, i, 0, 0, 0);
sunxi_emac_dma_sync(sc, sc->tx.desc_tag, sc->tx.desc_map,
i, i + 1, TX_DESC_COUNT,
- BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
ifp->if_flags &= ~IFF_OACTIVE;
ifp->if_opackets++;
@@ -896,7 +897,7 @@
if (val & RX_INT)
sunxi_emac_rxintr(sc);
- if (val & (TX_INT|TX_BUF_UA_INT)) {
+ if (val & (TX_INT | TX_BUF_UA_INT)) {
sunxi_emac_txintr(sc);
if_schedule_deferred_start(ifp);
}
@@ -1113,7 +1114,7 @@
return 0;
}
-static void
+static void
sunxi_emac_get_eaddr(struct sunxi_emac_softc *sc, uint8_t *eaddr)
{
uint32_t maclo, machi;
@@ -1206,7 +1207,7 @@
memset(sc->tx.desc_ring, 0, TX_DESC_SIZE);
bus_dmamap_sync(sc->dmat, sc->tx.desc_map, 0, TX_DESC_SIZE,
- BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
for (i = 0; i < TX_DESC_COUNT; i++)
sc->tx.desc_ring[i].next =
@@ -1267,7 +1268,7 @@
}
bus_dmamap_sync(sc->rx.desc_tag, sc->rx.desc_map,
0, sc->rx.desc_map->dm_mapsize,
- BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
return 0;
}
@@ -1449,7 +1450,7 @@
aprint_error_dev(self, "no PHY found!\n");
return;
}
- ifmedia_set(&mii->mii_media, IFM_ETHER|IFM_AUTO);
+ ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_AUTO);
/* Attach interface */
if_attach(ifp);
diff -r b755ea9dfc43 -r 7dc0f4a43484 sys/arch/arm/xscale/ixp425_if_npe.c
--- a/sys/arch/arm/xscale/ixp425_if_npe.c Thu May 23 10:34:44 2019 +0000
+++ b/sys/arch/arm/xscale/ixp425_if_npe.c Thu May 23 10:40:39 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixp425_if_npe.c,v 1.39 2019/04/26 06:33:33 msaitoh Exp $ */
+/* $NetBSD: ixp425_if_npe.c,v 1.40 2019/05/23 10:40:39 msaitoh Exp $ */
/*-
* Copyright (c) 2006 Sam Leffler. All rights reserved.
@@ -28,7 +28,7 @@
#if 0
__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
#endif
-__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.39 2019/04/26 06:33:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.40 2019/05/23 10:40:39 msaitoh Exp $");
/*
Home |
Main Index |
Thread Index |
Old Index