lkml.org 
[lkml]   [2008]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86 Topology cpu_to_node parameter check
* Steven Rostedt (rostedt@goodmis.org) wrote:
>
> On Fri, 3 Oct 2008, Mathieu Desnoyers wrote:
>
> > ---
> > include/asm-x86/topology.h | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > Index: linux-2.6-lttng/include/asm-x86/topology.h
> > ===================================================================
> > --- linux-2.6-lttng.orig/include/asm-x86/topology.h 2008-10-03 00:37:05.000000000 -0400
> > +++ linux-2.6-lttng/include/asm-x86/topology.h 2008-10-03 00:45:52.000000000 -0400
> > @@ -182,9 +182,9 @@ extern int __node_distance(int, int);
> >
> > #else /* !CONFIG_NUMA */
> >
> > -#define numa_node_id() 0
> > -#define cpu_to_node(cpu) 0
> > -#define early_cpu_to_node(cpu) 0
> > +#define numa_node_id() 0
> > +#define cpu_to_node(cpu) ((void)(cpu),0)
> > +#define early_cpu_to_node(cpu) cpu_to_node(cpu)
>
> Actually the proper way would be to have:
>
> static inline int cpu_to_node(int cpu)
> {
> return 0;
> }
>
> static inline int early_cpu_to_node(int cpu)
> {
> return 0;
> }
>
> This way you also get typechecks.
>

That's how I did it first, but then I looked at asm-generic/topology.h
and have seen it uses #defines. Should we change them too ?

Mathieu

> -- Steve
>
> >
> > static inline const cpumask_t *_node_to_cpumask_ptr(int node)
> > {
> > --
> > Mathieu Desnoyers
> > OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
> >
>

--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68


\
 
 \ /
  Last update: 2008-10-03 17:59    [from the cache]
©2003-2011 Jasper Spaans