HID: avoid sparse warning in HID_COMPAT_LOAD_DRIVER
Subsystems (2)
PATCH 1/1 HID: avoid sparse warning in HID_COMPAT_LOAD_DRIVER
Impact: include a prototype for the exported function in the macro
Fix about 20 of this warnings:
drivers/hid/hid-a4tech.c:162:1: warning: symbol 'hid_compat_a4tech' was not declared. Should it be static?
--- include/linux/hid.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/hid.h +2 -0
@@ -793,6 +793,8 @@ dbg_hid(const char *fmt, ...)#ifdef CONFIG_HID_COMPAT #define HID_COMPAT_LOAD_DRIVER (name) \ +/* prototype to avoid sparse warning */ \ +extern void hid_compat_##name(void); \ void hid_compat_##name(void) { } \ EXPORT_SYMBOL(hid_compat_##name)#else
Signature · 1 line
1.5.6.3
Jiri Kosina
AppliedQuoted 7 lines · Hannes Eder
Impact: include a prototype for the exported function in the macro
Fix about 20 of this warnings:
drivers/hid/hid-a4tech.c:162:1: warning: symbol 'hid_compat_a4tech' was not declared. Should it be static?Signed-off-by Hannes Eder <[email protected]>
Applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 16 lines · Hannes Eder
Impact: include a prototype for the exported function in the macro
Fix about 20 of this warnings:
drivers/hid/hid-a4tech.c:162:1: warning: symbol 'hid_compat_a4tech' was not declared. Should it be static?Signed-off-by Hannes Eder <[email protected]>--- include/linux/hid.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)include/linux/hid.h +0
-0
include/linux/hid.h dbg_hid(const char *fmt, ...) · line 798
Quoted 6 lines
include/linux/hid.h +2
-0@@ -793,6 +793,8 @@ dbg_hid(const char *fmt, ...)#ifdef CONFIG_HID_COMPAT #define HID_COMPAT_LOAD_DRIVER (name) \ +/* prototype to avoid sparse warning */ \ +extern void hid_compat_##name(void); \ void hid_compat_##name(void) { } \
surely this could simply be changed to 'static void hid_compat_##name(void)' if it is only being defined to be an empty function?
Quoted 10 lines
include/linux/hid.h +0
-0EXPORT_SYMBOL(hid_compat_##name)#else Signature · 7 lines
1.5.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes'
Quoted 7 lines · Ben Dooks
include/linux/hid.h dbg_hid(const char *fmt, ...) · line 798
Quoted 5 lines
#ifdef
CONFIG_HID_COMPAT
#defineHID_COMPAT_LOAD_DRIVER(name)\include/linux/hid.h +2
-0+/* prototype to avoid sparse warning */ \ +extern void hid_compat_##name(void); \ void hid_compat_##name(void) { } \surely this could simply be changed to 'static void hid_compat_##name(void)' if it is only being defined to be an empty
This will cause gcc emit warnings about unused symbols.
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 11 lines · Jiri Kosina
Quoted 7 lines · Ben Dooks
include/linux/hid.h dbg_hid(const char *fmt, ...) · line 798
Quoted 5 lines
#ifdef
CONFIG_HID_COMPAT
#defineHID_COMPAT_LOAD_DRIVER(name)\include/linux/hid.h +2
-0+/* prototype to avoid sparse warning */ \ +extern void hid_compat_##name(void); \ void hid_compat_##name(void) { } \surely this could simply be changed to 'static void hid_compat_##name(void)' if it is only being defined to be an empty
This will cause gcc emit warnings about unused symbols.
sorry, 'static inline void' then.
Quoted 8 lines
Signature · 7 lines
Jiri Kosina SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes'
Quoted 11 lines · Jiri Kosina
Quoted 7 lines · Ben Dooks
include/linux/hid.h dbg_hid(const char *fmt, ...) · line 798
Quoted 5 lines
#ifdef
CONFIG_HID_COMPAT
#defineHID_COMPAT_LOAD_DRIVER(name)\include/linux/hid.h +2
-0+/* prototype to avoid sparse warning */ \ +extern void hid_compat_##name(void); \ void hid_compat_##name(void) { } \surely this could simply be changed to 'static void hid_compat_##name(void)' if it is only being defined to be an empty
This will cause gcc emit warnings about unused symbols.
The real problem is that the symbol (in that case the function) is not exported if defined static.
e.g.:
$ cat >foobar.c <<EOF
Quoted 5 lines
static void foo(void) {}
extern void foo(void);void bar(void) {}
EOF
$ gcc -c foobar.c $ nm foobar.o 00000005 T bar 00000000 t foo
from the nm manpage:
The symbol type. ... If lowercase, the symbol is local; if uppercase, the symbol is global (external)
i.e. foo is local
see http://lkml.org/lkml/2008/9/4/495 for what ANSI C Std has to say about that and about the proposed change.
But, don't ask my why the void functions with empty function bodies are exported.
Quoted 1 line · Ben Dooks
sorry, 'static inline void' then.
in that case the symbol would not even be local as it is not used with the translation unit.
$ nm 00000005 T bar
-Hannes
Quoted 2 lines · Hannes Eder
But, don't ask my why the void functions with empty function bodies are exported.
Because of autoload to create a dependency. Note that this is a temporary solution to workaround the non-presence of hid bus in module-init-tools and will be removed in next few releases.
Quoted 5 lines · Jiri Slaby
Quoted 2 lines
But, don't ask my why the void functions with empty function bodies are exported.
Because of autoload to create a dependency. Note that this is a temporary solution to workaround the non-presence of hid bus in module-init-tools and will be removed in next few releases.
BTW while we are at it -- what is the status with module-init-tools? Has the support been merged already?
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 2 lines · Jiri Kosina
BTW while we are at it -- what is the status with module-init-tools? Has the support been merged already?
As far as I can see, not yet. Jon, what's the status of hid bus support in m-i-t, please?
Quoted 4 lines · Jiri Slaby
Quoted 2 lines
BTW while we are at it -- what is the status with module-init-tools? Has the support been merged already?
As far as I can see, not yet. Jon, what's the status of hid bus support in m-i-t, please?
Any update here please? What is the current status in m-i-t?
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs