Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Convert printf() to aprint_*().



details:   https://anonhg.NetBSD.org/src/rev/4cfe9c541095
branches:  trunk
changeset: 336117:4cfe9c541095
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Fri Feb 13 17:40:13 2015 +0000

description:
Convert printf() to aprint_*().

diffstat:

 sys/dev/pci/if_iwm.c |  253 ++++++++++++++++++++++++++------------------------
 1 files changed, 133 insertions(+), 120 deletions(-)

diffs (truncated from 625 to 300 lines):

diff -r 0f081de0edb8 -r 4cfe9c541095 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Fri Feb 13 17:19:23 2015 +0000
+++ b/sys/dev/pci/if_iwm.c      Fri Feb 13 17:40:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iwm.c,v 1.2 2015/02/13 17:14:06 nonaka Exp $        */
+/*     $NetBSD: if_iwm.c,v 1.3 2015/02/13 17:40:13 nonaka Exp $        */
 /*     OpenBSD: if_iwm.c,v 1.18 2015/02/11 01:12:42 brad Exp   */
 
 /*
@@ -105,7 +105,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.2 2015/02/13 17:14:06 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.3 2015/02/13 17:40:13 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -611,8 +611,9 @@
         */
        error = iwm_firmload(sc);
        if (error != 0) {
-               printf("%s: could not read firmware %s (error %d)\n",
-                   DEVNAME(sc), sc->sc_fwname, error);
+               aprint_error_dev(sc->sc_dev,
+                   "could not read firmware %s (error %d)\n",
+                   sc->sc_fwname, error);
                goto out;
        }
 
@@ -623,8 +624,8 @@
        uhdr = (void *)fw->fw_rawdata;
        if (*(uint32_t *)fw->fw_rawdata != 0
            || le32toh(uhdr->magic) != IWM_TLV_UCODE_MAGIC) {
-               printf("%s: invalid firmware %s\n",
-                   DEVNAME(sc), sc->sc_fwname);
+               aprint_error_dev(sc->sc_dev, "invalid firmware %s\n",
+                   sc->sc_fwname);
                error = EINVAL;
                goto out;
        }
@@ -646,8 +647,8 @@
                tlv_data = data;
 
                if (len < tlv_len) {
-                       printf("%s: firmware too short: %zu bytes\n",
-                           DEVNAME(sc), len);
+                       aprint_error_dev(sc->sc_dev,
+                           "firmware too short: %zu bytes\n", len);
                        error = EINVAL;
                        goto parse_out;
                }
@@ -761,12 +762,13 @@
 
  parse_out:
        if (error) {
-               printf("%s: firmware parse error, "
-                   "section type %d\n", DEVNAME(sc), tlv_type);
+               aprint_error_dev(sc->sc_dev,
+                   "firmware parse error, section type %d\n", tlv_type);
        }
 
        if (!(sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_PM_CMD_SUPPORT)) {
-               printf("%s: device uses unsupported power ops\n", DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev,
+                   "device uses unsupported power ops\n");
                error = ENOTSUP;
        }
 
@@ -1057,8 +1059,8 @@
        size = IWM_RX_RING_COUNT * sizeof(uint32_t);
        error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->desc_dma, size, 256);
        if (error != 0) {
-               printf("%s: could not allocate RX ring DMA memory\n",
-                   DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev,
+                   "could not allocate RX ring DMA memory\n");
                goto fail;
        }
        ring->desc = ring->desc_dma.vaddr;
@@ -1067,8 +1069,8 @@
        error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->stat_dma,
            sizeof(*ring->stat), 16);
        if (error != 0) {
-               printf("%s: could not allocate RX status DMA memory\n",
-                   DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev,
+                   "could not allocate RX status DMA memory\n");
                goto fail;
        }
        ring->stat = ring->stat_dma.vaddr;
@@ -1084,8 +1086,8 @@
                    IWM_RBUF_SIZE, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
                    &data->map);
                if (error != 0) {
-                       printf("%s: could not create RX buf DMA map\n",
-                           DEVNAME(sc));
+                       aprint_error_dev(sc->sc_dev,
+                           "could not create RX buf DMA map\n");
                        goto fail;
                }
 
@@ -1154,8 +1156,8 @@
        size = IWM_TX_RING_COUNT * sizeof (struct iwm_tfd);
        error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->desc_dma, size, 256);
        if (error != 0) {
-               printf("%s: could not allocate TX ring DMA memory\n",
-                   DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev,
+                   "could not allocate TX ring DMA memory\n");
                goto fail;
        }
        ring->desc = ring->desc_dma.vaddr;
@@ -1170,7 +1172,8 @@
        size = IWM_TX_RING_COUNT * sizeof(struct iwm_device_cmd);
        error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->cmd_dma, size, 4);
        if (error != 0) {
-               printf("%s: could not allocate TX cmd DMA memory\n", DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev,
+                   "could not allocate TX cmd DMA memory\n");
                goto fail;
        }
        ring->cmd = ring->cmd_dma.vaddr;
@@ -1187,7 +1190,8 @@
                error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
                    IWM_NUM_OF_TBS, MCLBYTES, 0, BUS_DMA_NOWAIT, &data->map);
                if (error != 0) {
-                       printf("%s: could not create TX buf DMA map\n", DEVNAME(sc));
+                       aprint_error_dev(sc->sc_dev,
+                           "could not create TX buf DMA map\n");
                        goto fail;
                }
        }
@@ -1449,8 +1453,8 @@
        if (!iwm_poll_bit(sc, IWM_CSR_GP_CNTRL,
            IWM_CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
            IWM_CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000)) {
-               printf("%s: timeout waiting for clock stabilization\n",
-                   DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev,
+                   "timeout waiting for clock stabilization\n");
                goto out;
        }
 
@@ -1495,7 +1499,7 @@
 
  out:
        if (error)
-               printf("%s: apm init error %d\n", DEVNAME(sc), error);
+               aprint_error_dev(sc->sc_dev, "apm init error %d\n", error);
        return error;
 }
 
@@ -1509,8 +1513,8 @@
        if (!iwm_poll_bit(sc, IWM_CSR_RESET,
            IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED,
            IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED, 100))
-               printf("%s: timeout waiting for master\n", DEVNAME(sc));
-        DPRINTF(("iwm apm stop\n"));
+               aprint_error_dev(sc->sc_dev, "timeout waiting for master\n");
+       DPRINTF(("iwm apm stop\n"));
 }
 
 /* iwlwifi pcie/trans.c */
@@ -2438,9 +2442,9 @@
                error = iwm_nvm_read_chunk(sc,
                    section, *len, length, data, &seglen);
                if (error) {
-                       printf("%s: Cannot read NVM from section "
-                           "%d offset %d, length %d\n",
-                           DEVNAME(sc), section, *len, length);
+                       aprint_error_dev(sc->sc_dev,
+                           "Cannot read NVM from section %d offset %d, "
+                           "length %d\n", section, *len, length);
                        return error;
                }
                *len += seglen;
@@ -2787,7 +2791,7 @@
        IWM_WRITE(sc, IWM_CSR_INT, ~0);
 
        if ((error = iwm_nic_init(sc)) != 0) {
-               printf("%s: unable to init nic\n", DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev, "Unable to init nic\n");
                return error;
        }
 
@@ -2879,8 +2883,8 @@
 
        /* do not operate with rfkill switch turned on */
        if ((sc->sc_flags & IWM_FLAG_RFKILL) && !justnvm) {
-               printf("%s: radio is disabled by hardware switch\n",
-                   DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev,
+                   "radio is disabled by hardware switch\n");
                return EPERM;
        }
 
@@ -2891,7 +2895,7 @@
 
        if (justnvm) {
                if ((error = iwm_nvm_init(sc)) != 0) {
-                       printf("%s: failed to read nvm\n", DEVNAME(sc));
+                       aprint_error_dev(sc->sc_dev, "failed to read nvm\n");
                        return error;
                }
                memcpy(&sc->sc_ic.ic_myaddr,
@@ -3933,8 +3937,8 @@
            BUS_DMA_NOWAIT | BUS_DMA_WRITE);
        if (error != 0) {
                if (error != EFBIG) {
-                       printf("%s: can't map mbuf (error %d)\n", DEVNAME(sc),
-                           error);
+                       aprint_error_dev(sc->sc_dev,
+                           "can't map mbuf (error %d)\n", error);
                        m_freem(m);
                        return error;
                }
@@ -3960,8 +3964,8 @@
                error = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m,
                    BUS_DMA_NOWAIT | BUS_DMA_WRITE);
                if (error != 0) {
-                       printf("%s: can't map mbuf (error %d)\n", DEVNAME(sc),
-                           error);
+                       aprint_error_dev(sc->sc_dev,
+                           "can't map mbuf (error %d)\n", error);
                        m_freem(m);
                        return error;
                }
@@ -4036,7 +4040,8 @@
            sync ? IWM_CMD_SYNC : IWM_CMD_ASYNC,
            sizeof(flush_cmd), &flush_cmd);
        if (ret)
-                printf("%s: Flushing tx queue failed: %d\n", DEVNAME(sc), ret);
+               aprint_error_dev(sc->sc_dev, "Flushing tx queue failed: %d\n",
+                   ret);
        return ret;
 }
 #endif
@@ -4982,7 +4987,8 @@
        ret = iwm_mvm_send_cmd_pdu(sc,
            IWM_MAC_CONTEXT_CMD, IWM_CMD_SYNC, sizeof(cmd), &cmd);
        if (ret) {
-               printf("%s: Failed to remove MAC context: %d\n", DEVNAME(sc), ret);
+               aprint_error_dev(sc->sc_dev,
+                   "Failed to remove MAC context: %d\n", ret);
                return ret;
        }
        in->in_uploaded = 0;
@@ -5219,19 +5225,21 @@
        iwm_mvm_power_mac_disable(sc, in);
 
        if ((error = iwm_mvm_mac_ctxt_changed(sc, in)) != 0) {
-               printf("%s: mac ctxt change fail 1 %d\n", DEVNAME(sc), error);
+               aprint_error_dev(sc->sc_dev, "mac ctxt change fail 1 %d\n",
+                   error);
                return error;
        }
 
        if ((error = iwm_mvm_rm_sta(sc, in)) != 0) {
-               printf("%s: sta remove fail %d\n", DEVNAME(sc), error);
+               aprint_error_dev(sc->sc_dev, "sta remove fail %d\n", error);
                return error;
        }
        error = iwm_mvm_rm_sta(sc, in);
        in->in_assoc = 0;
        iwm_mvm_update_quotas(sc, NULL);
        if ((error = iwm_mvm_mac_ctxt_changed(sc, in)) != 0) {
-               printf("%s: mac ctxt change fail 2 %d\n", DEVNAME(sc), error);
+               aprint_error_dev(sc->sc_dev, "mac ctxt change fail 2 %d\n",
+                   error);
                return error;
        }
        iwm_mvm_binding_remove_vif(sc, in);
@@ -5446,7 +5454,7 @@
                if ((error = iwm_mvm_scan_request(sc, IEEE80211_CHAN_2GHZ,
                    ic->ic_des_esslen != 0,
                    ic->ic_des_essid, ic->ic_des_esslen)) != 0) {
-                       printf("%s: could not initiate scan\n", DEVNAME(sc));
+                        DPRINTF(("%s: could not initiate scan\n", DEVNAME(sc)));
                        return;
                }
                ic->ic_state = nstate;
@@ -5539,7 +5547,7 @@
                if ((error = iwm_mvm_scan_request(sc,
                    IEEE80211_CHAN_5GHZ, ic->ic_des_esslen != 0,
                    ic->ic_des_essid, ic->ic_des_esslen)) != 0) {
-                       printf("%s: could not initiate scan\n", DEVNAME(sc));
+                       DPRINTF(("%s: could not initiate scan\n", DEVNAME(sc)));
                        done = 1;
                }
 #else
@@ -5581,14 +5589,14 @@
         */
        iwm_stop_device(sc);
        if ((error = iwm_start_hw(sc)) != 0) {
-               printf("%s: could not initialize hardware\n", DEVNAME(sc));
+               aprint_error_dev(sc->sc_dev, "could not initialize hardware\n");
                return error;
        }
 



Home | Main Index | Thread Index | Old Index