mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
i2c: mux: pca954x: Refactor pca954x_irq_handler()
Refactor pca954x_irq_handler() to: - use for_each_set_bit() macro - use IRQ_RETVAL() macro Above change makes code easy to read and understand. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
parent
73371d5f31
commit
19bb22273c
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user