update logging to use DPAA_BUS_XXX instead
of pr_xxx for better consistency and clarity in error
reporting within the DPAA bus subsystem.

Signed-off-by: Gagandeep Singh <[email protected]>
---
 drivers/bus/dpaa/base/qbman/qman.c | 74 +++++++++++++++++-------------
 1 file changed, 41 insertions(+), 33 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c 
b/drivers/bus/dpaa/base/qbman/qman.c
index 7c5ccc51bc..d6b2a58eaa 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -138,7 +138,7 @@ static inline int table_push_fq(struct qman_portal *p, 
struct qman_fq *fq)
        int ret = fqtree_push(&p->retire_table, fq);
 
        if (ret)
-               pr_err("ERROR: double FQ-retirement %d\n", fq->fqid);
+               DPAA_BUS_ERR("ERROR: double FQ-retirement %d", fq->fqid);
        return ret;
 }
 
@@ -162,12 +162,12 @@ int qman_setup_fq_lookup_table(size_t num_entries)
        /* Allocate 1 more entry since the first entry is not used */
        qman_fq_lookup_table = vmalloc((num_entries * sizeof(void *)));
        if (!qman_fq_lookup_table) {
-               pr_err("QMan: Could not allocate fq lookup table\n");
+               DPAA_BUS_ERR("QMan: Could not allocate fq lookup table");
                return -ENOMEM;
        }
        memset(qman_fq_lookup_table, 0, num_entries * sizeof(void *));
        qman_fq_lookup_table_size = num_entries;
-       pr_debug("QMan: Allocated lookup table at %p, entry count %lu\n",
+       DPAA_BUS_ERR("QMan: Allocated lookup table at %p, entry count %lu",
                qman_fq_lookup_table,
                        (unsigned long)qman_fq_lookup_table_size);
        return 0;
@@ -350,7 +350,8 @@ static int drain_mr_fqrni(struct qm_portal *p)
        }
        if ((msg->ern.verb & QM_MR_VERB_TYPE_MASK) != QM_MR_VERB_FQRNI) {
                /* We aren't draining anything but FQRNIs */
-               pr_err("Found verb 0x%x in MR\n", msg->ern.verb);
+               DPAA_BUS_ERR("Found verb 0x%x and after mask = 0x%x in MR",
+                       msg->ern.verb, msg->ern.verb & QM_MR_VERB_TYPE_MASK);
                return -1;
        }
        qm_mr_next(p);
@@ -424,11 +425,11 @@ static inline void qm_eqcr_finish(struct qm_portal 
*portal)
        DPAA_ASSERT(!eqcr->busy);
 #endif
        if (pi != EQCR_PTR2IDX(eqcr->cursor))
-               pr_crit("losing uncommitted EQCR entries\n");
+               DPAA_BUS_ERR("losing uncommitted EQCR entries");
        if (ci != eqcr->ci)
-               pr_crit("missing existing EQCR completions\n");
+               DPAA_BUS_ERR("missing existing EQCR completions");
        if (eqcr->ci != EQCR_PTR2IDX(eqcr->cursor))
-               pr_crit("EQCR destroyed unquiesced\n");
+               DPAA_BUS_ERR("EQCR destroyed unquiesced");
 }
 
 static inline int qm_dqrr_init(struct qm_portal *portal,
@@ -478,7 +479,7 @@ static inline void qm_dqrr_finish(struct qm_portal *portal)
 #ifdef RTE_LIBRTE_DPAA_HWDEBUG
        if ((dqrr->cmode != qm_dqrr_cdc) &&
            (dqrr->ci != DQRR_PTR2IDX(dqrr->cursor)))
-               pr_crit("Ignoring completed DQRR entries\n");
+               DPAA_BUS_WARN("Ignoring completed DQRR entries");
 #endif
 }
 
@@ -576,30 +577,33 @@ qman_init_portal(struct qman_portal *portal,
         */
        if (qm_eqcr_init(p, qm_eqcr_pvb,
                         portal->use_eqcr_ci_stashing, 1)) {
-               pr_err("Qman EQCR initialisation failed\n");
+               DPAA_BUS_ERR("Qman EQCR initialisation failed");
                goto fail_eqcr;
        }
        if (qm_dqrr_init(p, c, qm_dqrr_dpush, qm_dqrr_pvb,
                         qm_dqrr_cdc, DQRR_MAXFILL)) {
-               pr_err("Qman DQRR initialisation failed\n");
+               DPAA_BUS_ERR("Qman DQRR initialisation failed");
                goto fail_dqrr;
        }
        if (qm_mr_init(p, qm_mr_pvb, qm_mr_cci)) {
-               pr_err("Qman MR initialisation failed\n");
+               DPAA_BUS_ERR("Qman MR initialisation failed");
                goto fail_mr;
        }
        if (qm_mc_init(p)) {
-               pr_err("Qman MC initialisation failed\n");
+               DPAA_BUS_ERR("Qman MC initialisation failed");
                goto fail_mc;
        }
 
+
        /* static interrupt-gating controls */
        qm_dqrr_set_ithresh(p, 0);
        qm_mr_set_ithresh(p, 0);
        qm_isr_set_iperiod(p, 0);
        portal->cgrs = kmalloc(2 * sizeof(*cgrs), GFP_KERNEL);
-       if (!portal->cgrs)
+       if (!portal->cgrs) {
+               DPAA_BUS_ERR("CGRS allocation fails");
                goto fail_cgrs;
+       }
        /* initial snapshot is no-depletion */
        qman_cgrs_init(&portal->cgrs[1]);
        if (cgrs)
@@ -616,6 +620,7 @@ qman_init_portal(struct qman_portal *portal,
        portal->dqrr_disable_ref = 0;
        portal->cb_dc_ern = NULL;
        sprintf(buf, "qportal-%d", c->channel);
+       DPAA_BUS_DEBUG("PORTAL ID = %d and %p",  c->channel, p);
        dpa_rbtree_init(&portal->retire_table);
        isdr = 0xffffffff;
        qm_isr_disable_write(p, isdr);
@@ -625,7 +630,7 @@ qman_init_portal(struct qman_portal *portal,
        snprintf(portal->irqname, MAX_IRQNAME, IRQNAME, c->cpu);
        if (request_irq(c->irq, portal_isr, 0, portal->irqname,
                        portal)) {
-               pr_err("request_irq() failed\n");
+               DPAA_BUS_ERR("request_irq() failed");
                goto fail_irq;
        }
 
@@ -634,19 +639,22 @@ qman_init_portal(struct qman_portal *portal,
        qm_isr_disable_write(p, isdr);
        ret = qm_eqcr_get_fill(p);
        if (ret) {
-               pr_err("Qman EQCR unclean\n");
+               DPAA_BUS_ERR("Qman EQCR unclean");
                goto fail_eqcr_empty;
        }
        isdr &= ~(QM_PIRQ_DQRI | QM_PIRQ_MRI);
        qm_isr_disable_write(p, isdr);
        if (qm_dqrr_current(p)) {
-               pr_err("Qman DQRR unclean\n");
+               DPAA_BUS_ERR("Qman DQRR unclean");
                qm_dqrr_cdc_consume_n(p, 0xffff);
        }
        if (qm_mr_current(p) && drain_mr_fqrni(p)) {
                /* special handling, drain just in case it's a few FQRNIs */
-               if (drain_mr_fqrni(p))
+               DPAA_BUS_ERR("Draining MR FQRNI");
+               if (drain_mr_fqrni(p)) {
+                       DPAA_BUS_ERR("Draining MR FQRNI fails");
                        goto fail_dqrr_mr_empty;
+               }
        }
        /* Success */
        portal->config = c;
@@ -688,7 +696,7 @@ qman_alloc_global_portal(struct qm_portal_config *q_pcfg)
                        return &global_portals[i];
                }
        }
-       pr_err("No portal available (%x)\n", MAX_GLOBAL_PORTALS);
+       DPAA_BUS_ERR("No portal available (%x)", MAX_GLOBAL_PORTALS);
 
        return NULL;
 }
@@ -857,7 +865,7 @@ qman_ern_poll_free(void)
                fd = &swapped_msg.ern.fd;
 
                if (unlikely(verb & 0x20)) {
-                       pr_warn("HW ERN notification, Nothing to do\n");
+                       DPAA_BUS_WARN("HW ERN notification, Nothing to do");
                } else {
                        if ((fd->bpid & 0xff) != 0xff)
                                qman_free_mbuf_cb(fd);
@@ -963,13 +971,13 @@ static u32 __poll_portal_slow(struct qman_portal *p, u32 
is)
                                        static int warn_once;
 
                                        if (!warn_once) {
-                                               pr_crit("Leaking DCP ERNs!\n");
+                                               DPAA_BUS_WARN("Leaking DCP 
ERNs!");
                                                warn_once = 1;
                                        }
                                }
                                break;
                        default:
-                               pr_crit("Invalid MR verb 0x%02x\n", verb);
+                               DPAA_BUS_ERR("Invalid MR verb 0x%02x", verb);
                        }
                } else {
                        /* Its a software ERN */
@@ -1508,7 +1516,7 @@ int qman_create_fq(u32 fqid, u32 flags, struct qman_fq 
*fq)
        fq->cgr_groupid = 0;
 #ifdef CONFIG_FSL_QMAN_FQ_LOOKUP
        if (unlikely(find_empty_fq_table_entry(&fq->key, fq))) {
-               pr_info("Find empty table entry failed\n");
+               DPAA_BUS_ERR("Find empty table entry failed");
                return -ENOMEM;
        }
        fq->qman_fq_lookup_table = qman_fq_lookup_table;
@@ -1524,7 +1532,7 @@ int qman_create_fq(u32 fqid, u32 flags, struct qman_fq 
*fq)
                cpu_relax();
        DPAA_ASSERT((mcr->verb & QM_MCR_VERB_MASK) == QM_MCC_VERB_QUERYFQ);
        if (mcr->result != QM_MCR_RESULT_OK) {
-               pr_err("QUERYFQ failed: %s\n", mcr_result_str(mcr->result));
+               DPAA_BUS_ERR("QUERYFQ failed: %s", mcr_result_str(mcr->result));
                goto err;
        }
        fqd = mcr->queryfq.fqd;
@@ -1536,7 +1544,7 @@ int qman_create_fq(u32 fqid, u32 flags, struct qman_fq 
*fq)
                cpu_relax();
        DPAA_ASSERT((mcr->verb & QM_MCR_VERB_MASK) == QM_MCC_VERB_QUERYFQ_NP);
        if (mcr->result != QM_MCR_RESULT_OK) {
-               pr_err("QUERYFQ_NP failed: %s\n", mcr_result_str(mcr->result));
+               DPAA_BUS_ERR("QUERYFQ_NP failed: %s", 
mcr_result_str(mcr->result));
                goto err;
        }
        np = mcr->queryfq_np;
@@ -2062,7 +2070,7 @@ int qman_query_wq(u8 query_dedicated, struct 
qm_mcr_querywq *wq)
                        wq->wq_len[i] = be32_to_cpu(mcr->querywq.wq_len[i]);
        }
        if (res != QM_MCR_RESULT_OK) {
-               pr_err("QUERYWQ failed: %s\n", mcr_result_str(res));
+               DPAA_BUS_ERR("QUERYWQ failed: %s", mcr_result_str(res));
                return -EIO;
        }
        return 0;
@@ -2089,7 +2097,7 @@ int qman_testwrite_cgr(struct qman_cgr *cgr, u64 i_bcnt,
        if (res == QM_MCR_RESULT_OK)
                *result = mcr->cgrtestwrite;
        if (res != QM_MCR_RESULT_OK) {
-               pr_err("CGR TEST WRITE failed: %s\n", mcr_result_str(res));
+               DPAA_BUS_ERR("CGR TEST WRITE failed: %s", mcr_result_str(res));
                return -EIO;
        }
        return 0;
@@ -2113,7 +2121,7 @@ int qman_query_cgr(struct qman_cgr *cgr, struct 
qm_mcr_querycgr *cgrd)
        if (res == QM_MCR_RESULT_OK)
                *cgrd = mcr->querycgr;
        if (res != QM_MCR_RESULT_OK) {
-               pr_err("QUERY_CGR failed: %s\n", mcr_result_str(res));
+               DPAA_BUS_ERR("QUERY_CGR failed: %s", mcr_result_str(res));
                return -EIO;
        }
        cgrd->cgr.wr_parm_g.word =
@@ -2147,7 +2155,7 @@ int qman_query_congestion(struct qm_mcr_querycongestion 
*congestion)
        if (res == QM_MCR_RESULT_OK)
                *congestion = mcr->querycongestion;
        if (res != QM_MCR_RESULT_OK) {
-               pr_err("QUERY_CONGESTION failed: %s\n", mcr_result_str(res));
+               DPAA_BUS_ERR("QUERY_CONGESTION failed: %s", 
mcr_result_str(res));
                return -EIO;
        }
        for (i = 0; i < ARRAY_SIZE(congestion->state.state); i++)
@@ -2590,7 +2598,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags,
                /* we can't go back, so proceed and return success, but screen
                 * and wail to the log file.
                 */
-               pr_crit("CGR HW state partially modified\n");
+               DPAA_BUS_ERR("CGR HW state partially modified");
                ret = 0;
                goto release_lock;
        }
@@ -2610,7 +2618,7 @@ int qman_create_cgr_to_dcp(struct qman_cgr *cgr, u32 
flags, u16 dcp_portal,
        int ret;
 
        if ((qman_ip_rev & 0xFF00) < QMAN_REV30) {
-               pr_warn("QMan version doesn't support CSCN => DCP portal\n");
+               DPAA_BUS_WARN("QMan version doesn't support CSCN => DCP 
portal");
                return -EINVAL;
        }
        /* We have to check that the provided CGRID is within the limits of the
@@ -2657,9 +2665,9 @@ int qman_delete_cgr(struct qman_cgr *cgr)
        struct qman_portal *p = get_affine_portal();
 
        if (cgr->chan != p->config->channel) {
-               pr_crit("Attempting to delete cgr from different portal than"
-                       " it was create: create 0x%x, delete 0x%x\n",
-                       cgr->chan, p->config->channel);
+               DPAA_BUS_ERR("Attempting to delete cgr from different portal 
than"
+                            " it was create: create 0x%x, delete 0x%x",
+                            cgr->chan, p->config->channel);
                ret = -EINVAL;
                goto put_portal;
        }
-- 
2.25.1

Reply via email to