public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Kconfig question - multiple entries touching one integer
@ 2008-07-04 10:08 Ben Dooks
  2008-07-04 10:54 ` Ben Dooks
  2008-07-05 13:15 ` Jan Engelhardt
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Dooks @ 2008-07-04 10:08 UTC (permalink / raw)
  To: linux-kernel

I'm trying to produce a Kconfig to deal with allocating
extra resources depending on what is selected. I'd like
to have an integer which specifies the 

ie:

config ARCH_EXTRA_RESOURCES
	int
	default 0
	help
	  Extra resources depending on the board selected

...

config BOARD_A
	set ARCH_EXTRA_RESOURCES 32

config BOARD_B
	set ARCH_EXTRA_RESOURCES 64

in this example, if board A is selected, then ARCH_EXTRA_RESOURCES
would be 32, if BOARD_B is selected then it would be 64.

doing

	config ARCH_EXTRA_RESOURCES
	int
	default 0
	default 32 if BOARD_A
	default 64 if BOARD_B

doesn't work, and involves changing this part of the Kconfig
every time a new board is added.

Is there any current way of doing this, would there be any
objections to having some form of 'set' clause in a config
statememt?

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Kconfig question - multiple entries touching one integer
  2008-07-04 10:08 Kconfig question - multiple entries touching one integer Ben Dooks
@ 2008-07-04 10:54 ` Ben Dooks
  2008-07-05 13:15 ` Jan Engelhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Dooks @ 2008-07-04 10:54 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-kernel

On Fri, Jul 04, 2008 at 11:08:29AM +0100, Ben Dooks wrote:
> I'm trying to produce a Kconfig to deal with allocating
> extra resources depending on what is selected. I'd like
> to have an integer which specifies the 
> 
> ie:
> 
> config ARCH_EXTRA_RESOURCES
> 	int
> 	default 0
> 	help
> 	  Extra resources depending on the board selected
> 
> ...
> 
> config BOARD_A
> 	set ARCH_EXTRA_RESOURCES 32
> 
> config BOARD_B
> 	set ARCH_EXTRA_RESOURCES 64
> 
> in this example, if board A is selected, then ARCH_EXTRA_RESOURCES
> would be 32, if BOARD_B is selected then it would be 64.
> 
> doing
> 
> 	config ARCH_EXTRA_RESOURCES
> 	int
> 	default 0
> 	default 32 if BOARD_A
> 	default 64 if BOARD_B
> 
> doesn't work, and involves changing this part of the Kconfig
> every time a new board is added.
> 
> Is there any current way of doing this, would there be any
> objections to having some form of 'set' clause in a config
> statememt?

Currently, the rather crufty approach is to do:

config ARCH_EXTRA_RESOURCES_32
	bool

config ARCH_EXTRA_RESOURCES_64
	bool

config BOARD_A
	select ARCH_EXTRA_RESOURCES_32

config BOARD_B
	select ARCH_EXTRA_RESOURCES_64

and have the following in the header file:

#ifdef ARCH_EXTRA_RESOURCES_64
#define ARCH_EXTRA_RESOURCES 64
#elif defined(ARCH_EXTRA_RESOURCES_32)
#define ARCH_EXTRA_RESOURCES 32
#else
#define ARCH_EXTRA_RESOURCES 0
#endif

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Kconfig question - multiple entries touching one integer
  2008-07-04 10:08 Kconfig question - multiple entries touching one integer Ben Dooks
  2008-07-04 10:54 ` Ben Dooks
@ 2008-07-05 13:15 ` Jan Engelhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2008-07-05 13:15 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-kernel


On Friday 2008-07-04 12:08, Ben Dooks wrote:
>
>doing
>
>	config ARCH_EXTRA_RESOURCES
>	int
>	default 0
>	default 32 if BOARD_A
>	default 64 if BOARD_B
>
>doesn't work

The construct does work, config PAGE_OFFSET in arch/x86/Kconfig
uses it, though the order is different (the base default is last).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-05 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-04 10:08 Kconfig question - multiple entries touching one integer Ben Dooks
2008-07-04 10:54 ` Ben Dooks
2008-07-05 13:15 ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox