diff mbox

sparc32 compile error: redefinition of =?UTF-8?Q?=E2=80=98smp?= =?UTF-8?Q?=5Fcall=5Ffunction=5Fsingle=E2=80=99?=

Message ID 20090113235940.12d856d0.akpm@linux-foundation.org
State Accepted
Delegated to: David Miller
Headers show

Commit Message

Andrew Morton Jan. 14, 2009, 7:59 a.m. UTC
On Tue, 13 Jan 2009 22:38:01 -0500 Robert Reif <reif@earthlink.net> wrote:

> This worked:
> 
> diff --git a/kernel/Makefile b/kernel/Makefile
> index 2aebc4c..368227d 100644
> --- a/kernel/Makefile
> +++ b/kernel/Makefile
> @@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
>  ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
>  obj-y += smp.o
>  else
> +ifneq ($(CONFIG_SMP),y)
>  obj-y += up.o
>  endif
> +endif
>  obj-$(CONFIG_SMP) += spinlock.o
>  obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
>  obj-$(CONFIG_PROVE_LOCKING) += spinlock.o

This all can be simplified, can't it?

obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif

(someone please check my homework - I don't have a good track
record here ;))

Comments

Sam Ravnborg Jan. 14, 2009, 3:32 p.m. UTC | #1
On Tue, Jan 13, 2009 at 11:59:40PM -0800, Andrew Morton wrote:
> On Tue, 13 Jan 2009 22:38:01 -0500 Robert Reif <reif@earthlink.net> wrote:
> 
> > This worked:
> > 
> > diff --git a/kernel/Makefile b/kernel/Makefile
> > index 2aebc4c..368227d 100644
> > --- a/kernel/Makefile
> > +++ b/kernel/Makefile
> > @@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
> >  ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
> >  obj-y += smp.o
> >  else
> > +ifneq ($(CONFIG_SMP),y)
> >  obj-y += up.o
> >  endif
> > +endif
> >  obj-$(CONFIG_SMP) += spinlock.o
> >  obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
> >  obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
> 
> This all can be simplified, can't it?
> 
> obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
> ifneq ($(CONFIG_SMP),y)
> obj-y += up.o
> endif
> 
> (someone please check my homework - I don't have a good track
> record here ;))

Looks correct. We pull in smp.o only for SPARC64 AND SMP

But I find the next lines distastefull in a Makefile:
> ifneq ($(CONFIG_SMP),y)
> obj-y += up.o
> endif

I would prefer a small Kconfig helper symbol:

config SPARC_UP
	def_bool y
	depends on !SMP

And then we would do the Makefile bits like this:
obj-$(CONFIG_SPARC_UP) += up.o

So maybe a bit more involved patch - but more readable IMO.
Robert - can I ask you to fix it up if you and others agree.

Thanks,
	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Morton Jan. 14, 2009, 6:25 p.m. UTC | #2
On Wed, 14 Jan 2009 16:32:55 +0100 Sam Ravnborg <sam@ravnborg.org> wrote:

> On Tue, Jan 13, 2009 at 11:59:40PM -0800, Andrew Morton wrote:
> > On Tue, 13 Jan 2009 22:38:01 -0500 Robert Reif <reif@earthlink.net> wrote:
> > 
> > > This worked:
> > > 
> > > diff --git a/kernel/Makefile b/kernel/Makefile
> > > index 2aebc4c..368227d 100644
> > > --- a/kernel/Makefile
> > > +++ b/kernel/Makefile
> > > @@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
> > >  ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
> > >  obj-y += smp.o
> > >  else
> > > +ifneq ($(CONFIG_SMP),y)
> > >  obj-y += up.o
> > >  endif
> > > +endif
> > >  obj-$(CONFIG_SMP) += spinlock.o
> > >  obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
> > >  obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
> > 
> > This all can be simplified, can't it?
> > 
> > obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
> > ifneq ($(CONFIG_SMP),y)
> > obj-y += up.o
> > endif
> > 
> > (someone please check my homework - I don't have a good track
> > record here ;))
> 
> Looks correct. We pull in smp.o only for SPARC64 AND SMP

SPARC64=n and SMP, actually (assuming sparc64 is the only
USE_GENERIC_SMP_HELPERS=n arch)

> But I find the next lines distastefull in a Makefile:
> > ifneq ($(CONFIG_SMP),y)
> > obj-y += up.o
> > endif

me too.

> I would prefer a small Kconfig helper symbol:
> 
> config SPARC_UP
> 	def_bool y
> 	depends on !SMP
> 
> And then we would do the Makefile bits like this:
> obj-$(CONFIG_SPARC_UP) += up.o

eek.  Mentioning sparc explicitly in kernel/Makefile is badder.

we could remove zillions of these conditionals if something somewhere
were to generate negated symbols for us.  Say, when kbuild sees
CONFIG_SMP=y, it will generate another symbol: NOT_CONFIG_SMP=y.  So
then we can do

obj-$NOT_CONFIG_SMP += up.o

Or is that too cheesy?


--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg Jan. 14, 2009, 8:08 p.m. UTC | #3
On Wed, Jan 14, 2009 at 10:25:44AM -0800, Andrew Morton wrote:
> On Wed, 14 Jan 2009 16:32:55 +0100 Sam Ravnborg <sam@ravnborg.org> wrote:
> 
> > On Tue, Jan 13, 2009 at 11:59:40PM -0800, Andrew Morton wrote:
> > > On Tue, 13 Jan 2009 22:38:01 -0500 Robert Reif <reif@earthlink.net> wrote:
> > > 
> > > > This worked:
> > > > 
> > > > diff --git a/kernel/Makefile b/kernel/Makefile
> > > > index 2aebc4c..368227d 100644
> > > > --- a/kernel/Makefile
> > > > +++ b/kernel/Makefile
> > > > @@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
> > > >  ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
> > > >  obj-y += smp.o
> > > >  else
> > > > +ifneq ($(CONFIG_SMP),y)
> > > >  obj-y += up.o
> > > >  endif
> > > > +endif
> > > >  obj-$(CONFIG_SMP) += spinlock.o
> > > >  obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
> > > >  obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
> > > 
> > > This all can be simplified, can't it?
> > > 
> > > obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
> > > ifneq ($(CONFIG_SMP),y)
> > > obj-y += up.o
> > > endif
> > > 
> > > (someone please check my homework - I don't have a good track
> > > record here ;))
> > 
> > Looks correct. We pull in smp.o only for SPARC64 AND SMP
> 
> SPARC64=n and SMP, actually (assuming sparc64 is the only
> USE_GENERIC_SMP_HELPERS=n arch)
> 
> > But I find the next lines distastefull in a Makefile:
> > > ifneq ($(CONFIG_SMP),y)
> > > obj-y += up.o
> > > endif
> 
> me too.
> 
> > I would prefer a small Kconfig helper symbol:
> > 
> > config SPARC_UP
> > 	def_bool y
> > 	depends on !SMP
> > 
> > And then we would do the Makefile bits like this:
> > obj-$(CONFIG_SPARC_UP) += up.o
> 
> eek.  Mentioning sparc explicitly in kernel/Makefile is badder.

Ups - I my horry I did not notice this was _taht_ kernel/Makefile.

> 
> we could remove zillions of these conditionals if something somewhere
> were to generate negated symbols for us.  Say, when kbuild sees
> CONFIG_SMP=y, it will generate another symbol: NOT_CONFIG_SMP=y.  So
> then we can do
> 
> obj-$NOT_CONFIG_SMP += up.o
> 
> Or is that too cheesy?

If we can remove a zillion lines - then no.
But maybe the actual figure is a bit less :-)

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/kernel/Makefile~kernel-upc-omit-it-if-smp=y-use_generic_smp_helpers=n
+++ a/kernel/Makefile
@@ -40,9 +40,8 @@  obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
 obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
 obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
-ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
-obj-y += smp.o
-else
+obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
 obj-$(CONFIG_SMP) += spinlock.o