From: Pekka Paalanen <pq@iki.fi>
To: Kyle McMartin <kyle@mcmartin.ca>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Kconfig, Makefile and ifdef: mod as yes vs. no?
Date: Sun, 12 Jul 2009 12:07:26 +0300 [thread overview]
Message-ID: <20090712120726.59691207@daedalus.pq.iki.fi> (raw)
In-Reply-To: <20090711215343.GC31925@bombadil.infradead.org>
On Sat, 11 Jul 2009 17:53:43 -0400
Kyle McMartin <kyle@mcmartin.ca> wrote:
> On Sun, Jul 12, 2009 at 12:06:25AM +0300, Pekka Paalanen wrote:
> > +#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
> >
>
> You need to test _MODULE for the symbol too... since it's necessary to
> be able to distinguish between symbols which exist in the vmlinux, and
> symbols which require a module to be loaded.
>
> #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) &&
> defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
>
> should work.
Just || instead of &&, and yes, this is a solution for half of the problem,
thanks.
But what about the Makefile?
nouveau-y := nouveau_drv.o ...
nouveau-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += nouveau_backlight.o
obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
With this, nouveau_backlight.o is not built if
CONFIG_BACKLIGHT_CLASS_DEVICE=m. Should I write:
nouveau-$(if $(findstring m,$(CONFIG_BACKLIGHT_CLASS_DEVICE)),y,n) += \
nouveau_backlight.o
which to me looks ugly, or add a new Kconfig boolean option that is
selected 'if CONFIG_BACKLIGHT_CLASS_DEVICE' and use that in both Makefile
and code, or is there a canonical way to do this?
Other code seems to deal with a similar situation by #ifdef'ing the
whole c-file contents. That cannot be the preferred way, can it?
Thanks.
--
Pekka Paalanen
http://www.iki.fi/pq/
prev parent reply other threads:[~2009-07-12 9:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-11 21:06 Pekka Paalanen
2009-07-11 21:53 ` Kyle McMartin
2009-07-12 9:07 ` Pekka Paalanen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090712120726.59691207@daedalus.pq.iki.fi \
--to=pq@iki.fi \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®