From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2F5B7A00C5; Thu, 28 Jul 2022 17:28:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F5EF42C0E; Thu, 28 Jul 2022 17:27:39 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 8975542BB2 for ; Thu, 28 Jul 2022 17:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659022057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yk6VMzMHZos4jhNgfiaRuDiDrWZTSwiZTecFtiliC2Q=; b=BwXnH8A9NlsbDlA4GxZsCjUPkcwVnHD6yPA2lHYt7qmKGy9nTrBT+b3UBw133uvXWrJlhj SEU3eLE//l5SxacBi6tSNjfnpOSUL7ZMgrGPOvuJpHrVC56hplNWl/WeEPnaXTKRJ9/mqp UnFRN8WZjjGlxNnm+xQTcnwQKKoJ//c= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-317-0Loejj0PP6y7ShhFiAuIrQ-1; Thu, 28 Jul 2022 11:27:35 -0400 X-MC-Unique: 0Loejj0PP6y7ShhFiAuIrQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B65982801770; Thu, 28 Jul 2022 15:27:34 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.195.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBE611415118; Thu, 28 Jul 2022 15:27:33 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Rosen Xu , Ray Kinsella , Tianfei zhang Subject: [RFC v3 14/26] bus/ifpga: cleanup exported symbols Date: Thu, 28 Jul 2022 17:26:28 +0200 Message-Id: <20220728152640.547725-15-david.marchand@redhat.com> In-Reply-To: <20220728152640.547725-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220728152640.547725-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove unused symbols (exposed only in an internal header which guarantees that no application out there relied on them). Remove rte_ prefix and inline the rest to avoid having to expose them as global symbols for a relatively small added value. Signed-off-by: David Marchand --- drivers/bus/ifpga/ifpga_bus.c | 13 +++-- drivers/bus/ifpga/ifpga_common.c | 88 -------------------------------- drivers/bus/ifpga/ifpga_common.h | 54 ++++++++++++++++---- drivers/bus/ifpga/meson.build | 2 +- drivers/bus/ifpga/version.map | 2 - drivers/raw/ifpga/ifpga_rawdev.c | 2 +- 6 files changed, 53 insertions(+), 108 deletions(-) delete mode 100644 drivers/bus/ifpga/ifpga_common.c diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index e005f2cb70..b1e9eb7cc4 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -117,9 +117,9 @@ ifpga_scan_one(struct rte_rawdev *rawdev, if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) { if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT, - &rte_ifpga_get_integer32_arg, &afu_pr_conf.afu_id.port) < 0) { - IFPGA_BUS_ERR("error to parse %s", - IFPGA_ARG_PORT); + ifpga_get_integer32_arg, + &afu_pr_conf.afu_id.port) < 0) { + IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_PORT); goto end; } } else { @@ -130,9 +130,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev, if (rte_kvargs_count(kvlist, IFPGA_AFU_BTS) == 1) { if (rte_kvargs_process(kvlist, IFPGA_AFU_BTS, - &rte_ifpga_get_string_arg, &path) < 0) { - IFPGA_BUS_ERR("Failed to parse %s", - IFPGA_AFU_BTS); + ifpga_get_string_arg, &path) < 0) { + IFPGA_BUS_ERR("Failed to parse %s", IFPGA_AFU_BTS); goto end; } afu_pr_conf.pr_enable = 1; @@ -228,7 +227,7 @@ ifpga_scan(void) if (rte_kvargs_count(kvlist, IFPGA_ARG_NAME) == 1) { if (rte_kvargs_process(kvlist, IFPGA_ARG_NAME, - &rte_ifpga_get_string_arg, &name) < 0) { + ifpga_get_string_arg, &name) < 0) { IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_NAME); goto end; diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c deleted file mode 100644 index 78e2eaee4e..0000000000 --- a/drivers/bus/ifpga/ifpga_common.c +++ /dev/null @@ -1,88 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2018 Intel Corporation - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "rte_bus_ifpga.h" -#include "ifpga_logs.h" -#include "ifpga_common.h" - -int rte_ifpga_get_string_arg(const char *key __rte_unused, - const char *value, void *extra_args) -{ - if (!value || !extra_args) - return -EINVAL; - - *(char **)extra_args = strdup(value); - - if (!*(char **)extra_args) - return -ENOMEM; - - return 0; -} -int rte_ifpga_get_integer32_arg(const char *key __rte_unused, - const char *value, void *extra_args) -{ - if (!value || !extra_args) - return -EINVAL; - - *(int *)extra_args = strtoull(value, NULL, 0); - - return 0; -} -int ifpga_get_integer64_arg(const char *key __rte_unused, - const char *value, void *extra_args) -{ - if (!value || !extra_args) - return -EINVAL; - - *(uint64_t *)extra_args = strtoull(value, NULL, 0); - - return 0; -} -int ifpga_get_unsigned_long(const char *str, int base) -{ - unsigned long num; - char *end = NULL; - - errno = 0; - - num = strtoul(str, &end, base); - if ((str[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0)) - return -1; - - return num; -} - -int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0, - const struct rte_afu_id *afu_id1) -{ - if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) && - (afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) && - (afu_id0->port == afu_id1->port)) { - return 0; - } else - return 1; -} diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h index f9254b9d5d..bb6524030f 100644 --- a/drivers/bus/ifpga/ifpga_common.h +++ b/drivers/bus/ifpga/ifpga_common.h @@ -5,14 +5,50 @@ #ifndef _IFPGA_COMMON_H_ #define _IFPGA_COMMON_H_ -int rte_ifpga_get_string_arg(const char *key __rte_unused, - const char *value, void *extra_args); -int rte_ifpga_get_integer32_arg(const char *key __rte_unused, - const char *value, void *extra_args); -int ifpga_get_integer64_arg(const char *key __rte_unused, - const char *value, void *extra_args); -int ifpga_get_unsigned_long(const char *str, int base); -int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0, - const struct rte_afu_id *afu_id1); +#include +#include +#include + +#include +#include + +static inline int +ifpga_get_string_arg(const char *key __rte_unused, const char *value, + void *extra_args) +{ + if (!value || !extra_args) + return -EINVAL; + + *(char **)extra_args = strdup(value); + + if (!*(char **)extra_args) + return -ENOMEM; + + return 0; +} + +static inline int +ifpga_get_integer32_arg(const char *key __rte_unused, const char *value, + void *extra_args) +{ + if (!value || !extra_args) + return -EINVAL; + + *(int *)extra_args = strtoull(value, NULL, 0); + + return 0; +} + +static inline int +ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0, + const struct rte_afu_id *afu_id1) +{ + if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) && + (afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) && + (afu_id0->port == afu_id1->port)) { + return 0; + } else + return 1; +} #endif /* _IFPGA_COMMON_H_ */ diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build index cc5047e3ce..9d56a4bb2b 100644 --- a/drivers/bus/ifpga/meson.build +++ b/drivers/bus/ifpga/meson.build @@ -9,4 +9,4 @@ endif deps += ['pci', 'kvargs', 'rawdev'] headers = files('rte_bus_ifpga.h') -sources = files('ifpga_common.c', 'ifpga_bus.c') +sources = files('ifpga_bus.c') diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map index c0a1eecae8..da7f92c2a0 100644 --- a/drivers/bus/ifpga/version.map +++ b/drivers/bus/ifpga/version.map @@ -4,8 +4,6 @@ DPDK_23 { rte_ifpga_driver_register; rte_ifpga_driver_unregister; rte_ifpga_find_afu_by_name; - rte_ifpga_get_integer32_arg; - rte_ifpga_get_string_arg; local: *; }; diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index 78a7123528..93a7e74959 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -1752,7 +1752,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs, if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) { if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT, - &rte_ifpga_get_integer32_arg, &port) < 0) { + ifpga_get_integer32_arg, &port) < 0) { IFPGA_RAWDEV_PMD_ERR("error to parse %s", IFPGA_ARG_PORT); goto end; -- 2.36.1