All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drivers: replace printf with log macros
@ 2023-02-15 10:29 Hemant Agrawal
  2023-02-15 10:29 ` [PATCH 2/2] drivers: replace printf with fprintf for debug functions Hemant Agrawal
  2024-07-02 10:40 ` [PATCH v2 1/2] drivers: replace printf with log macros Hemant Agrawal
  0 siblings, 2 replies; 22+ messages in thread
From: Hemant Agrawal @ 2023-02-15 10:29 UTC (permalink / raw)
  To: dev, thomas

This patch replaces the printf with related log macros and functions at
various places in NXP dpaaX drivers.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/fman/fman.c      |  8 +++----
 drivers/bus/dpaa/base/qbman/process.c  | 29 +++++++++++++-------------
 drivers/bus/dpaa/base/qbman/qman.c     |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c         |  2 +-
 drivers/bus/fslmc/qbman/qbman_portal.c |  2 +-
 drivers/crypto/caam_jr/caam_jr.c       |  2 +-
 drivers/crypto/caam_jr/caam_jr_uio.c   |  2 +-
 drivers/net/dpaa/dpaa_ethdev.c         |  6 +++---
 drivers/net/dpaa/dpaa_flow.c           |  8 +++----
 drivers/net/dpaa/dpaa_rxtx.c           |  2 +-
 drivers/net/dpaa2/dpaa2_ethdev.c       |  2 +-
 drivers/net/dpaa2/dpaa2_tm.c           | 10 ++++-----
 12 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 1814372a40..2fc1e64f36 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -425,7 +425,7 @@ fman_if_init(const struct device_node *dpa_node)
 		char_prop = of_get_property(mac_node, "phy-connection-type",
 					    NULL);
 		if (!char_prop) {
-			printf("memac: unknown MII type assuming 1G\n");
+			FMAN_ERR(-EINVAL, "memac: unknown MII type assuming 1G\n");
 			/* Right now forcing memac to 1g in case of error*/
 			__if->__if.mac_type = fman_mac_1g;
 		} else {
@@ -723,10 +723,8 @@ fman_finish(void)
 		/* release the mapping */
 		_errno = munmap(__if->ccsr_map, __if->regs_size);
 		if (unlikely(_errno < 0))
-			fprintf(stderr, "%s:%d:%s(): munmap() = %d (%s)\n",
-				__FILE__, __LINE__, __func__,
-				-errno, strerror(errno));
-		printf("Tearing down %s\n", __if->node_path);
+			FMAN_ERR(_errno, "munmap() = (%s)\n", strerror(errno));
+		DPAA_BUS_INFO("Tearing down %s\n", __if->node_path);
 		list_del(&__if->__if.node);
 		rte_free(__if);
 	}
diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c
index 3504ec97db..af1e459641 100644
--- a/drivers/bus/dpaa/base/qbman/process.c
+++ b/drivers/bus/dpaa/base/qbman/process.c
@@ -13,6 +13,7 @@
 #include "process.h"
 
 #include <fsl_usd.h>
+#include "rte_dpaa_logs.h"
 
 /* As higher-level drivers will be built on top of this (dma_mem, qbman, ...),
  * it's preferable that the process driver itself not provide any exported API.
@@ -99,12 +100,12 @@ void process_release(enum dpaa_id_type id_type, uint32_t base, uint32_t num)
 	int ret = check_fd();
 
 	if (ret) {
-		fprintf(stderr, "Process FD failure\n");
+		DPAA_BUS_ERR("Process FD failure\n");
 		return;
 	}
 	ret = ioctl(fd, DPAA_IOCTL_ID_RELEASE, &id);
 	if (ret)
-		fprintf(stderr, "Process FD ioctl failure type %d base 0x%x num %d\n",
+		DPAA_BUS_ERR("Process FD ioctl failure type %d base 0x%x num %d\n",
 			id_type, base, num);
 }
 
@@ -333,9 +334,9 @@ int dpaa_intr_disable(char *if_name)
 	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT, if_name);
 	if (ret) {
 		if (errno == EINVAL)
-			printf("Failed to disable interrupt: Not Supported\n");
+			DPAA_BUS_ERR("Failed to disable interrupt: Not Supported\n");
 		else
-			printf("Failed to disable interrupt\n");
+			DPAA_BUS_ERR("Failed to disable interrupt\n");
 		return ret;
 	}
 
@@ -357,7 +358,7 @@ int dpaa_get_ioctl_version_number(void)
 		if (errno == EINVAL) {
 			version_num = 1;
 		} else {
-			printf("Failed to get ioctl version number\n");
+			DPAA_BUS_ERR("Failed to get ioctl version number\n");
 			version_num = -1;
 		}
 	}
@@ -388,7 +389,7 @@ int dpaa_get_link_status(char *if_name, struct rte_eth_link *link)
 
 		ret = ioctl(fd, DPAA_IOCTL_GET_LINK_STATUS, &args);
 		if (ret) {
-			printf("Failed to get link status\n");
+			DPAA_BUS_ERR("Failed to get link status\n");
 			return ret;
 		}
 
@@ -404,9 +405,9 @@ int dpaa_get_link_status(char *if_name, struct rte_eth_link *link)
 		ret = ioctl(fd, DPAA_IOCTL_GET_LINK_STATUS_OLD, &args);
 		if (ret) {
 			if (errno == EINVAL)
-				printf("Get link status: Not Supported\n");
+				DPAA_BUS_ERR("Get link status: Not Supported\n");
 			else
-				printf("Failed to get link status\n");
+				DPAA_BUS_ERR("Failed to get link status\n");
 			return ret;
 		}
 
@@ -434,9 +435,9 @@ int dpaa_update_link_status(char *if_name, int link_status)
 	ret = ioctl(fd, DPAA_IOCTL_UPDATE_LINK_STATUS, &args);
 	if (ret) {
 		if (errno == EINVAL)
-			printf("Failed to set link status: Not Supported\n");
+			DPAA_BUS_ERR("Failed to set link status: Not Supported\n");
 		else
-			printf("Failed to set link status");
+			DPAA_BUS_ERR("Failed to set link status");
 		return ret;
 	}
 
@@ -462,9 +463,9 @@ int dpaa_update_link_speed(char *if_name, int link_speed, int link_duplex)
 	ret = ioctl(fd, DPAA_IOCTL_UPDATE_LINK_SPEED, &args);
 	if (ret) {
 		if (errno == EINVAL)
-			printf("Failed to set link speed: Not Supported\n");
+			DPAA_BUS_ERR("Failed to set link speed: Not Supported\n");
 		else
-			printf("Failed to set link speed\n");
+			DPAA_BUS_ERR("Failed to set link speed\n");
 		return ret;
 	}
 
@@ -484,9 +485,9 @@ int dpaa_restart_link_autoneg(char *if_name)
 	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, if_name);
 	if (ret) {
 		if (errno == EINVAL)
-			printf("Failed to restart autoneg: Not Supported\n");
+			DPAA_BUS_ERR("Failed to restart autoneg: Not Supported\n");
 		else
-			printf("Failed to restart autoneg\n");
+			DPAA_BUS_ERR("Failed to restart autoneg\n");
 		return ret;
 	}
 
diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 3949bf8712..95c796c4b8 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -818,7 +818,7 @@ qman_ern_poll_free(void)
 		fd = &swapped_msg.ern.fd;
 
 		if (unlikely(verb & 0x20)) {
-			printf("HW ERN notification, Nothing to do\n");
+			pr_warn("HW ERN notification, Nothing to do\n");
 		} else {
 			if ((fd->bpid & 0xff) != 0xff)
 				qman_free_mbuf_cb(fd);
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 5966776a85..da0669d554 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -395,7 +395,7 @@ rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size)
 	ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA,
 		    &dma_map);
 	if (ret) {
-		printf("Unable to map DMA address (errno = %d)\n",
+		DPAA2_BUS_ERR("Unable to map DMA address (errno = %d)\n",
 			errno);
 		return ret;
 	}
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 3a7579c8a7..1f24cdce7e 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -1879,7 +1879,7 @@ void qbman_pull_desc_set_rad(struct qbman_pull_desc *d, int rad)
 		else
 			d->pull.verb &= ~(1 << QB_VDQCR_VERB_RAD_SHIFT);
 	} else {
-		printf("The RAD feature is not valid when RLS = 0\n");
+		pr_warn("The RAD feature is not valid when RLS = 0\n");
 	}
 }
 
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index b55258689b..9373cee57d 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -587,7 +587,7 @@ hw_poll_job_ring(struct sec_job_ring_t *job_ring,
 		/* todo check if it is false alarm no desc present */
 		if (!current_desc_addr) {
 			false_alarm++;
-			printf("false alarm %" PRIu64 "real %" PRIu64
+			CAAM_JR_ERR("false alarm %" PRIu64 "real %" PRIu64
 				" sec_err =0x%x cidx Index =0%d\n",
 				false_alarm, real_poll,
 				sec_error_code, job_ring->cidx);
diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 583ba3b523..586beceb14 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -418,7 +418,7 @@ sec_configure(void)
 
 	d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
-		printf("\nError opening directory '%s': %s\n",
+		CAAM_JR_ERR("Error opening directory '%s': %s\n",
 			SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
 		return -1;
 	}
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a6c86113d1..59bcebd62f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -282,9 +282,9 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 					dpaa_interrupt_handler,
 					(void *)dev);
 				if (ret == EINVAL)
-					printf("Failed to enable interrupt: Not Supported\n");
+					DPAA_PMD_ERR("Failed to enable interrupt: Not Supported\n");
 				else
-					printf("Failed to enable interrupt\n");
+					DPAA_PMD_ERR("Failed to enable interrupt\n");
 			}
 			dev->data->dev_conf.intr_conf.lsc = 0;
 			dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
@@ -340,7 +340,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 			dpaa_update_link_speed(__fif->node_name, speed, duplex);
 		} else {
 			/* Manual autoneg - custom advertisement speed. */
-			printf("Custom Advertisement speeds not supported\n");
+			DPAA_PMD_ERR("Custom Advertisement speeds not supported\n");
 		}
 	}
 
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index 690ba6bcb3..5c75f4220e 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -68,7 +68,7 @@ static void fm_prev_cleanup(void)
 
 	fm_info.fman_handle = fm_open(fman_id);
 	if (!fm_info.fman_handle) {
-		printf("\n%s- unable to open FMAN", __func__);
+		DPAA_PMD_ERR("unable to open FMAN");
 		return;
 	}
 
@@ -78,7 +78,7 @@ static void fm_prev_cleanup(void)
 	/* FM PCD Open */
 	fm_info.pcd_handle = fm_pcd_open(&fm_pcd_params);
 	if (!fm_info.pcd_handle) {
-		printf("\n%s- unable to open PCD", __func__);
+		DPAA_PMD_ERR("unable to open PCD");
 		return;
 	}
 
@@ -108,11 +108,11 @@ static void fm_prev_cleanup(void)
 			continue;
 
 		if (dpaa_fm_deconfig(&dpaa_intf, NULL))
-			printf("\nDPAA FM deconfig failed\n");
+			DPAA_PMD_ERR("DPAA FM deconfig failed\n");
 	}
 
 	if (dpaa_fm_term())
-		printf("\nDPAA FM term failed\n");
+		DPAA_PMD_ERR("DPAA FM term failed\n");
 
 	memset(&fm_model, 0, sizeof(struct dpaa_fm_model));
 }
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index ce4f3d6c85..c2579d65ee 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -103,7 +103,7 @@ static void dpaa_display_frame_info(const struct qm_fd *fd,
 	for (ii = 0; ii < fd->length20; ii++) {
 		DISPLAY_PRINT("%02x ", ptr[ii]);
 		if (((ii + 1) % 16) == 0)
-			printf("\n");
+			DISPLAY_PRINT("\n");
 	}
 	DISPLAY_PRINT("\n");
 }
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 679f33ae1a..6f79f20d12 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -2682,7 +2682,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	priv->max_vlan_filters = attr.vlan_filter_entries;
 	priv->flags = 0;
 #if defined(RTE_LIBRTE_IEEE1588)
-	printf("DPDK IEEE1588 is enabled\n");
+	DPAA2_PMD_INFO("DPDK IEEE1588 is enabled\n");
 	priv->flags |= DPAA2_TX_CONF_ENABLE;
 #endif
 	/* Used with ``fslmc:dpni.1,drv_tx_conf=1`` */
diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c
index 8fe5bfa013..cd6739dcfa 100644
--- a/drivers/net/dpaa2/dpaa2_tm.c
+++ b/drivers/net/dpaa2/dpaa2_tm.c
@@ -499,7 +499,7 @@ dpaa2_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 			node->channel_id = priv->channel_inuse;
 			priv->channel_inuse++;
 		} else {
-			printf("error no channel id available\n");
+			DPAA2_PMD_ERR("error no channel id available\n");
 		}
 	}
 
@@ -580,7 +580,7 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
 	flow_id = 0;
 
 	if (dpaa2_q == NULL) {
-		printf("Queue is not configured for node = %d\n", node->id);
+		DPAA2_PMD_ERR("Queue is not configured for node = %d\n", node->id);
 		return -1;
 	}
 
@@ -590,7 +590,7 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
 			     ((node->parent->channel_id << 8) | tc_id),
 			     flow_id, options, &tx_flow_cfg);
 	if (ret) {
-		printf("Error in setting the tx flow: "
+		DPAA2_PMD_ERR("Error in setting the tx flow: "
 		       "channel id  = %d tc_id= %d, param = 0x%x "
 		       "flow=%d err=%d\n", node->parent->channel_id, tc_id,
 		       ((node->parent->channel_id << 8) | tc_id), flow_id,
@@ -605,7 +605,7 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
 		DPNI_QUEUE_TX, ((node->parent->channel_id << 8) | dpaa2_q->tc_index),
 		dpaa2_q->flow_id, &tx_flow_cfg, &qid);
 	if (ret) {
-		printf("Error in getting LFQID err=%d", ret);
+		DPAA2_PMD_ERR("Error in getting LFQID err=%d", ret);
 		return -1;
 	}
 	dpaa2_q->fqid = qid.fqid;
@@ -636,7 +636,7 @@ dpaa2_tm_configure_queue(struct rte_eth_dev *dev, struct dpaa2_tm_node *node)
 					((node->parent->channel_id << 8) | tc_id),
 					&cong_notif_cfg);
 		if (ret) {
-			printf("Error in setting tx congestion notification: "
+			DPAA2_PMD_ERR("Error in setting tx congestion notification: "
 				"err=%d", ret);
 			return -ret;
 		}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-07-03 14:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-15 10:29 [PATCH 1/2] drivers: replace printf with log macros Hemant Agrawal
2023-02-15 10:29 ` [PATCH 2/2] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2023-02-15 15:16   ` Thomas Monjalon
2023-02-16  9:27     ` Hemant Agrawal
2024-07-02  9:31       ` David Marchand
2024-07-02  9:59         ` Hemant Agrawal
2023-02-15 17:17   ` Stephen Hemminger
2024-07-02 10:40 ` [PATCH v2 1/2] drivers: replace printf with log macros Hemant Agrawal
2024-07-02 10:40   ` [PATCH v2 2/2] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2024-07-02 15:11     ` Stephen Hemminger
2024-07-02 17:26       ` Hemant Agrawal
2024-07-02 12:15   ` [PATCH v2 1/2] drivers: replace printf with log macros David Marchand
2024-07-02 13:08   ` [PATCH v3 1/3] " Hemant Agrawal
2024-07-02 13:08     ` [PATCH v3 2/3] bus/dpaa: remove double newline Hemant Agrawal
2024-07-02 13:08     ` [PATCH v3 3/3] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2024-07-03 10:41     ` [PATCH v3 1/3] drivers: replace printf with log macros David Marchand
2024-07-03 12:02       ` Hemant Agrawal
2024-07-03 12:11         ` David Marchand
2024-07-03 12:16     ` [PATCH v4 " Hemant Agrawal
2024-07-03 12:16       ` [PATCH v4 2/3] drivers: dpaa: remove double newline Hemant Agrawal
2024-07-03 12:16       ` [PATCH v4 3/3] drivers: replace printf with fprintf for debug functions Hemant Agrawal
2024-07-03 14:54       ` [PATCH v4 1/3] drivers: replace printf with log macros David Marchand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.