Re: [PATCH] cpumask: introduce new API, without changing anything
[Posted November 12, 2008 by corbet]
| From: |
| Ingo Molnar <mingo-AT-elte.hu> |
| To: |
| Andrew Morton <akpm-AT-linux-foundation.org> |
| Subject: |
| Re: [PATCH] cpumask: introduce new API, without changing anything |
| Date: |
| Fri, 7 Nov 2008 09:57:46 +0100 |
| Message-ID: |
| <20081107085746.GB27245@elte.hu> |
| Cc: |
| Rusty Russell <rusty-AT-rustcorp.com.au>,
Linus Torvalds <torvalds-AT-linux-foundation.org>,
Stephen Rothwell <sfr-AT-canb.auug.org.au>,
Thomas Gleixner <tglx-AT-linutronix.de>,
"H. Peter Anvin" <hpa-AT-zytor.com>, Mike Travis <travis-AT-sgi.com>,
linux-kernel-AT-vger.kernel.org |
| Archive-link: |
| Article, Thread
|
* Andrew Morton <akpm@linux-foundation.org> wrote:
> > +#if NR_CPUS == 1
> > +/* Uniprocesor. */
btw: s/Uniprocesor/Uniprocessor
> > +#define cpumask_first(src) ({ (void)(src); 0; })
> >
> > ...
> >
> > +#else
> > +static inline unsigned int cpumask_first(const struct cpumask *srcp)
> > +{
> > + return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits);
> > +}
> >
> > ...
> >
> > +#endif /* SMP */
>
> So I can happily compile and run
>
> cpumask_first("hello, world");
>
> with CONFIG_SMP=n?
yeah, you are right that the use of a macro sucks there, it should be
an inline function.
We should stop using CPP, which is the outdated tech of the sixties.
We should go with the new wave of the seventies and use this shiny new
"C" language that's all the rage with features like type checking and
stuff.
Ingo
(
Log in to post comments)