From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <nhorman@tuxdriver.com>
Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58])
 by dpdk.org (Postfix) with ESMTP id 9FBB7379E
 for <dev@dpdk.org>; Thu,  7 Jul 2016 18:12:29 +0200 (CEST)
Received: from [2606:a000:111b:40ed:7aac:c0ff:fec2:933b] (helo=localhost)
 by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63)
 (envelope-from <nhorman@tuxdriver.com>)
 id 1bLBu5-0006dM-Q5; Thu, 07 Jul 2016 12:12:06 -0400
Date: Thu, 7 Jul 2016 12:11:41 -0400
From: Neil Horman <nhorman@tuxdriver.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org
Message-ID: <20160707161141.GH26064@hmsreliant.think-freely.org>
References: <1467905790-10597-1-git-send-email-thomas.monjalon@6wind.com>
 <1467905790-10597-10-git-send-email-thomas.monjalon@6wind.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1467905790-10597-10-git-send-email-thomas.monjalon@6wind.com>
User-Agent: Mutt/1.6.1 (2016-04-27)
X-Spam-Score: -1.0 (-)
X-Spam-Status: No
Subject: Re: [dpdk-dev] [PATCH 09/11] eal: move PCI table macro
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 07 Jul 2016 16:12:29 -0000

On Thu, Jul 07, 2016 at 05:36:28PM +0200, Thomas Monjalon wrote:
> Remove include of rte_pci.h in the generic header rte_dev.h
> and move the macro DRIVER_REGISTER_PCI_TABLE in rte_pci.h.
> 
> Fixes: cb6696d22023 ("drivers: update registration macro usage")
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
>  lib/librte_eal/common/include/rte_dev.h | 6 +-----
>  lib/librte_eal/common/include/rte_pci.h | 5 +++++
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
> index e6f0d4c..68ca7ef 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -48,7 +48,7 @@ extern "C" {
>  
>  #include <stdio.h>
>  #include <sys/queue.h>
> -#include <rte_pci.h>
> +
>  #include <rte_log.h>
>  
>  __attribute__((format(printf, 2, 0)))
> @@ -195,10 +195,6 @@ DRIVER_EXPORT_NAME(nm, __COUNTER__)
>  
>  #define DRV_EXP_TAG(name, tag) __##name##_##tag
>  
> -#define DRIVER_REGISTER_PCI_TABLE(name, table) \
> -static const char DRV_EXP_TAG(name, pci_tbl_export)[] __attribute__((used)) = \
> -RTE_STR(table)
> -
>  #define DRIVER_REGISTER_PARAM_STRING(name, str) \
>  static const char DRV_EXP_TAG(name, param_string_export)[] \
>  __attribute__((used)) = str
> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
> index fa74962..3b0d26a 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -188,6 +188,11 @@ struct rte_pci_device {
>  	.subsystem_device_id = PCI_ANY_ID
>  #endif
>  
> +#define DRIVER_REGISTER_PCI_TABLE(name, table) \
> +static const char __##name##_pci_tbl_export[] \
> +	__attribute__((used)) = \
> +	RTE_STR(table)
> +
>  struct rte_pci_driver;
>  
>  /**
> -- 
> 2.7.0
> 
> 

This seems strange to me, in that its odd for the driver information export
macros to be spread out in multiple locations.  Specifically it enjoins the use
of the DRV_EXP_TAG macro, which helps centralize tag naming.  Perhaps the happy
medium is to place all the export macros (includnig PMD_REGISTER_DRIVER) into
its own pmd_register.h header?