From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Simon Horman <horms@verge.net.au>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Linus Walleij <linus.walleij@linaro.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH 3/4] pinctrl: sh-pfc: Add check for empty pinmux groups/functions
Date: Fri, 26 Apr 2019 11:42:11 +0200 [thread overview]
Message-ID: <CAMuHMdW1T-LCRN0R=3bh1gq1Ai3g1jgy8jcxQP6Xd0uVDeHHwA@mail.gmail.com> (raw)
In-Reply-To: <20190426093454.pvmc426w5wca2jj3@verge.net.au>
Hi Simon,
On Fri, Apr 26, 2019 at 11:35 AM Simon Horman <horms@verge.net.au> wrote:
> On Thu, Apr 25, 2019 at 11:55:41AM +0200, Geert Uytterhoeven wrote:
> > The pinmux groups and functions arrays may contain two parts, to ease
> > supporting SoCs that expose pin subsets of other related SoCs. Both
> > parts need to be declared with explicit sizes, which thus need to be
> > updated when adding support for more groups and functions.
> >
> > If a size is too small, the compiler will detect this at build time
> > ("excess elements in array initializer").
> > If a size is too large, this may go undetected (for pin groups), lead to
> > pin controller registration failures (for pin functions: "pinmux ops has
> > no name for functionN"), or crash the optional run-time debug code (for
> > pin groups).
> >
> > Extend the run-time debug code with checks to detect this, to help
> > catching bugs early.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Thank you!
> > --- a/drivers/pinctrl/sh-pfc/core.c
> > +++ b/drivers/pinctrl/sh-pfc/core.c
> > @@ -780,9 +780,15 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
> >
> > for (i = 0; i < info->nr_functions; i++) {
> > func = &info->functions[i];
> > + if (!func->name) {
> > + pr_err("%s: empty function %u\n", drvname, i);
> > + sh_pfc_errors++;
>
> Not strictly related to this patch but did
> you consider not having sh_pfc_errors global to this file?
Do you have an alternative?
I could hide it, and combine it with the pr_err() in a sh_pfc_report_error()
function, but it would still be global.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2019-04-26 9:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-25 9:55 [PATCH 0/4] pinctrl: sh-pfc: Run-time debug code fixes and enhancements Geert Uytterhoeven
2019-04-25 9:55 ` [PATCH 1/4] pinctrl: sh-pfc: Correct printk level of group referral warning Geert Uytterhoeven
2019-04-26 9:21 ` Simon Horman
2019-04-29 8:38 ` Geert Uytterhoeven
2019-04-29 8:49 ` Simon Horman
2019-04-25 9:55 ` [PATCH 2/4] pinctrl: sh-pfc: Mark run-time debug code __init Geert Uytterhoeven
2019-04-26 9:29 ` Simon Horman
2019-04-25 9:55 ` [PATCH 3/4] pinctrl: sh-pfc: Add check for empty pinmux groups/functions Geert Uytterhoeven
2019-04-26 9:34 ` Simon Horman
2019-04-26 9:42 ` Geert Uytterhoeven [this message]
2019-04-26 9:53 ` Simon Horman
2019-04-25 9:55 ` [PATCH 4/4] pinctrl: sh-pfc: Validate pin tables at runtime Geert Uytterhoeven
2019-04-26 9:36 ` Simon Horman
2019-05-03 7:25 ` [PATCH 0/4] pinctrl: sh-pfc: Run-time debug code fixes and enhancements Linus Walleij
2019-05-03 7:33 ` Geert Uytterhoeven
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='CAMuHMdW1T-LCRN0R=3bh1gq1Ai3g1jgy8jcxQP6Xd0uVDeHHwA@mail.gmail.com' \
--to=geert@linux-m68k.org \
--cc=geert+renesas@glider.be \
--cc=horms@verge.net.au \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).