Commit 4c76a7fc authored by Aidan MacDonald's avatar Aidan MacDonald Committed by Linus Walleij

pinctrl: ingenic: Use irqd_to_hwirq()

Instead of accessing ->hwirq directly, use irqd_to_hwirq().
Suggested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: default avatarMarc Zyngier <maz@kernel.org>
Reviewed-by: default avatarPaul Cercueil <paul@crapouillou.net>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarAidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20220622185010.2022515-2-aidanmacdonald.0x0@gmail.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent eb1c38c6
...@@ -3393,7 +3393,7 @@ static void ingenic_gpio_irq_mask(struct irq_data *irqd) ...@@ -3393,7 +3393,7 @@ static void ingenic_gpio_irq_mask(struct irq_data *irqd)
{ {
struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
int irq = irqd->hwirq; irq_hw_number_t irq = irqd_to_hwirq(irqd);
if (is_soc_or_above(jzgc->jzpc, ID_JZ4740)) if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
ingenic_gpio_set_bit(jzgc, GPIO_MSK, irq, true); ingenic_gpio_set_bit(jzgc, GPIO_MSK, irq, true);
...@@ -3405,7 +3405,7 @@ static void ingenic_gpio_irq_unmask(struct irq_data *irqd) ...@@ -3405,7 +3405,7 @@ static void ingenic_gpio_irq_unmask(struct irq_data *irqd)
{ {
struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
int irq = irqd->hwirq; irq_hw_number_t irq = irqd_to_hwirq(irqd);
if (is_soc_or_above(jzgc->jzpc, ID_JZ4740)) if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
ingenic_gpio_set_bit(jzgc, GPIO_MSK, irq, false); ingenic_gpio_set_bit(jzgc, GPIO_MSK, irq, false);
...@@ -3417,7 +3417,7 @@ static void ingenic_gpio_irq_enable(struct irq_data *irqd) ...@@ -3417,7 +3417,7 @@ static void ingenic_gpio_irq_enable(struct irq_data *irqd)
{ {
struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
int irq = irqd->hwirq; irq_hw_number_t irq = irqd_to_hwirq(irqd);
if (is_soc_or_above(jzgc->jzpc, ID_JZ4770)) if (is_soc_or_above(jzgc->jzpc, ID_JZ4770))
ingenic_gpio_set_bit(jzgc, JZ4770_GPIO_INT, irq, true); ingenic_gpio_set_bit(jzgc, JZ4770_GPIO_INT, irq, true);
...@@ -3433,7 +3433,7 @@ static void ingenic_gpio_irq_disable(struct irq_data *irqd) ...@@ -3433,7 +3433,7 @@ static void ingenic_gpio_irq_disable(struct irq_data *irqd)
{ {
struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
int irq = irqd->hwirq; irq_hw_number_t irq = irqd_to_hwirq(irqd);
ingenic_gpio_irq_mask(irqd); ingenic_gpio_irq_mask(irqd);
...@@ -3449,7 +3449,7 @@ static void ingenic_gpio_irq_ack(struct irq_data *irqd) ...@@ -3449,7 +3449,7 @@ static void ingenic_gpio_irq_ack(struct irq_data *irqd)
{ {
struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
int irq = irqd->hwirq; irq_hw_number_t irq = irqd_to_hwirq(irqd);
bool high; bool high;
if ((irqd_get_trigger_type(irqd) == IRQ_TYPE_EDGE_BOTH) && if ((irqd_get_trigger_type(irqd) == IRQ_TYPE_EDGE_BOTH) &&
...@@ -3477,6 +3477,7 @@ static int ingenic_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) ...@@ -3477,6 +3477,7 @@ static int ingenic_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
{ {
struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
irq_hw_number_t irq = irqd_to_hwirq(irqd);
switch (type) { switch (type) {
case IRQ_TYPE_EDGE_BOTH: case IRQ_TYPE_EDGE_BOTH:
...@@ -3498,12 +3499,12 @@ static int ingenic_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) ...@@ -3498,12 +3499,12 @@ static int ingenic_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
* best we can do is to set up a single-edge interrupt and then * best we can do is to set up a single-edge interrupt and then
* switch to the opposing edge when ACKing the interrupt. * switch to the opposing edge when ACKing the interrupt.
*/ */
bool high = ingenic_gpio_get_value(jzgc, irqd->hwirq); bool high = ingenic_gpio_get_value(jzgc, irq);
type = high ? IRQ_TYPE_LEVEL_LOW : IRQ_TYPE_LEVEL_HIGH; type = high ? IRQ_TYPE_LEVEL_LOW : IRQ_TYPE_LEVEL_HIGH;
} }
irq_set_type(jzgc, irqd->hwirq, type); irq_set_type(jzgc, irq, type);
return 0; return 0;
} }
...@@ -3668,20 +3669,22 @@ static const struct pinctrl_ops ingenic_pctlops = { ...@@ -3668,20 +3669,22 @@ static const struct pinctrl_ops ingenic_pctlops = {
static int ingenic_gpio_irq_request(struct irq_data *data) static int ingenic_gpio_irq_request(struct irq_data *data)
{ {
struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data); struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data);
irq_hw_number_t irq = irqd_to_hwirq(data);
int ret; int ret;
ret = ingenic_gpio_direction_input(gpio_chip, data->hwirq); ret = ingenic_gpio_direction_input(gpio_chip, irq);
if (ret) if (ret)
return ret; return ret;
return gpiochip_reqres_irq(gpio_chip, data->hwirq); return gpiochip_reqres_irq(gpio_chip, irq);
} }
static void ingenic_gpio_irq_release(struct irq_data *data) static void ingenic_gpio_irq_release(struct irq_data *data)
{ {
struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data); struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data);
irq_hw_number_t irq = irqd_to_hwirq(data);
return gpiochip_relres_irq(gpio_chip, data->hwirq); return gpiochip_relres_irq(gpio_chip, irq);
} }
static int ingenic_pinmux_set_pin_fn(struct ingenic_pinctrl *jzpc, static int ingenic_pinmux_set_pin_fn(struct ingenic_pinctrl *jzpc,
......
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