Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150798628
D3904.id9416.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D3904.id9416.diff
View Options
Index: sys/dev/mge/if_mge.c
===================================================================
--- sys/dev/mge/if_mge.c
+++ sys/dev/mge/if_mge.c
@@ -132,13 +132,15 @@
static void mge_set_prom_mode(struct mge_softc *sc, uint8_t queue);
static int mge_allocate_dma(struct mge_softc *sc);
static int mge_alloc_desc_dma(struct mge_softc *sc,
- struct mge_desc_wrapper* desc_tab, uint32_t size, bus_dma_tag_t *buffer_tag);
+ struct mge_desc_wrapper* desc_tab, uint32_t size,
+ bus_dma_tag_t *buffer_tag);
static int mge_new_rxbuf(bus_dma_tag_t tag, bus_dmamap_t map,
struct mbuf **mbufp, bus_addr_t *paddr);
-static void mge_get_dma_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error);
+static void mge_get_dma_addr(void *arg, bus_dma_segment_t *segs, int nseg,
+ int error);
static void mge_free_dma(struct mge_softc *sc);
-static void mge_free_desc(struct mge_softc *sc, struct mge_desc_wrapper* tab, uint32_t size,
- bus_dma_tag_t buffer_tag, uint8_t free_mbufs);
+static void mge_free_desc(struct mge_softc *sc, struct mge_desc_wrapper* tab,
+ uint32_t size, bus_dma_tag_t buffer_tag, uint8_t free_mbufs);
static void mge_offload_process_frame(struct ifnet *ifp, struct mbuf *frame,
uint32_t status, uint16_t bufsize);
static void mge_offload_setup_descriptor(struct mge_softc *sc,
@@ -691,6 +693,7 @@
static void
mge_free_dma(struct mge_softc *sc)
{
+
/* Free desciptors and mbufs */
mge_free_desc(sc, sc->mge_rx_desc, MGE_RX_DESC_NUM, sc->mge_rx_dtag, 1);
mge_free_desc(sc, sc->mge_tx_desc, MGE_TX_DESC_NUM, sc->mge_tx_dtag, 0);
@@ -814,8 +817,10 @@
mge_ver_params(sc);
/* Initialize mutexes */
- mtx_init(&sc->transmit_lock, device_get_nameunit(dev), "mge TX lock", MTX_DEF);
- mtx_init(&sc->receive_lock, device_get_nameunit(dev), "mge RX lock", MTX_DEF);
+ mtx_init(&sc->transmit_lock, device_get_nameunit(dev), "mge TX lock",
+ MTX_DEF);
+ mtx_init(&sc->receive_lock, device_get_nameunit(dev), "mge RX lock",
+ MTX_DEF);
/* Allocate IO and IRQ resources */
error = bus_alloc_resources(dev, res_spec, sc->res);
@@ -950,7 +955,8 @@
if (!sc->ih_cookie[i])
continue;
- error = bus_teardown_intr(dev, sc->res[1 + i], sc->ih_cookie[i]);
+ error = bus_teardown_intr(dev, sc->res[1 + i],
+ sc->ih_cookie[i]);
if (error)
device_printf(dev, "could not release %s\n",
mge_intrs[(sc->mge_intr_cnt == 1 ? 0 : i + 1)].description);
@@ -981,9 +987,10 @@
static void
mge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
{
- struct mge_softc *sc = ifp->if_softc;
+ struct mge_softc *sc;
struct mii_data *mii;
+ sc = ifp->if_softc;
MGE_GLOBAL_LOCK(sc);
if (!sc->phy_attached) {
@@ -1065,8 +1072,9 @@
static void
mge_init(void *arg)
{
- struct mge_softc *sc = arg;
+ struct mge_softc *sc;
+ sc = arg;
MGE_GLOBAL_LOCK(sc);
mge_init_locked(arg);
@@ -1212,9 +1220,10 @@
static void
mge_intr_rxtx(void *arg)
{
- struct mge_softc *sc = arg;
+ struct mge_softc *sc;
uint32_t int_cause, int_cause_ext;
+ sc = arg;
MGE_GLOBAL_LOCK(sc);
#ifdef DEVICE_POLLING
@@ -1247,9 +1256,10 @@
static void
mge_intr_err(void *arg)
{
- struct mge_softc *sc = arg;
+ struct mge_softc *sc;
struct ifnet *ifp;
+ sc = arg;
ifp = sc->ifp;
if_printf(ifp, "%s\n", __FUNCTION__);
}
@@ -1257,18 +1267,20 @@
static void
mge_intr_misc(void *arg)
{
- struct mge_softc *sc = arg;
+ struct mge_softc *sc;
struct ifnet *ifp;
+ sc = arg;
ifp = sc->ifp;
if_printf(ifp, "%s\n", __FUNCTION__);
}
static void
mge_intr_rx(void *arg) {
- struct mge_softc *sc = arg;
+ struct mge_softc *sc;
uint32_t int_cause, int_cause_ext;
+ sc = arg;
MGE_RECEIVE_LOCK(sc);
#ifdef DEVICE_POLLING
@@ -1410,7 +1422,6 @@
MGE_TRANSMIT_UNLOCK(sc);
}
-
static void
mge_intr_tx_locked(struct mge_softc *sc)
{
@@ -1466,7 +1477,6 @@
mge_start_locked(ifp);
}
}
-
static int
mge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
{
@@ -1777,7 +1787,7 @@
/* The driver support only one DMA fragment. */
if (m0->m_next != NULL) {
mtmp = m_defrag(m0, M_NOWAIT);
- if (mtmp)
+ if (mtmp != NULL)
m0 = mtmp;
}
@@ -1869,8 +1879,9 @@
DELAY(100);
}
- if(!count)
- if_printf(ifp, "%s: timeout while waiting for end of transmission\n",
+ if (count == 0)
+ if_printf(ifp,
+ "%s: timeout while waiting for end of transmission\n",
__FUNCTION__);
reg_val = MGE_READ(sc, MGE_PORT_SERIAL_CTRL);
@@ -1917,7 +1928,7 @@
struct ip *ip;
int ehlen, etype;
- if (csum_flags) {
+ if (csum_flags != 0) {
if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) {
etype = ntohs(eh->evl_proto);
ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 3:24 AM (19 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30865412
Default Alt Text
D3904.id9416.diff (4 KB)
Attached To
Mode
D3904: Correct style in mge driver
Attached
Detach File
Event Timeline
Log In to Comment