Bug 68191

Summary: Enabling CONFIG_DVB_DDBRIDGE=y (DigitalDevices dvb card) breaks build
Product: v4l-dvb Reporter: Christian Schneider (christian)
Component: dvb-coreAssignee: dvb-core (v4l-dvb_dvb-core)
Status: NEW ---    
Severity: blocking CC: alan, christian, szg00000
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.12.4 Subsystem:
Regression: No Bisected commit-id:
Attachments: making definitions of m_StandardTable static

Description Christian Schneider 2014-01-05 20:21:31 UTC
I tried to enable the driver for a DigitalDevices dvb card.
I also have enabled CONFIG_MEDIA_SUBDRV_AUTOSELECT=y and therefore (I guess) CONFIG_DVB_TDA18271C2DD and CONFIG_DVB_TDA18212DD=y got selected, too (there seems to be the real problem)

when compiling with these options enabled i get this error:

LD      drivers/media/dvb-frontends/built-in.o
drivers/media/dvb-frontends/tda18212dd.o:(.data+0x120): multiple definition of `m_StandardTable'
drivers/media/dvb-frontends/tda18271c2dd.o:(.data+0x1920): first defined here
ld: Warning: size of symbol `m_StandardTable' changed from 228 in drivers/media/dvb-frontends/tda18271c2dd.o to 160 in drivers/media/dvb-frontends/tda18212dd.o
scripts/Makefile.build:387: recipe for target 'drivers/media/dvb-frontends/built-in.o' failed

I'll have such a card in the next couple of days, and therefore I'm interested in getting this work, and also will gladly help with debugging.
Comment 1 Christian Schneider 2014-01-18 20:59:36 UTC
update:
building ddbridge (and needed frontends also) as module works fine.
Shouldn't it be prevented that ddbridge is compiled in?
Comment 2 Alan 2014-01-18 21:56:29 UTC
When you build it as a module the symbols are not public so the clash is not seen. Probably in both cases m_StandardTable should be marked "static" in the source.
Comment 3 Christian Schneider 2014-01-19 12:15:53 UTC
Created attachment 122571 [details]
making definitions of m_StandardTable static

Thanks, that works out. If added a patch-file with the changes. Hope it's the right format?

A little of topic:
I don't really understand, why "static" fixes the issue. from http://en.cppreference.com/w/c/language/storage_class_specifiers:
static storage duration. The variable is allocated when the program begins and deallocated when the program ends. Only one instance of the variable can exist. Variables declared with static or extern have this storage duration. 

I'm not sure, what "program" means in kernel terms. I would think the whole kernel. but that still means, that there are to symbols with the same name.
could you please explain that a little?
Comment 4 Alan 2014-01-19 16:23:10 UTC
static changes the variable scope to be per file not global - so the two copies are not confused but privave to the drivers
Comment 5 Christian Schneider 2014-01-19 16:31:17 UTC
OK, thx. didn't know, that static also affects a variables scope.