so I have this macro, with some helpers, the helper gets a checkpatch error.
DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug, "i915/gvt bitmap desc", /* map each bit to a category */ _DD_cat_(0, "gvt:cmd:"), _DD_cat_(1, "gvt:core:"), _DD_cat_(2, "gvt:dpy:"), _DD_cat_(3, "gvt:el:"), _DD_cat_(4, "gvt:irq:"), _DD_cat_(5, "gvt:mm:"), _DD_cat_(6, "gvt:mmio:"), +#if defined(CONFIG_DYNAMIC_DEBUG) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) +/** + * DEFINE_DYNAMIC_DEBUG_CATEGORIES() - bitmap control of categorized prdbgs + * @fsname: parameter basename under /sys + * @_var: C-identifier holding bitmap + * @desc: string summarizing the controls provided + * @...: list of struct dyndbg_bitdesc initializations + * + * Intended for modules with substantial use of "categorized" prdbgs + * (those with some systematic prefix in the format string), this lets + * modules using pr_debug to control them in groups according to their + * format prefixes, and map them to bits 0-N of a sysfs control point. + * Each @... gives the index and prefix map. + */ +#define DEFINE_DYNAMIC_DEBUG_CATEGORIES(fsname, _var, desc, ...) \ + MODULE_PARM_DESC(fsname, desc); \ + static struct dyndbg_bitmap_param ddcats_##_var = \ + { .bits = &(_var), .map = { __VA_ARGS__, { .match = NULL }}}; \ + module_param_cb(fsname, ¶m_ops_dyndbg, &ddcats_##_var, 0644) + +/* helper macros provide combos of '^' anchor and ' ' postfix */ +#define _DD_cat_(N, str) [N] = { .match = str " " } +#define _DD_cats_(N, str) [N] = { .match = str } +#define _DD_pfx_(N, str) [N] = { .match = "^" str " " } +#define _DD_pfxs_(N, str) [N] = { .match = "^" str } + ERROR: space prohibited before open square bracket '[' #250: FILE: include/linux/dynamic_debug.h:273: +#define _DD_cat_(N, str) [N] = { .match = str " " } Ive tried various (encapsulations) to no avail. what am I missing ? _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies