All of lore.kernel.org
 help / color / mirror / Atom feed
* advice on checkpatch error
@ 2021-10-05 19:14 jim.cromie
  2021-10-05 20:55 ` jim.cromie
  0 siblings, 1 reply; 2+ messages in thread
From: jim.cromie @ 2021-10-05 19:14 UTC (permalink / raw)
  To: kernelnewbies

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, &param_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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: advice on checkpatch error
  2021-10-05 19:14 advice on checkpatch error jim.cromie
@ 2021-10-05 20:55 ` jim.cromie
  0 siblings, 0 replies; 2+ messages in thread
From: jim.cromie @ 2021-10-05 20:55 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Oct 5, 2021 at 1:14 PM <jim.cromie@gmail.com> wrote:
>
> 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, &param_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 ?

I'll just do it more like this ...

static const struct intel_step_info kbl_revids[] = {
        [1] = { .gt_step = STEP_B0, .display_step = STEP_B0 },
        [2] = { .gt_step = STEP_C0, .display_step = STEP_B0 },
        [3] = { .gt_step = STEP_D0, .display_step = STEP_B0 },
        [4] = { .gt_step = STEP_F0, .display_step = STEP_C0 },
        [5] = { .gt_step = STEP_C0, .display_step = STEP_B1 },
        [6] = { .gt_step = STEP_D1, .display_step = STEP_B1 },
        [7] = { .gt_step = STEP_G0, .display_step = STEP_C0 },
};

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-05 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 19:14 advice on checkpatch error jim.cromie
2021-10-05 20:55 ` jim.cromie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.