Skip to contentSkip to conversation

drivers/message/i2o/iop.c: static inline functions mustn't be exported

PATCH In review Adrian Bunk 4 participants 5 messages Apr 18, 2006 – Apr 20, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/message/i2o/iop.c: static inline functions mustn't be exported

static inline functions mustn't be exported.

---

This patch was already sent on:
- 13 Apr 2006

drivers/message/i2o/iop.c renamed from drivers/message/i2o/iop.c.old +0 -1
@@ -1243,7 +1243,6 @@
 EXPORT_SYMBOL(i2o_cntxt_list_get_ptr);
 #endif
 EXPORT_SYMBOL(i2o_msg_get_wait);
-EXPORT_SYMBOL(i2o_msg_nop);
 EXPORT_SYMBOL(i2o_find_iop);
 EXPORT_SYMBOL(i2o_iop_find_device);
 EXPORT_SYMBOL(i2o_event_register);
#1 lore raw
Quoted 3 lines · Adrian Bunk

static inline functions mustn't be exported.

Actually, exports of static inlines work OK. The compiler will emit an out-of-line copy to satisfy EXPORT_SYMBOL's reference and the module namespace is separate from the compiler&linker's namespace.

Of course, things will screw up when we're using the compiler&linker namespace (ie: the driver is statically linked).

drivers/message/i2o/iop.c line 1248

Quoted 10 lines
drivers/message/i2o/iop.c renamed from drivers/message/i2o/iop.c.old +0 -1
@@ -1243,7 +1243,6 @@
 EXPORT_SYMBOL(i2o_cntxt_list_get_ptr);
 #endif
 EXPORT_SYMBOL(i2o_msg_get_wait);
-EXPORT_SYMBOL(i2o_msg_nop);
 EXPORT_SYMBOL(i2o_find_iop);
 EXPORT_SYMBOL(i2o_iop_find_device);
 EXPORT_SYMBOL(i2o_event_register);

It depends whether Markus thinks this symbol is something which the driver should be exporting. If so, we should uninline i2o_msg_nop(). But given that it's in a header, nobody should be linking to it anyway...

(why on earth does i2o put semicolons after its function definitions?)

#2 lore raw
Quoted 5 lines · Andrew Morton
Quoted 3 lines · Adrian Bunk

static inline functions mustn't be exported.

Quoted 7 lines

Actually, exports of static inlines work OK. The compiler will emit an out-of-line copy to satisfy EXPORT_SYMBOL's reference and the module namespace is separate from the compiler&linker's namespace.

Of course, things will screw up when we're using the compiler&linker namespace (ie: the driver is statically linked).
...

It even works with statically linked drivers.
It does work unless CONFIG_MODULES=n.

But this doesn't mean it's OK - exporting static code is wrong.

BTW:
It seems Patrick's recently merged patch to let the compiler help us find such bugs (a1a8feed1743ec8d2af1dafa7c5321679f0a3e4f) isn't working.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw
Quoted 5 lines · Adrian Bunk

But this doesn't mean it's OK - exporting static code is wrong.

BTW:
It seems Patrick's recently merged patch to let the compiler help us find such bugs (a1a8feed1743ec8d2af1dafa7c5321679f0a3e4f) isn't working.

Indeed, something seems to be broken. I can't get it to throw warnings anymore even for the H.323 case I initially tested it with, which is strange because I did trial and error until I had something which I'm 100% sure did throw warnings. I'll look into it, thanks.

#4 lore raw
In reply to Andrew Morton

Hello,

Quoted 7 lines · Andrew Morton
Quoted 1 line · Adrian Bunk

static inline functions mustn't be exported.

Actually, exports of static inlines work OK. The compiler will emit an out-of-line copy to satisfy EXPORT_SYMBOL's reference and the module namespace is separate from the compiler&linker's namespace. Of course, things will screw up when we're using the compiler&linker namespace (ie: the driver is statically linked).

Quoted 14 lines

drivers/message/i2o/iop.c line 1248

Quoted 10 lines
drivers/message/i2o/iop.c renamed from drivers/message/i2o/iop.c.old +0 -1
@@ -1243,7 +1243,6 @@
 EXPORT_SYMBOL(i2o_cntxt_list_get_ptr);
 #endif
 EXPORT_SYMBOL(i2o_msg_get_wait);
-EXPORT_SYMBOL(i2o_msg_nop);
 EXPORT_SYMBOL(i2o_find_iop);
 EXPORT_SYMBOL(i2o_iop_find_device);
 EXPORT_SYMBOL(i2o_event_register);

It depends whether Markus thinks this symbol is something which the driver should be exporting. If so, we should uninline i2o_msg_nop(). But given that it's in a header, nobody should be linking to it anyway... (why on earth does i2o put semicolons after its function definitions?)

OK, i could live with both versions... The EXPORT_SYMBOL was needed in earlier version, but i forgot to remove it when i inlined the function and put it into the header.

If someone thinks the inline is to expensive here, please let me know and i will submit a patch to reverse it again.

Best regards,

Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)

Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany

Phone:  +49 82 82/99 51-0
Fax:    +49 82 82/99 51-11
E-Mail: [email protected]
URL:    http://www.shadowconnect.com