DPDK patches and discussions
 help / color / mirror / Atom feed
From: Natanael Copa <ncopa@alpinelinux.org>
To: dev@dpdk.org
Cc: Natanael Copa <ncopa@alpinelinux.org>
Subject: [dpdk-dev] [PATCH 10/15] bus/dpaa: use warn(3) instead of error(3) to improve portability
Date: Mon, 11 Mar 2019 18:36:57 +0100	[thread overview]
Message-ID: <20190311173702.24471-11-ncopa@alpinelinux.org> (raw)
In-Reply-To: <20190311173702.24471-1-ncopa@alpinelinux.org>

Fix build with musl libc by using warn(3) instead of error(3).

This also fixes error message for kzmalloc failures which previously
would have given "Unknown error -1".

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---

Note that err.h is not in POSIX standard either, but is implemented in musl
libc.

 drivers/bus/dpaa/base/fman/netcfg_layer.c |  4 ++--
 drivers/bus/dpaa/base/qbman/bman_driver.c |  6 +++---
 drivers/bus/dpaa/base/qbman/qman_driver.c | 12 ++++++------
 drivers/bus/dpaa/include/compat.h         |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index 6b5224203..0c3a1bfa3 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -8,7 +8,7 @@
 #include <of.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
 #include <net/if_arp.h>
 #include <assert.h>
 #include <unistd.h>
@@ -89,7 +89,7 @@ netcfg_acquire(void)
 	 */
 	skfd = socket(AF_PACKET, SOCK_RAW, 0);
 	if (unlikely(skfd < 0)) {
-		error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+		warn("%s(): open(SOCK_RAW)", __func__);
 		return NULL;
 	}
 
diff --git a/drivers/bus/dpaa/base/qbman/bman_driver.c b/drivers/bus/dpaa/base/qbman/bman_driver.c
index 750b756b9..dbe00d1c9 100644
--- a/drivers/bus/dpaa/base/qbman/bman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/bman_driver.c
@@ -40,7 +40,7 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
 	ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
 				     &cpuset);
 	if (ret) {
-		error(0, ret, "pthread_getaffinity_np()");
+		warn("pthread_getaffinity_np()");
 		return ret;
 	}
 	pcfg.cpu = -1;
@@ -60,7 +60,7 @@ static int fsl_bman_portal_init(uint32_t idx, int is_shared)
 	map.index = idx;
 	ret = process_portal_map(&map);
 	if (ret) {
-		error(0, ret, "process_portal_map()");
+		warn("process_portal_map()");
 		return ret;
 	}
 	/* Make the portal's cache-[enabled|inhibited] regions */
@@ -105,7 +105,7 @@ static int fsl_bman_portal_finish(void)
 	DPAA_BUG_ON(cfg != &pcfg);
 	ret = process_portal_unmap(&map.addr);
 	if (ret)
-		error(0, ret, "process_portal_unmap()");
+		warn("process_portal_unmap()");
 	return ret;
 }
 
diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index ba153396d..163a66b30 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -41,7 +41,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
 	ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
 				     &cpuset);
 	if (ret) {
-		error(0, ret, "pthread_getaffinity_np()");
+		warn("pthread_getaffinity_np()");
 		return ret;
 	}
 	qpcfg.cpu = -1;
@@ -62,7 +62,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared)
 	map.index = index;
 	ret = process_portal_map(&map);
 	if (ret) {
-		error(0, ret, "process_portal_map()");
+		warn("process_portal_map()");
 		return ret;
 	}
 	qpcfg.channel = map.channel;
@@ -109,7 +109,7 @@ static int fsl_qman_portal_finish(void)
 	DPAA_BUG_ON(cfg != &qpcfg);
 	ret = process_portal_unmap(&map.addr);
 	if (ret)
-		error(0, ret, "process_portal_unmap()");
+		warn("process_portal_unmap()");
 	return ret;
 }
 
@@ -156,7 +156,7 @@ struct qman_portal *fsl_qman_portal_create(void)
 
 	q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
 	if (!q_pcfg) {
-		error(0, -1, "q_pcfg kzalloc failed");
+		warn("q_pcfg kzalloc failed");
 		return NULL;
 	}
 
@@ -164,7 +164,7 @@ struct qman_portal *fsl_qman_portal_create(void)
 	ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
 				     &cpuset);
 	if (ret) {
-		error(0, ret, "pthread_getaffinity_np()");
+		warn("pthread_getaffinity_np()");
 		kfree(q_pcfg);
 		return NULL;
 	}
@@ -190,7 +190,7 @@ struct qman_portal *fsl_qman_portal_create(void)
 	q_map.index = QBMAN_ANY_PORTAL_IDX;
 	ret = process_portal_map(&q_map);
 	if (ret) {
-		error(0, ret, "process_portal_map()");
+		warn("process_portal_map()");
 		kfree(q_pcfg);
 		return NULL;
 	}
diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h
index 412265779..0c01c5514 100644
--- a/drivers/bus/dpaa/include/compat.h
+++ b/drivers/bus/dpaa/include/compat.h
@@ -33,7 +33,7 @@
 #include <assert.h>
 #include <dirent.h>
 #include <inttypes.h>
-#include <error.h>
+#include <err.h>
 #include <rte_byteorder.h>
 #include <rte_atomic.h>
 #include <rte_spinlock.h>
-- 
2.21.0

  parent reply	other threads:[~2019-03-11 17:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11 17:36 [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 01/15] app/testpmd: replace uint with unsigned int Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 02/15] net/cxgbe: " Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc Natanael Copa
2019-03-12 10:16   ` [dpdk-dev] [PATCH v2 " Natanael Copa
2019-03-13 11:13     ` Ferruh Yigit
2019-03-13 17:08       ` Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 04/15] bus/pci: factor out various ifdefs in pci_uio_ioport_{read, write} Natanael Copa
2019-03-12 10:18   ` [dpdk-dev] [PATCH v2 " Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 05/15] bus/fslmc: fix compile error with musl libc Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 06/15] bus/fslmc: remove unused include of error.h Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 07/15] net/nfp: build fix for musl libc Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 08/15] app/test: include fcntl.h due to use of O_RDONLY Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 09/15] app/test: fix setting of -D_GNU_SOURCE with meson Natanael Copa
2019-03-11 17:36 ` Natanael Copa [this message]
2019-03-11 17:36 ` [dpdk-dev] [PATCH 11/15] bus/dpaa: fix warning: "__WORDSIZE" is not defined, evaluates to 0 Natanael Copa
2019-03-11 17:36 ` [dpdk-dev] [PATCH 12/15] crypto/dpaa2_sec: build fix for musl libc Natanael Copa
2019-03-12 10:20   ` [dpdk-dev] [PATCH v2 " Natanael Copa
2019-03-11 17:37 ` [dpdk-dev] [PATCH 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros Natanael Copa
2019-03-11 17:37 ` [dpdk-dev] [PATCH 14/15] net/netvsc: fix compile warning for fcntl.h include Natanael Copa
2019-03-11 18:17   ` Stephen Hemminger
2019-03-11 17:37 ` [dpdk-dev] [PATCH 15/15] eal/linux: use gettid(2) for debug message in sigbus_handler Natanael Copa
2019-03-11 18:21   ` Stephen Hemminger
2019-03-12 10:22     ` [dpdk-dev] [PATCH v2 15/15] eal/linux: simplify " Natanael Copa
2019-03-13 11:45 ` [dpdk-dev] [PATCH 00/15] Build fixes for musl libc Sirvys, Andrius
2019-03-13 16:53   ` Natanael Copa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190311173702.24471-11-ncopa@alpinelinux.org \
    --to=ncopa@alpinelinux.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).