diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2019-09-04 10:01:04 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2019-09-10 20:09:37 -0400 |
commit | 5fbe5b5883f847363ff1b7280e8b1d2980526b8e (patch) | |
tree | 806efff2538fb4d6860cae617f4990f47481db7c /drivers/gpio/gpio-aspeed.c | |
parent | 4f78d91c722345de94a3c72da49b9d0d49cb76b8 (diff) |
gpio: Initialize the irqchip valid_mask with a callback
After changing the valid_mask for the struct gpio_chip
to detect the need and presence of a valid mask with the
presence of a .init_valid_mask() callback to fill it in,
we augment the gpio_irq_chip to use the same logic.
Switch all driver using the gpio_irq_chio valid_mask
over to this new method.
This makes sure the valid_mask for the gpio_irq_chip gets
filled in when we add the gpio_chip, which makes it a
little easier to switch over drivers using the old
way of setting up gpio_irq_chip over to the new method
of passing the gpio_irq_chip along with the gpio_chip.
(See drivers/gpio/TODO for details.)
Cc: Joel Stanley <joel@jms.id.au>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Link: https://lore.kernel.org/r/20190904140104.32426-1-linus.walleij@linaro.org
Diffstat (limited to 'drivers/gpio/gpio-aspeed.c')
-rw-r--r-- | drivers/gpio/gpio-aspeed.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 9defe25d4721..7bcd83dbc3e3 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c | |||
@@ -689,8 +689,11 @@ static struct irq_chip aspeed_gpio_irqchip = { | |||
689 | .irq_set_type = aspeed_gpio_set_type, | 689 | .irq_set_type = aspeed_gpio_set_type, |
690 | }; | 690 | }; |
691 | 691 | ||
692 | static void set_irq_valid_mask(struct aspeed_gpio *gpio) | 692 | static void aspeed_init_irq_valid_mask(struct gpio_chip *gc, |
693 | unsigned long *valid_mask, | ||
694 | unsigned int ngpios) | ||
693 | { | 695 | { |
696 | struct aspeed_gpio *gpio = gpiochip_get_data(gc); | ||
694 | const struct aspeed_bank_props *props = gpio->config->props; | 697 | const struct aspeed_bank_props *props = gpio->config->props; |
695 | 698 | ||
696 | while (!is_bank_props_sentinel(props)) { | 699 | while (!is_bank_props_sentinel(props)) { |
@@ -704,7 +707,7 @@ static void set_irq_valid_mask(struct aspeed_gpio *gpio) | |||
704 | if (i >= gpio->config->nr_gpios) | 707 | if (i >= gpio->config->nr_gpios) |
705 | break; | 708 | break; |
706 | 709 | ||
707 | clear_bit(i, gpio->chip.irq.valid_mask); | 710 | clear_bit(i, valid_mask); |
708 | } | 711 | } |
709 | 712 | ||
710 | props++; | 713 | props++; |
@@ -1203,7 +1206,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) | |||
1203 | girq->parents[0] = gpio->irq; | 1206 | girq->parents[0] = gpio->irq; |
1204 | girq->default_type = IRQ_TYPE_NONE; | 1207 | girq->default_type = IRQ_TYPE_NONE; |
1205 | girq->handler = handle_bad_irq; | 1208 | girq->handler = handle_bad_irq; |
1206 | girq->need_valid_mask = true; | 1209 | girq->init_valid_mask = aspeed_init_irq_valid_mask; |
1207 | } | 1210 | } |
1208 | 1211 | ||
1209 | gpio->offset_timer = | 1212 | gpio->offset_timer = |
@@ -1215,10 +1218,6 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) | |||
1215 | if (rc < 0) | 1218 | if (rc < 0) |
1216 | return rc; | 1219 | return rc; |
1217 | 1220 | ||
1218 | /* Now the valid mask is allocated */ | ||
1219 | if (gpio->irq) | ||
1220 | set_irq_valid_mask(gpio); | ||
1221 | |||
1222 | return 0; | 1221 | return 0; |
1223 | } | 1222 | } |
1224 | 1223 | ||