linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
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:53:11 +0200	[thread overview]
Message-ID: <20190426095311.xu7yo7cksqiwznek@verge.net.au> (raw)
In-Reply-To: <CAMuHMdW1T-LCRN0R=3bh1gq1Ai3g1jgy8jcxQP6Xd0uVDeHHwA@mail.gmail.com>

On Fri, Apr 26, 2019 at 11:42:11AM +0200, Geert Uytterhoeven wrote:
> 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.

I didn't look carefully for an alternative.
If its not practical to pass around a local variable then
I'm happy with the current setup.

  reply	other threads:[~2019-04-26  9:53 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
2019-04-26  9:53       ` Simon Horman [this message]
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=20190426095311.xu7yo7cksqiwznek@verge.net.au \
    --to=horms@verge.net.au \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --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).