Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci - Use aprint_normal_dev() instead of aprint_erro...
details: https://anonhg.NetBSD.org/src/rev/d23ecc353c88
branches: trunk
changeset: 346463:d23ecc353c88
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Thu Jul 14 04:15:27 2016 +0000
description:
- Use aprint_normal_dev() instead of aprint_error_dev() when printing
Ethernet address.
- Use aprint() more.
- KNF.
diffstat:
sys/dev/pci/if_ti.c | 89 ++++++++++++++++++++++++++--------------------------
1 files changed, 45 insertions(+), 44 deletions(-)
diffs (260 lines):
diff -r c89892fec15b -r d23ecc353c88 sys/dev/pci/if_ti.c
--- a/sys/dev/pci/if_ti.c Thu Jul 14 04:12:08 2016 +0000
+++ b/sys/dev/pci/if_ti.c Thu Jul 14 04:15:27 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.98 2016/07/07 06:55:41 msaitoh Exp $ */
+/* $NetBSD: if_ti.c,v 1.99 2016/07/14 04:15:27 msaitoh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.98 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.99 2016/07/14 04:15:27 msaitoh Exp $");
#include "opt_inet.h"
@@ -569,16 +569,16 @@
if ((error = bus_dmamem_alloc(sc->sc_dmat,
TI_JMEM, PAGE_SIZE, 0, &dmaseg, 1, &dmanseg,
BUS_DMA_NOWAIT)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't allocate jumbo buffer, error = %d\n",
- error);
+ aprint_error_dev(sc->sc_dev,
+ "can't allocate jumbo buffer, error = %d\n", error);
return (error);
}
if ((error = bus_dmamem_map(sc->sc_dmat, &dmaseg, dmanseg,
TI_JMEM, (void **)&sc->ti_cdata.ti_jumbo_buf,
BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't map jumbo buffer, error = %d\n",
- error);
+ aprint_error_dev(sc->sc_dev,
+ "can't map jumbo buffer, error = %d\n", error);
return (error);
}
@@ -586,16 +586,16 @@
TI_JMEM, 1,
TI_JMEM, 0, BUS_DMA_NOWAIT,
&sc->jumbo_dmamap)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't create jumbo buffer DMA map, error = %d\n",
- error);
+ aprint_error_dev(sc->sc_dev,
+ "can't create jumbo buffer DMA map, error = %d\n", error);
return (error);
}
if ((error = bus_dmamap_load(sc->sc_dmat, sc->jumbo_dmamap,
sc->ti_cdata.ti_jumbo_buf, TI_JMEM, NULL,
BUS_DMA_NOWAIT)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't load jumbo buffer DMA map, error = %d\n",
- error);
+ aprint_error_dev(sc->sc_dev,
+ "can't load jumbo buffer DMA map, error = %d\n", error);
return (error);
}
sc->jumbo_dmaaddr = sc->jumbo_dmamap->dm_segs[0].ds_addr;
@@ -703,8 +703,8 @@
if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1,
MCLBYTES, 0, BUS_DMA_NOWAIT,
&dmamap)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't create recv map, error = %d\n",
- error);
+ aprint_error_dev(sc->sc_dev,
+ "can't create recv map, error = %d\n", error);
return (ENOMEM);
}
}
@@ -713,15 +713,15 @@
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
- aprint_error_dev(sc->sc_dev, "mbuf allocation failed "
- "-- packet dropped!\n");
+ aprint_error_dev(sc->sc_dev,
+ "mbuf allocation failed -- packet dropped!\n");
return (ENOBUFS);
}
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
- aprint_error_dev(sc->sc_dev, "cluster allocation failed "
- "-- packet dropped!\n");
+ aprint_error_dev(sc->sc_dev,
+ "cluster allocation failed -- packet dropped!\n");
m_freem(m_new);
return (ENOBUFS);
}
@@ -731,8 +731,8 @@
if ((error = bus_dmamap_load(sc->sc_dmat, dmamap,
mtod(m_new, void *), m_new->m_len, NULL,
BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't load recv map, error = %d\n",
- error);
+ aprint_error_dev(sc->sc_dev,
+ "can't load recv map, error = %d\n", error);
m_freem(m_new);
return (ENOMEM);
}
@@ -778,8 +778,8 @@
if ((error = bus_dmamap_create(sc->sc_dmat, MHLEN, 1,
MHLEN, 0, BUS_DMA_NOWAIT,
&dmamap)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't create recv map, error = %d\n",
- error);
+ aprint_error_dev(sc->sc_dev,
+ "can't create recv map, error = %d\n", error);
return (ENOMEM);
}
}
@@ -788,8 +788,8 @@
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
- aprint_error_dev(sc->sc_dev, "mbuf allocation failed "
- "-- packet dropped!\n");
+ aprint_error_dev(sc->sc_dev,
+ "mbuf allocation failed -- packet dropped!\n");
return (ENOBUFS);
}
m_new->m_len = m_new->m_pkthdr.len = MHLEN;
@@ -798,8 +798,8 @@
if ((error = bus_dmamap_load(sc->sc_dmat, dmamap,
mtod(m_new, void *), m_new->m_len, NULL,
BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't load recv map, error = %d\n",
- error);
+ aprint_error_dev(sc->sc_dev,
+ "can't load recv map, error = %d\n", error);
m_freem(m_new);
return (ENOMEM);
}
@@ -844,8 +844,8 @@
/* Allocate the mbuf. */
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
- aprint_error_dev(sc->sc_dev, "mbuf allocation failed "
- "-- packet dropped!\n");
+ aprint_error_dev(sc->sc_dev,
+ "mbuf allocation failed -- packet dropped!\n");
return (ENOBUFS);
}
@@ -853,8 +853,8 @@
tbuf = ti_jalloc(sc);
if (tbuf == NULL) {
m_freem(m_new);
- aprint_error_dev(sc->sc_dev, "jumbo allocation failed "
- "-- packet dropped!\n");
+ aprint_error_dev(sc->sc_dev,
+ "jumbo allocation failed -- packet dropped!\n");
return (ENOBUFS);
}
@@ -1046,16 +1046,17 @@
SIMPLEQ_INIT(&sc->txdma_list);
for (i = 0; i < TI_RSLOTS; i++) {
/* I've seen mbufs with 30 fragments. */
- if ((error = bus_dmamap_create(sc->sc_dmat, ETHER_MAX_LEN_JUMBO,
- 40, ETHER_MAX_LEN_JUMBO, 0,
- BUS_DMA_NOWAIT, &dmamap)) != 0) {
- aprint_error_dev(sc->sc_dev, "can't create tx map, error = %d\n",
- error);
+ if ((error = bus_dmamap_create(sc->sc_dmat,
+ ETHER_MAX_LEN_JUMBO, 40, ETHER_MAX_LEN_JUMBO, 0,
+ BUS_DMA_NOWAIT, &dmamap)) != 0) {
+ aprint_error_dev(sc->sc_dev,
+ "can't create tx map, error = %d\n", error);
return (ENOMEM);
}
dma = malloc(sizeof(*dma), M_DEVBUF, M_NOWAIT);
if (!dma) {
- aprint_error_dev(sc->sc_dev, "can't alloc txdmamap_pool_entry\n");
+ aprint_error_dev(sc->sc_dev,
+ "can't alloc txdmamap_pool_entry\n");
bus_dmamap_destroy(sc->sc_dmat, dmamap);
return (ENOMEM);
}
@@ -1622,11 +1623,12 @@
t = ti_type_match(pa);
if (t == NULL) {
- printf("ti_attach: were did the card go ?\n");
+ aprint_error("ti_attach: were did the card go ?\n");
return;
}
- printf(": %s (rev. 0x%02x)\n", t->ti_name, PCI_REVISION(pa->pa_class));
+ aprint_normal(": %s (rev. 0x%02x)\n", t->ti_name,
+ PCI_REVISION(pa->pa_class));
sc = device_private(self);
sc->sc_dev = self;
@@ -1643,7 +1645,7 @@
if (pci_mapreg_map(pa, 0x10,
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
0 , &sc->ti_btag, &sc->ti_bhandle, NULL, NULL)) {
- printf(": can't map memory space\n");
+ aprint_error_dev(self, "can't map memory space\n");
return;
}
}
@@ -1695,7 +1697,7 @@
break;
default:
- printf("%s: Unknown chip version: %d\n", device_xname(self),
+ aprint_error_dev(self, "Unknown chip version: %d\n",
sc->ti_hwrev);
goto fail2;
}
@@ -1725,8 +1727,7 @@
/*
* A Tigon chip was detected. Inform the world.
*/
- aprint_error_dev(self, "Ethernet address: %s\n",
- ether_sprintf(eaddr));
+ aprint_normal_dev(self, "Ethernet address: %s\n",ether_sprintf(eaddr));
sc->sc_dmat = pa->pa_dmat;
@@ -1734,7 +1735,7 @@
if ((error = bus_dmamem_alloc(sc->sc_dmat,
sizeof(struct ti_ring_data), PAGE_SIZE, 0, &dmaseg, 1, &dmanseg,
BUS_DMA_NOWAIT)) != 0) {
- aprint_error_dev(sc->sc_dev,
+ aprint_error_dev(self,
"can't allocate ring buffer, error = %d\n", error);
goto fail2;
}
@@ -1742,7 +1743,7 @@
if ((error = bus_dmamem_map(sc->sc_dmat, &dmaseg, dmanseg,
sizeof(struct ti_ring_data), (void **)&sc->ti_rdata,
BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
- aprint_error_dev(sc->sc_dev,
+ aprint_error_dev(self,
"can't map ring buffer, error = %d\n", error);
goto fail2;
}
@@ -1751,7 +1752,7 @@
sizeof(struct ti_ring_data), 1,
sizeof(struct ti_ring_data), 0, BUS_DMA_NOWAIT,
&sc->info_dmamap)) != 0) {
- aprint_error_dev(sc->sc_dev,
+ aprint_error_dev(self,
"can't create ring buffer DMA map, error = %d\n", error);
goto fail2;
}
@@ -1759,7 +1760,7 @@
if ((error = bus_dmamap_load(sc->sc_dmat, sc->info_dmamap,
sc->ti_rdata, sizeof(struct ti_ring_data), NULL,
BUS_DMA_NOWAIT)) != 0) {
- aprint_error_dev(sc->sc_dev,
+ aprint_error_dev(self,
"can't load ring buffer DMA map, error = %d\n", error);
goto fail2;
}
Home |
Main Index |
Thread Index |
Old Index