LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Grigoryev Denis <grigoryev@fastwel.ru>,
	"H. Nikolaus Schaller" <hns@goldelico.com>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	Steve Longerbeam <slongerbeam@gmail.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gpio: pca953x: Clear irq trigger type on irq shutdown
Date: Wed, 16 May 2018 16:14:00 +0300	[thread overview]
Message-ID: <354db10f9a239e04087ba7cf7d731d3fbe2ec066.camel@linux.intel.com> (raw)
In-Reply-To: <CACRpkdbn_8WUQ8oqn2+M6KpEEogLTMMqbJrp-d2=HEkjJ-XtDQ@mail.gmail.com>

On Wed, 2018-05-16 at 14:51 +0200, Linus Walleij wrote:
> On Fri, May 4, 2018 at 6:53 PM, Grigoryev Denis <grigoryev@fastwel.ru>
> wrote:
> 

If it's full context below, the patch looks good enough to me (assuming
it works and doesn't break things on other chips like PCAL variants).

Though, I didn't read the code carefully (not enough time this week).
Thus, FWIW, 

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

with above caveats in mind.

> > The driver stores the result of irq_set_type() in the internal
> > variables
> > irq_trig_raise and irq_trig_fall, which later are used to determine
> > the GPIOs that must be re-configured as input. These variables
> > retain their
> > value between gpiolib's  export / unexport, resulting in an
> > incorrect
> > state in some cases. The corresponding bits in the variables
> > irq_trig_raise and irq_trig_fall should be cleared in
> > irq_shutdown().
> > 
> > Signed-off-by: Denis Grigoryev <grigoryev@fastwel.ru>
> > ---
> >  drivers/gpio/gpio-pca953x.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-
> > pca953x.c
> > index d2ead4b..b41be8c 100644
> > --- a/drivers/gpio/gpio-pca953x.c
> > +++ b/drivers/gpio/gpio-pca953x.c
> > @@ -522,6 +522,15 @@ static int pca953x_irq_set_type(struct irq_data
> > *d, unsigned int type)
> >         return 0;
> >  }
> > 
> > +static void pca953x_irq_shutdown(struct irq_data *d)
> > +{
> > +       struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
> > +       u8 mask = 1 << (d->hwirq % BANK_SZ);
> > +
> > +       chip->irq_trig_raise[d->hwirq / BANK_SZ] &= ~mask;
> > +       chip->irq_trig_fall[d->hwirq / BANK_SZ] &= ~mask;
> > +}
> > +
> >  static struct irq_chip pca953x_irq_chip = {
> >         .name                   = "pca953x",
> >         .irq_mask               = pca953x_irq_mask,
> > @@ -529,6 +538,7 @@ static struct irq_chip pca953x_irq_chip = {
> >         .irq_bus_lock           = pca953x_irq_bus_lock,
> >         .irq_bus_sync_unlock    = pca953x_irq_bus_sync_unlock,
> >         .irq_set_type           = pca953x_irq_set_type,
> > +       .irq_shutdown           = pca953x_irq_shutdown,
> >  };
> 
> This driver has a big set of users, so putting some maintainers
> in the loop so we can get some patch review.
> 
> Yours,
> Linus Walleij

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

  reply	other threads:[~2018-05-16 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 16:53 Grigoryev Denis
2018-05-16 12:51 ` Linus Walleij
2018-05-16 13:14   ` Andy Shevchenko [this message]
2018-05-23  9:48 ` Linus Walleij

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=354db10f9a239e04087ba7cf7d731d3fbe2ec066.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=grigoryev@fastwel.ru \
    --cc=hns@goldelico.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=slongerbeam@gmail.com \
    --subject='Re: [PATCH] gpio: pca953x: Clear irq trigger type on irq shutdown' \
    /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

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).