All of lore.kernel.org
 help / color / mirror / Atom feed
From: jim.cromie@gmail.com
To: kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: advice on checkpatch error
Date: Tue, 5 Oct 2021 14:55:11 -0600	[thread overview]
Message-ID: <CAJfuBxzd-ZgkSbmMLRb5685HRabpD3iQbmWxcihrGF+m=PsEpg@mail.gmail.com> (raw)
In-Reply-To: <CAJfuBxwuKsr7NkzqeOpZE5uiDzpCd6N=icBD+-+9wHCB1dmrdg@mail.gmail.com>

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

      reply	other threads:[~2021-10-05 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 19:14 advice on checkpatch error jim.cromie
2021-10-05 20:55 ` jim.cromie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJfuBxzd-ZgkSbmMLRb5685HRabpD3iQbmWxcihrGF+m=PsEpg@mail.gmail.com' \
    --to=jim.cromie@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.