From: Pekka Paalanen <pq@iki.fi>
To: linux-kernel@vger.kernel.org
Subject: Kconfig, Makefile and ifdef: mod as yes vs. no?
Date: Sun, 12 Jul 2009 00:06:25 +0300 [thread overview]
Message-ID: <20090712000625.7e1bffc2@daedalus.pq.iki.fi> (raw)
Hi,
I'm having hard time making a patch that would compile nouveau_backlight.o
only if CONFIG_BACKLIGHT_CLASS_DEVICE is y or m, and define just stubs
when it is n.
I'm trying this in the nouveau/linux-2.6 kernel tree, which is basically
2.6.31-rc2.
I attempted the following:
--- a/drivers/gpu/drm/nouveau/Makefile
+++ b/drivers/gpu/drm/nouveau/Makefile
@@ -8,7 +8,7 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
nouveau_sgdma.o nouveau_dma.o \
nouveau_bo.o nouveau_fence.o nouveau_gem.o nouveau_ttm.o \
nouveau_hw.o nouveau_calc.o nouveau_bios.o nouveau_i2c.o \
- nouveau_display.o nouveau_fbcon.o nouveau_backlight.o \
+ nouveau_display.o nouveau_fbcon.o \
nv04_timer.o \
nv04_mc.o nv40_mc.o nv50_mc.o \
nv04_fb.o nv10_fb.o nv40_fb.o \
@@ -19,8 +19,9 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
nv50_crtc.o nv50_dac.o nv50_sor.o nv50_connector.o \
nv50_cursor.o nv50_display.o nv50_fbcon.o \
nv04_display.o nv04_output.o nv04_crtc.o nv04_cursor.o \
- nv04_fbcon.o
+ nv04_fbcon.o
nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o
+nouveau-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += nouveau_backlight.o
obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -708,8 +708,21 @@ extern int nouveau_dma_init(struct nouveau_channel *);
extern int nouveau_dma_wait(struct nouveau_channel *, int size);
/* nouveau_backlight.c */
+#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
extern int nouveau_backlight_init(struct drm_device *);
extern void nouveau_backlight_exit(struct drm_device *);
+#else
+static inline int nouveau_backlight_init(struct drm_device *dev)
+{
+ (void)dev;
+ return 0;
+}
+
+static inline void nouveau_backlight_exit(struct drm_device *dev)
+{
+ (void)dev;
+}
+#endif
When CONFIG_BACKLIGHT_CLASS_DEVICE=m this behaves as if it was n, i.e.
I get the stubs and no nouveau_backlight.o.
For CONFIG_BACKLIGHT_CLASS_DEVICE=y and n I get what I want.
What is the proper way to get m behave like y in this situation?
Oh, and should I use the following instead of (void)dev;?
static inline void nouveau_backlight_exit(struct drm_device *dev __used) { }
Please, Cc me.
Thanks.
--
Pekka Paalanen
http://www.iki.fi/pq/
next reply other threads:[~2009-07-11 21:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-11 21:06 Pekka Paalanen [this message]
2009-07-11 21:53 ` Kyle McMartin
2009-07-12 9:07 ` Pekka Paalanen
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=20090712000625.7e1bffc2@daedalus.pq.iki.fi \
--to=pq@iki.fi \
--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®