linux/drivers/media/tuners
Mauro Carvalho Chehab bb69ee27b9 [media] Fix build when drivers are builtin and frontend modules
There are a large number of reports that the media build is
not compiling when some drivers are compiled as builtin, while
the needed frontends are compiled as module.

On the last one of such reports:
	From: kbuild test robot <fengguang.wu@intel.com>
	Subject: saa7134-dvb.c:undefined reference to `zl10039_attach'

The .config file has:

	CONFIG_VIDEO_SAA7134=y
	CONFIG_VIDEO_SAA7134_DVB=y
	# CONFIG_MEDIA_ATTACH is not set
	CONFIG_DVB_ZL10039=m

And it produces all those errors:

   drivers/built-in.o: In function `set_type':
   tuner-core.c:(.text+0x2f263e): undefined reference to `tea5767_attach'
   tuner-core.c:(.text+0x2f273e): undefined reference to `tda9887_attach'
   drivers/built-in.o: In function `tuner_probe':
   tuner-core.c:(.text+0x2f2d20): undefined reference to `tea5767_autodetection'
   drivers/built-in.o: In function `av7110_attach':
   av7110.c:(.text+0x330bda): undefined reference to `ves1x93_attach'
   av7110.c:(.text+0x330bf7): undefined reference to `stv0299_attach'
   av7110.c:(.text+0x330c63): undefined reference to `tda8083_attach'
   av7110.c:(.text+0x330d09): undefined reference to `ves1x93_attach'
   av7110.c:(.text+0x330d33): undefined reference to `tda8083_attach'
   av7110.c:(.text+0x330d5d): undefined reference to `stv0297_attach'
   av7110.c:(.text+0x330dbe): undefined reference to `stv0299_attach'
   drivers/built-in.o: In function `tuner_attach_dtt7520x':
   ngene-cards.c:(.text+0x3381cb): undefined reference to `dvb_pll_attach'
   drivers/built-in.o: In function `demod_attach_lg330x':
   ngene-cards.c:(.text+0x33828a): undefined reference to `lgdt330x_attach'
   drivers/built-in.o: In function `demod_attach_stv0900':
   ngene-cards.c:(.text+0x3383d5): undefined reference to `stv090x_attach'
   drivers/built-in.o: In function `cineS2_probe':
   ngene-cards.c:(.text+0x338b7f): undefined reference to `drxk_attach'
   drivers/built-in.o: In function `configure_tda827x_fe':
   saa7134-dvb.c:(.text+0x346ae7): undefined reference to `tda10046_attach'
   drivers/built-in.o: In function `dvb_init':
   saa7134-dvb.c:(.text+0x347283): undefined reference to `mt352_attach'
   saa7134-dvb.c:(.text+0x3472cd): undefined reference to `mt352_attach'
   saa7134-dvb.c:(.text+0x34731c): undefined reference to `tda10046_attach'
   saa7134-dvb.c:(.text+0x34733c): undefined reference to `tda10046_attach'
   saa7134-dvb.c:(.text+0x34735c): undefined reference to `tda10046_attach'
   saa7134-dvb.c:(.text+0x347378): undefined reference to `tda10046_attach'
   saa7134-dvb.c:(.text+0x3473db): undefined reference to `tda10046_attach'
   drivers/built-in.o:saa7134-dvb.c:(.text+0x347502): more undefined references to `tda10046_attach' follow
   drivers/built-in.o: In function `dvb_init':
   saa7134-dvb.c:(.text+0x347812): undefined reference to `mt352_attach'
   saa7134-dvb.c:(.text+0x347951): undefined reference to `mt312_attach'
   saa7134-dvb.c:(.text+0x3479a9): undefined reference to `mt312_attach'
>> saa7134-dvb.c:(.text+0x3479c1): undefined reference to `zl10039_attach'

This is happening because a builtin module can't use directly a symbol
found on a module. By enabling CONFIG_MEDIA_ATTACH, the configuration
becomes valid, as dvb_attach() macro loads the module if needed, making
the symbol available to the builtin module.

While this bug started to appear after the patches that use IS_DEFINED
macro (like changeset 7b34be71db), this
bug is a way ancient than that.

The thing is that, before the IS_DEFINED() patches, the logic used to be:

       && defined(MODULE))
struct dvb_frontend *zl10039_attach(struct dvb_frontend *fe,
					u8 i2c_addr,
					struct i2c_adapter *i2c);
static inline struct dvb_frontend *zl10039_attach(struct dvb_frontend *fe,
					u8 i2c_addr,
					struct i2c_adapter *i2c)
{
	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
	return NULL;
}

The above code, with the .config file used, was evoluting to FALSE
(instead of TRUE as it should be, as CONFIG_DVB_ZL10039 is 'm'),
and were adding the static inline code at saa7134-dvb, instead
of the external call. So, while it weren't producing any compilation
error, the code weren't working either.

So, as the overhead for using CONFIG_MEDIA_ATTACH is minimal, just
enable it, if MODULES is defined.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-06-20 10:35:53 -03:00
..
e4000_priv.h [media] Elonics E4000 silicon tuner driver 2012-09-18 12:24:59 -03:00
e4000.c [media] e4000: fix crash when attach fails 2012-09-27 15:17:44 -03:00
e4000.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
fc001x-common.h
fc0011.c Revert "[media] fc0011: Return early, if the frequency is already tuned" 2013-02-11 19:38:59 -02:00
fc0011.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
fc0012-priv.h [media] fc0012: use Kernel dev_foo() logging 2013-01-06 09:08:23 -02:00
fc0012.c [media] fc0012: remove unused callback and correct one comment 2013-01-06 09:09:06 -02:00
fc0012.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
fc0013-priv.h
fc0013.c
fc0013.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
fc2580_priv.h [media] tuners: add FCI FC2580 silicon tuner driver 2012-09-23 17:12:23 -03:00
fc2580.c [media] fc2580: write some registers conditionally 2012-11-28 09:47:56 -02:00
fc2580.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
Kconfig [media] Fix build when drivers are builtin and frontend modules 2013-06-20 10:35:53 -03:00
Makefile [media] r820t: Add a tuner driver for Rafael Micro R820T silicon tuner 2013-04-16 21:18:42 -03:00
max2165_priv.h
max2165.c [media] max2165: get rid of warning: no previous prototype 2012-10-27 18:10:38 -02:00
max2165.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
mc44s803_priv.h
mc44s803.c [media] mc44s803: implement get_if_frequency() 2012-09-18 12:54:44 -03:00
mc44s803.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
mt20xx.c
mt20xx.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
mt2060_priv.h
mt2060.c
mt2060.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
mt2063.c [media] mt2063: properly handle return error codes 2012-10-06 11:21:02 -03:00
mt2063.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
mt2131_priv.h
mt2131.c
mt2131.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
mt2266.c
mt2266.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
mxl5005s.c [media] mxl5005s: implement get_if_frequency() 2012-09-18 12:51:00 -03:00
mxl5005s.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
mxl5007t.c Revert "[media] [PATH,1/2] mxl5007 move reset to attach" 2013-02-08 17:49:26 -02:00
mxl5007t.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
qt1010_priv.h
qt1010.c [media] qt1010: remove debug register dump 2012-09-15 09:21:41 -03:00
qt1010.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
r820t.c [media] r820t: Remove a warning for an unused value 2013-04-25 16:07:04 -03:00
r820t.h [media] r820t: Remove a warning for an unused value 2013-04-25 16:07:04 -03:00
tda827x.c [media] tda8290: change magic LNA config values to enum 2013-04-08 07:05:15 -03:00
tda827x.h [media] tda8290: change magic LNA config values to enum 2013-04-08 07:05:15 -03:00
tda8290.c [media] tuner-core/simple: get_rf_strength can be tuner mode specific 2013-04-14 19:44:50 -03:00
tda8290.h [media] tda8290: change magic LNA config values to enum 2013-04-08 07:05:15 -03:00
tda9887.c [media] tuner-core/tda9887: get_afc can be tuner mode specific 2013-04-14 19:43:40 -03:00
tda9887.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
tda18212.c [media] tda18212: tda18218: use 'val' if initialized 2012-12-21 18:25:13 -02:00
tda18212.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
tda18218_priv.h [media] tda18218: switch to Kernel logging 2012-09-15 09:23:16 -03:00
tda18218.c [media] tda18212: tda18218: use 'val' if initialized 2012-12-21 18:25:13 -02:00
tda18218.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
tda18271-common.c [media] tda18271-common: hold the I2C adapter during write transfers 2012-10-07 09:43:01 -03:00
tda18271-fe.c [media] tda8290: change magic LNA config values to enum 2013-04-08 07:05:15 -03:00
tda18271-maps.c [media] tuners/tda18271: Replace memcpy with struct assignment 2012-12-27 19:01:13 -02:00
tda18271-priv.h
tda18271.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
tea5761.c
tea5761.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
tea5767.c
tea5767.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
tua9001_priv.h
tua9001.c [media] tua9001: fix a warning 2012-10-28 07:38:54 -02:00
tua9001.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
tuner_it913x_priv.h [media] it913x: rename its tuner driver to tuner_it913x 2013-04-16 20:06:05 -03:00
tuner_it913x.c [media] it913x: rename its tuner driver to tuner_it913x 2013-04-16 20:06:05 -03:00
tuner_it913x.h [media] it913x: rename its tuner driver to tuner_it913x 2013-04-16 20:06:05 -03:00
tuner-i2c.h
tuner-simple.c [media] tuner-core/simple: get_rf_strength can be tuner mode specific 2013-04-14 19:44:50 -03:00
tuner-simple.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
tuner-types.c [media] tuner: add Sony BTF tuners 2013-03-24 12:11:35 -03:00
tuner-xc2028-types.h
tuner-xc2028.c [media] media: tuners: Remove redundant NULL check before kfree 2013-03-18 17:04:55 -03:00
tuner-xc2028.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
xc4000.c [media] tuners/xc4000: Replace memcpy with struct assignment 2012-12-27 18:50:04 -02:00
xc4000.h [media] use IS_ENABLED() macro 2013-02-06 09:24:09 -02:00
xc5000.c [media] xc5000: fix incorrect debug printnk 2013-03-21 16:46:05 -03:00
xc5000.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00