Re: [PATCH 09/10] HID: add compat support

Jaswinder Singh Rajput
2009-01-24T05:55:39Z

On Fri, May 16, 2008 at 3:19 PM, Jiri Slaby <jirislaby@gmail.com> wrote:
> Add compat option to hid code to allow loading of all modules on
> systems which don't allow autoloading because of old userspace.
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> ---
> Documentation/feature-removal-schedule.txt | 7 +++++++
> drivers/hid/Kconfig | 11 +++++++++++
> drivers/hid/Makefile | 4 ++++
> drivers/hid/hid-apple.c | 2 ++
> drivers/hid/hid-core.c | 12 ++++++++++++
> drivers/hid/hid-dummy.c | 13 +++++++++++++
> drivers/hid/hid-logitech.c | 2 ++
> include/linux/hid.h | 17 +++++++++++++++--
> 8 files changed, 66 insertions(+), 2 deletions(-)
> create mode 100644 drivers/hid/hid-dummy.c
>

> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index c67e5fe..447aed9 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h

> +#ifdef CONFIG_HID_COMPAT
> +#define HID_COMPAT_LOAD_DRIVER(name) \
> +void hid_compat_##name(void) { } \
> +EXPORT_SYMBOL(hid_compat_##name)
> +#else
> +#define HID_COMPAT_LOAD_DRIVER(name)
> +#endif /* HID_COMPAT */
> +#define HID_COMPAT_CALL_DRIVER(name) do { \
> + extern void hid_compat_##name(void); \
> + hid_compat_##name(); \
> +} while (0)
> +
> #endif
>

This leads to 3 headers_check warnings:

usr/include/linux/hid.h:66: leaks CONFIG_HID to userspace where it is not valid
usr/include/linux/hid.h:69: extern's make no sense in userspace
usr/include/linux/hid.h:76: extern's make no sense in userspace

So I am moving whole above block in #ifdef __KEREL__

If you have any objections, then let me know, now it will look like this:

#endif /* HID_FF */

+#ifdef __KERNEL__
#ifdef CONFIG_HID_COMPAT
#define HID_COMPAT_LOAD_DRIVER(name) \
/* prototype to avoid sparse warning */ \
@@ -804,6 +805,7 @@ EXPORT_SYMBOL(hid_compat_##name)
extern void hid_compat_##name(void); \
hid_compat_##name(); \
} while (0)
+#endif /* __KERNEL__ */

#endif

--
JSR