linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Peter Rosin <peda@axentia.se>,
	linux-i2c@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [PATCH v2 1/4] i2c: mux: pca954x: Refactor pca954x_irq_handler()
Date: Wed, 15 Apr 2020 17:48:47 +0300	[thread overview]
Message-ID: <20200415144847.GL185537@smile.fi.intel.com> (raw)
In-Reply-To: <20200325214316.GJ1922688@smile.fi.intel.com>

On Wed, Mar 25, 2020 at 11:43:16PM +0200, Andy Shevchenko wrote:
> On Mon, Mar 16, 2020 at 06:07:21PM +0200, Andy Shevchenko wrote:
> > Refactor pca954x_irq_handler() to:
> >   - use for_each_set_bit() macro
> >   - use IRQ_RETVAL() macro
> > 
> > Above change makes code easy to read and understand.
> 
> Peter, does this series good in your opinion?

Peter, Wolfram, this missed previous cycle, any work needs to be done?

> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > v2: masked pending to prevent handling of spurious IRQs (Peter)
> >  drivers/i2c/muxes/i2c-mux-pca954x.c | 17 +++++++----------
> >  1 file changed, 7 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
> > index a0d926ae3f86..b764c7c746e9 100644
> > --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> > +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> > @@ -327,21 +327,18 @@ static DEVICE_ATTR_RW(idle_state);
> >  static irqreturn_t pca954x_irq_handler(int irq, void *dev_id)
> >  {
> >  	struct pca954x *data = dev_id;
> > -	unsigned int child_irq;
> > -	int ret, i, handled = 0;
> > +	unsigned long pending;
> > +	int ret, i;
> >  
> >  	ret = i2c_smbus_read_byte(data->client);
> >  	if (ret < 0)
> >  		return IRQ_NONE;
> >  
> > -	for (i = 0; i < data->chip->nchans; i++) {
> > -		if (ret & BIT(PCA954X_IRQ_OFFSET + i)) {
> > -			child_irq = irq_linear_revmap(data->irq, i);
> > -			handle_nested_irq(child_irq);
> > -			handled++;
> > -		}
> > -	}
> > -	return handled ? IRQ_HANDLED : IRQ_NONE;
> > +	pending = (ret >> PCA954X_IRQ_OFFSET) & (BIT(data->chip->nchans) - 1);
> > +	for_each_set_bit(i, &pending, data->chip->nchans)
> > +		handle_nested_irq(irq_linear_revmap(data->irq, i));
> > +
> > +	return IRQ_RETVAL(pending);
> >  }
> >  
> >  static int pca954x_irq_set_type(struct irq_data *idata, unsigned int type)
> > -- 
> > 2.25.1
> > 
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2020-04-15 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 16:07 [PATCH v2 1/4] i2c: mux: pca954x: Refactor pca954x_irq_handler() Andy Shevchenko
2020-03-16 16:07 ` [PATCH v2 2/4] i2c: mux: pca954x: Make use of device properties Andy Shevchenko
2020-03-16 16:07 ` [PATCH v2 3/4] i2c: mux: pca954x: Move device_remove_file() out of pca954x_cleanup() Andy Shevchenko
2020-03-16 16:07 ` [PATCH v2 4/4] i2c: mux: pca954x: Convert license to SPDX identifier Andy Shevchenko
2020-03-25 21:43 ` [PATCH v2 1/4] i2c: mux: pca954x: Refactor pca954x_irq_handler() Andy Shevchenko
2020-04-15 14:48   ` Andy Shevchenko [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=20200415144847.GL185537@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=wsa@the-dreams.de \
    /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).