Jan Kiszka wrote:
Wolfgang Grandegger wrote:
...
Index: ksrc/drivers/can/rtcan_internal.h
===================================================================
--- ksrc/drivers/can/rtcan_internal.h   (revision 1695)
+++ ksrc/drivers/can/rtcan_internal.h   (working copy)
@@ -111,6 +111,10 @@
#ifndef compat_module_int_param_array
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+# define compat_module_int_param(name) \
+    MODULE_PARM(name, "i")
+# define compat_module_charp_param(name) \
+    MODULE_PARM(name, "s")
 # define compat_module_byte_param_array(name, count) \
     MODULE_PARM(name, "1-" __MODULE_STRING(count) "b")
 # define compat_module_short_param_array(name, count) \
@@ -118,6 +122,10 @@
 # define compat_module_int_param_array(name, count) \
     MODULE_PARM(name, "1-" __MODULE_STRING(count) "i")
 #else
+# define compat_module_int_param(name) \
+    module_param(name, int, 0444)
+# define compat_module_charp_param(name) \
+    module_param(name, charp, 0444)
 # define compat_module_byte_param_array(name, count) \
     module_param_array(name, byte, NULL, 0444)
 # define compat_module_short_param_array(name, count) \

No need, module_param comes even with 2.4. We only need wrapping for
parameter arrays (due to different semantics of the macro arguments).

But with limitations, unfortunately:

  /* type is byte, short, ushort, int, uint, long, ulong, bool. (2.6
     has more, but they are not supported).  perm is permissions when
     it appears in sysfs: 0 means doens't appear, 0444 means read-only
     by everyone, 0644 means changable dynamically by root, etc.  name
     must be in scope (unlike MODULE_PARM).
  */
  #define module_param(name, type, perm) \
        static inline void *__check_existence_##name(void) { return
             &name; } \
        MODULE_PARM(name, _MODULE_PARM_STRING_ ## type)

  #define _MODULE_PARM_STRING_byte "b"
  #define _MODULE_PARM_STRING_short "h"
  #define _MODULE_PARM_STRING_ushort "h"
  #define _MODULE_PARM_STRING_int "i"
  #define _MODULE_PARM_STRING_uint "i"
  #define _MODULE_PARM_STRING_long "l"
  #define _MODULE_PARM_STRING_ulong "l"
  #define _MODULE_PARM_STRING_bool "i"

Especially "s" is missing. But it could be wrapped with:

  #define _MODULE_PARM_STRING_charp "s"

Any idea why this is not already done?

I also want to replace the compat_module_*_param_array functions with the attached code snippet.

Wolfgang.


So, this patch can be shorter... :)

Jan


#ifndef compat_module_param_array
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
# define _MODULE_PARM_STRING_charp "s"
# define compat_module_param_array(name, type, count, perm) \
    static inline void *__check_existence_##name(void) { return &name; } \
    MODULE_PARM(name, "1-" __MODULE_STRING(count) _MODULE_PARM_STRING_##type)
#else
# define compat_module_param_array(name, type, count, perm) \
    module_param_array(name, type, NULL, perm)
#endif
#endif
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to