linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jean Delvare <jdelvare@suse.de>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-gpio@vger.kernel.org,
	Cristina Ciocan <cristina.ciocan@intel.com>
Subject: Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community
Date: Fri, 27 Jan 2017 15:27:19 +0200	[thread overview]
Message-ID: <1485523639.2133.355.camel@linux.intel.com> (raw)
In-Reply-To: <20170127102109.3fb3d018@endymion>

On Fri, 2017-01-27 at 10:21 +0100, Jean Delvare wrote:
> On Thu, 26 Jan 2017 19:24:08 +0200, Andy Shevchenko wrote:
> > Debounce value is set globally per community. Otherwise user will
> > easily
> > get a kernel crash when they start using the feature:
> > 
> > BUG: unable to handle kernel paging request at ffffc900003be000
> > IP: byt_gpio_dbg_show+0xa9/0x430
> > 
> > Make it clear in byt_gpio_reg().
> > 
> > Note that this fix just prevents kernel to crash, but doesn't make
> > any
> > difference to the existing logic. It means the last caller will win
> > the
> > trade and debounce value will be configured accordingly. The actual
> > logic fix needs to be thought about and it's not as important as
> > crash
> > fix. That's why the latter goes separately and right now.
> > 
> > Fixes: 658b476c742f ("pinctrl: baytrail: Add debounce
> > configuration")
> > Cc: Cristina Ciocan <cristina.ciocan@intel.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/pinctrl/intel/pinctrl-baytrail.c | 13 ++++++++++---
> >  1 file changed, 10 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c
> > b/drivers/pinctrl/intel/pinctrl-baytrail.c
> > index 958db4f5ee9b..a1f85a79f186 100644
> > --- a/drivers/pinctrl/intel/pinctrl-baytrail.c
> > +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
> > @@ -731,16 +731,23 @@ static void __iomem *byt_gpio_reg(struct
> > byt_gpio *vg, unsigned int offset,
> >  				  int reg)
> >  {
> >  	struct byt_community *comm = byt_get_community(vg, offset);
> > -	u32 reg_offset = 0;
> > +	u32 reg_offset;
> >  
> >  	if (!comm)
> >  		return NULL;
> >  
> >  	offset -= comm->pin_base;
> > -	if (reg == BYT_INT_STAT_REG)
> > +	switch (reg) {
> > +	case BYT_INT_STAT_REG:
> >  		reg_offset = (offset / 32) * 4;
> > -	else
> > +		break;
> > +	case BYT_DEBOUNCE_REG:
> > +		reg_offset = 0;
> > +		break;
> > +	default:
> >  		reg_offset = comm->pad_map[offset] * 16;
> > +		break;
> 
> That break isn't needed ;-)

Would be better to have in my opinion. I already did myself some
mistakes regarding to missed break.

> > +	}
> >  
> >  	return comm->reg_base + reg_offset + reg;
> >  }
> 
> The code looks sane to me, although I can't verify its correctness
> without a datasheet.

Datasheet is public.

Intel® Atom™ Processor Z3600 and Z3700 Series Datasheet (Volume 2 of 2)
Number: 329518-002

> 
> Reviewed-by: Jean Delvare <jdelvare@suse.de>

Thanks!

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2017-01-27 13:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 17:24 [PATCH v1 0/3] pinctrl: baytrail: Fix debounce feature Andy Shevchenko
2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko
2017-01-27  9:14   ` Jean Delvare
2017-01-27 13:28     ` Andy Shevchenko
2017-01-27  9:34   ` Mika Westerberg
2017-01-30 14:47   ` Linus Walleij
2017-01-26 17:24 ` [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community Andy Shevchenko
2017-01-27  9:21   ` Jean Delvare
2017-01-27 13:27     ` Andy Shevchenko [this message]
2017-01-27 14:06       ` Jean Delvare
2017-01-27  9:35   ` Mika Westerberg
2017-01-30 14:49   ` Linus Walleij
2017-01-26 17:24 ` [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output Andy Shevchenko
2017-01-27  9:40   ` Mika Westerberg
2017-01-27 10:07   ` Jean Delvare
2017-01-30 14:51   ` Linus Walleij
2017-01-30 15:13     ` Andy Shevchenko

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=1485523639.2133.355.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=cristina.ciocan@intel.com \
    --cc=jdelvare@suse.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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).