Fix a typo in CPSW_DEBUG MACRO and then replace all the CPSWP_DEBUG() calls

with CPSW_DEBUG().

Sponsored by:	Rubicon Communications, LLC (Netgate)
This commit is contained in:
Luiz Otavio O Souza 2016-09-30 17:19:43 +00:00
parent c933457038
commit 5a9c270ab6

View File

@ -255,8 +255,6 @@ static struct cpsw_stat {
* Basic debug support.
*/
#define IF_DEBUG(_sc) if ((_sc)->if_flags & IFF_DEBUG)
static void
cpsw_debugf_head(const char *funcname)
{
@ -278,20 +276,12 @@ cpsw_debugf(const char *fmt, ...)
}
#define CPSW_DEBUGF(_sc, a) do { \
if (sc->debug) { \
if ((_sc)->debug) { \
cpsw_debugf_head(__func__); \
cpsw_debugf a; \
} \
} while (0)
#define CPSWP_DEBUGF(_sc, a) do { \
IF_DEBUG((_sc)) { \
cpsw_debugf_head(__func__); \
cpsw_debugf a; \
} \
} while (0)
/*
* Locking macros
*/
@ -1052,7 +1042,7 @@ cpswp_detach(device_t dev)
struct cpswp_softc *sc;
sc = device_get_softc(dev);
CPSWP_DEBUGF(sc, (""));
CPSW_DEBUGF(sc->swsc, (""));
if (device_is_attached(dev)) {
ether_ifdetach(sc->ifp);
CPSW_PORT_LOCK(sc);
@ -1098,7 +1088,7 @@ cpswp_init(void *arg)
{
struct cpswp_softc *sc = arg;
CPSWP_DEBUGF(sc, (""));
CPSW_DEBUGF(sc->swsc, (""));
CPSW_PORT_LOCK(sc);
cpswp_init_locked(arg);
CPSW_PORT_UNLOCK(sc);
@ -1111,7 +1101,7 @@ cpswp_init_locked(void *arg)
struct ifnet *ifp;
uint32_t reg;
CPSWP_DEBUGF(sc, (""));
CPSW_DEBUGF(sc->swsc, (""));
CPSW_PORT_LOCK_ASSERT(sc);
ifp = sc->ifp;
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
@ -1240,7 +1230,7 @@ cpswp_stop_locked(struct cpswp_softc *sc)
uint32_t reg;
ifp = sc->ifp;
CPSWP_DEBUGF(sc, (""));
CPSW_DEBUGF(sc->swsc, (""));
CPSW_PORT_LOCK_ASSERT(sc);
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
@ -1362,7 +1352,7 @@ cpswp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
if (ifp->if_flags & IFF_UP) {
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
changed = ifp->if_flags ^ sc->if_flags;
CPSWP_DEBUGF(sc,
CPSW_DEBUGF(sc->swsc,
("SIOCSIFFLAGS: UP & RUNNING (changed=0x%x)",
changed));
if (changed & IFF_PROMISC)
@ -1372,12 +1362,12 @@ cpswp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
cpsw_set_allmulti(sc,
ifp->if_flags & IFF_ALLMULTI);
} else {
CPSWP_DEBUGF(sc,
CPSW_DEBUGF(sc->swsc,
("SIOCSIFFLAGS: UP but not RUNNING; starting up"));
cpswp_init_locked(sc);
}
} else if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
CPSWP_DEBUGF(sc,
CPSW_DEBUGF(sc->swsc,
("SIOCSIFFLAGS: not UP but RUNNING; shutting down"));
cpswp_stop_locked(sc);
}
@ -1488,7 +1478,7 @@ cpswp_miibus_statchg(device_t dev)
uint32_t mac_control, reg;
sc = device_get_softc(dev);
CPSWP_DEBUGF(sc, (""));
CPSW_DEBUGF(sc->swsc, (""));
reg = CPSW_SL_MACCONTROL(sc->unit);
mac_control = cpsw_read_4(sc->swsc, reg);
@ -1766,7 +1756,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
"Can't defragment packet; dropping\n");
m_freem(slot->mbuf);
} else {
CPSWP_DEBUGF(sc,
CPSW_DEBUGF(sc->swsc,
("Requeueing defragmented packet"));
IF_PREPEND(&sc->ifp->if_snd, m0);
}
@ -1786,7 +1776,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
bus_dmamap_sync(sc->swsc->mbuf_dtag, slot->dmamap,
BUS_DMASYNC_PREWRITE);
CPSWP_DEBUGF(sc,
CPSW_DEBUGF(sc->swsc,
("Queueing TX packet: %d segments + %d pad bytes",
nsegs, padlen));
@ -2115,7 +2105,7 @@ cpswp_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
struct mii_data *mii;
sc = ifp->if_softc;
CPSWP_DEBUGF(sc, (""));
CPSW_DEBUGF(sc->swsc, (""));
CPSW_PORT_LOCK(sc);
mii = sc->mii;
@ -2132,7 +2122,7 @@ cpswp_ifmedia_upd(struct ifnet *ifp)
struct cpswp_softc *sc;
sc = ifp->if_softc;
CPSWP_DEBUGF(sc, (""));
CPSW_DEBUGF(sc->swsc, (""));
CPSW_PORT_LOCK(sc);
mii_mediachg(sc->mii);
sc->media_status = sc->mii->mii_media.ifm_media;