Commit e092bc50 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

gpio: dwapb: Convert to use irqd_to_hwirq()

Convert to use irqd_to_hwirq() instead of direct access to the hwirq member.
Also amend the type of the hwirq holding variable to be irq_hw_number_t.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Cc: Serge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/20200415141534.31240-7-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 43296bf2
...@@ -194,7 +194,7 @@ static void dwapb_toggle_trigger(struct dwapb_gpio *gpio, unsigned int offs) ...@@ -194,7 +194,7 @@ static void dwapb_toggle_trigger(struct dwapb_gpio *gpio, unsigned int offs)
static u32 dwapb_do_irq(struct dwapb_gpio *gpio) static u32 dwapb_do_irq(struct dwapb_gpio *gpio)
{ {
unsigned long irq_status; unsigned long irq_status;
int hwirq; irq_hw_number_t hwirq;
irq_status = dwapb_read(gpio, GPIO_INTSTATUS); irq_status = dwapb_read(gpio, GPIO_INTSTATUS);
for_each_set_bit(hwirq, &irq_status, 32) { for_each_set_bit(hwirq, &irq_status, 32) {
...@@ -230,7 +230,7 @@ static void dwapb_irq_enable(struct irq_data *d) ...@@ -230,7 +230,7 @@ static void dwapb_irq_enable(struct irq_data *d)
spin_lock_irqsave(&gc->bgpio_lock, flags); spin_lock_irqsave(&gc->bgpio_lock, flags);
val = dwapb_read(gpio, GPIO_INTEN); val = dwapb_read(gpio, GPIO_INTEN);
val |= BIT(d->hwirq); val |= BIT(irqd_to_hwirq(d));
dwapb_write(gpio, GPIO_INTEN, val); dwapb_write(gpio, GPIO_INTEN, val);
spin_unlock_irqrestore(&gc->bgpio_lock, flags); spin_unlock_irqrestore(&gc->bgpio_lock, flags);
} }
...@@ -245,7 +245,7 @@ static void dwapb_irq_disable(struct irq_data *d) ...@@ -245,7 +245,7 @@ static void dwapb_irq_disable(struct irq_data *d)
spin_lock_irqsave(&gc->bgpio_lock, flags); spin_lock_irqsave(&gc->bgpio_lock, flags);
val = dwapb_read(gpio, GPIO_INTEN); val = dwapb_read(gpio, GPIO_INTEN);
val &= ~BIT(d->hwirq); val &= ~BIT(irqd_to_hwirq(d));
dwapb_write(gpio, GPIO_INTEN, val); dwapb_write(gpio, GPIO_INTEN, val);
spin_unlock_irqrestore(&gc->bgpio_lock, flags); spin_unlock_irqrestore(&gc->bgpio_lock, flags);
} }
...@@ -255,7 +255,7 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type) ...@@ -255,7 +255,7 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)
struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
struct dwapb_gpio *gpio = igc->private; struct dwapb_gpio *gpio = igc->private;
struct gpio_chip *gc = &gpio->ports[0].gc; struct gpio_chip *gc = &gpio->ports[0].gc;
int bit = d->hwirq; irq_hw_number_t bit = irqd_to_hwirq(d);
unsigned long level, polarity, flags; unsigned long level, polarity, flags;
if (type & ~(IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | if (type & ~(IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
...@@ -305,11 +305,12 @@ static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable) ...@@ -305,11 +305,12 @@ static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable)
struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
struct dwapb_gpio *gpio = igc->private; struct dwapb_gpio *gpio = igc->private;
struct dwapb_context *ctx = gpio->ports[0].ctx; struct dwapb_context *ctx = gpio->ports[0].ctx;
irq_hw_number_t bit = irqd_to_hwirq(d);
if (enable) if (enable)
ctx->wake_en |= BIT(d->hwirq); ctx->wake_en |= BIT(bit);
else else
ctx->wake_en &= ~BIT(d->hwirq); ctx->wake_en &= ~BIT(bit);
return 0; return 0;
} }
...@@ -365,8 +366,9 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, ...@@ -365,8 +366,9 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
struct gpio_chip *gc = &port->gc; struct gpio_chip *gc = &port->gc;
struct fwnode_handle *fwnode = pp->fwnode; struct fwnode_handle *fwnode = pp->fwnode;
struct irq_chip_generic *irq_gc = NULL; struct irq_chip_generic *irq_gc = NULL;
unsigned int hwirq, ngpio = gc->ngpio; unsigned int ngpio = gc->ngpio;
struct irq_chip_type *ct; struct irq_chip_type *ct;
irq_hw_number_t hwirq;
int err, i; int err, i;
gpio->domain = irq_domain_create_linear(fwnode, ngpio, gpio->domain = irq_domain_create_linear(fwnode, ngpio,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment