[dpdk-dev,v5,1/7] bus: fix bus name registration

Message ID 206669e001a4561a5f5c10deebcf70742688f380.1497999826.git.gaetan.rivet@6wind.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Gaëtan Rivet June 20, 2017, 11:30 p.m. UTC
  The default bus registration function should not result in buses
registering with double quotes within their names.

Fixes: a97725791eec ("bus: introduce bus abstraction")
Cc: stable@dpdk.org

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_eal/common/include/rte_bus.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Bruce Richardson June 27, 2017, 3:53 p.m. UTC | #1
On Wed, Jun 21, 2017 at 01:30:30AM +0200, Gaetan Rivet wrote:
> The default bus registration function should not result in buses
> registering with double quotes within their names.
> 
> Fixes: a97725791eec ("bus: introduce bus abstraction")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Jan Blunck June 27, 2017, 7:19 p.m. UTC | #2
On Wed, Jun 21, 2017 at 1:30 AM, Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
> The default bus registration function should not result in buses
> registering with double quotes within their names.
>

This is breaking expectations with users. All other registration macro
pass the names through the stringification. The problem is that you
pass in the name as a string already ("PCI" instead of PCI).


> Fixes: a97725791eec ("bus: introduce bus abstraction")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---
>  lib/librte_eal/common/include/rte_bus.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
> index fcc2442..b220299 100644
> --- a/lib/librte_eal/common/include/rte_bus.h
> +++ b/lib/librte_eal/common/include/rte_bus.h
> @@ -254,7 +254,7 @@ struct rte_bus *rte_bus_find_by_device(const struct rte_device *dev);
>  #define RTE_REGISTER_BUS(nm, bus) \
>  static void __attribute__((constructor(101), used)) businitfn_ ##nm(void) \
>  {\
> -       (bus).name = RTE_STR(nm);\
> +       (bus).name = nm;\
>         rte_bus_register(&bus); \
>  }
>
> --
> 2.1.4
>
  
Gaëtan Rivet July 4, 2017, 1:05 a.m. UTC | #3
On Tue, Jun 27, 2017 at 09:19:14PM +0200, Jan Blunck wrote:
> On Wed, Jun 21, 2017 at 1:30 AM, Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
> > The default bus registration function should not result in buses
> > registering with double quotes within their names.
> >
> 
> This is breaking expectations with users. All other registration macro
> pass the names through the stringification. The problem is that you
> pass in the name as a string already ("PCI" instead of PCI).
> 
> 

I agree that it does not behave as expected.
However, all buses are currently using it this way, and this
cannot be fixed if maintainers keep using public define's
for their bus name.

> > Fixes: a97725791eec ("bus: introduce bus abstraction")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> > ---
> >  lib/librte_eal/common/include/rte_bus.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
> > index fcc2442..b220299 100644
> > --- a/lib/librte_eal/common/include/rte_bus.h
> > +++ b/lib/librte_eal/common/include/rte_bus.h
> > @@ -254,7 +254,7 @@ struct rte_bus *rte_bus_find_by_device(const struct rte_device *dev);
> >  #define RTE_REGISTER_BUS(nm, bus) \
> >  static void __attribute__((constructor(101), used)) businitfn_ ##nm(void) \
> >  {\
> > -       (bus).name = RTE_STR(nm);\
> > +       (bus).name = nm;\
> >         rte_bus_register(&bus); \
> >  }
> >
> > --
> > 2.1.4
> >
  

Patch

diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index fcc2442..b220299 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -254,7 +254,7 @@  struct rte_bus *rte_bus_find_by_device(const struct rte_device *dev);
 #define RTE_REGISTER_BUS(nm, bus) \
 static void __attribute__((constructor(101), used)) businitfn_ ##nm(void) \
 {\
-	(bus).name = RTE_STR(nm);\
+	(bus).name = nm;\
 	rte_bus_register(&bus); \
 }