Re: HID: make compat functions static

From: Jiri Slaby
Date: Thu Sep 04 2008 - 18:20:46 EST


Hi,

does the hid-dummy module runtime-link after the change?

ANSI C standard says:
* In the set of translation units and libraries that constitutes an entire
program, each declaration of a particular identiïer with external linkage
denotes the same object or function. Within one translation unit, each
declaration of an identiïer with _internal linkage_ denotes the same object or
function. Each declaration of an identiïer with no linkage denotes a unique entity.
* If the declaration of a ïle scope identiïer for an object or a function
contains the storage-class speciïer _static_, the identiïer has _internal linkage_.
* For an identiïer declared with the storage-class speciïer _extern_ in a scope
in which a _prior declaration_ of that identiïer is visible, if the prior
declaration speciïes _internal_ or external linkage, the linkage of the
identiïer at the later declaration _is the same as the linkage speciïed at the
prior declaration_. If no prior declaration is visible, or if the prior
declaration speciïes no linkage, then the identiïer has external linkage.

(Note that EXPORT_SYMBOL adds extern.)

I can't find any extension of gnu C to this which would permit that so I think
and correct me if I'm wrong, the commit is incorrect? Even according to nm, the
symbol is local, e.g.:
0000000000000120 t hid_compat_monterey

From: Harvey Harrison <harvey.harrison@xxxxxxxxx>
Date: Tue, 2 Sep 2008 16:05:43 +0000 (+0200)
Subject: HID: make compat functions static
X-Git-Url:
http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjikos%2Fhid.git;a=commitdiff_plain;h=f72f87666264c9d4880166bcc69cb5c4cf210449

HID: make compat functions static

Done to avoid sparse warnings about undeclared functions.

Signed-off-by: Harvey Harrison <harvey.harrison@xxxxxxxxx>
Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
---

diff --git a/include/linux/hid.h b/include/linux/hid.h
index 15ee33e..164ce7f 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -794,7 +794,7 @@ dbg_hid(const char *fmt, ...)

#ifdef CONFIG_HID_COMPAT
#define HID_COMPAT_LOAD_DRIVER(name) \
-void hid_compat_##name(void) { } \
+static void hid_compat_##name(void) { } \
EXPORT_SYMBOL(hid_compat_##name)
#else
#define HID_COMPAT_LOAD_DRIVER(name)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/