mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
gpio: Move irq_valid_mask into struct gpio_irq_chip
In order to consolidate the multiple ways to associate an IRQ chip with a GPIO chip, move more fields into the new struct gpio_irq_chip. Signed-off-by: Thierry Reding <[email protected]> Acked-by: Grygorii Strashko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
dc6bafee86
commit
dc7b0387ee
8 changed files with 35 additions and 26 deletions
|
|
@ -501,7 +501,7 @@ static void set_irq_valid_mask(struct aspeed_gpio *gpio)
|
|||
if (i >= gpio->config->nr_gpios)
|
||||
break;
|
||||
|
||||
clear_bit(i, gpio->chip.irq_valid_mask);
|
||||
clear_bit(i, gpio->chip.irq.valid_mask);
|
||||
}
|
||||
|
||||
props++;
|
||||
|
|
@ -856,7 +856,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
|
|||
gpio->chip.set_config = aspeed_gpio_set_config;
|
||||
gpio->chip.label = dev_name(&pdev->dev);
|
||||
gpio->chip.base = -1;
|
||||
gpio->chip.irq_need_valid_mask = true;
|
||||
gpio->chip.irq.need_valid_mask = true;
|
||||
|
||||
rc = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
|
||||
if (rc < 0)
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
|
|||
of_property_read_u32(np, "st,norequest-mask",
|
||||
&stmpe_gpio->norequest_mask);
|
||||
if (stmpe_gpio->norequest_mask)
|
||||
stmpe_gpio->chip.irq_need_valid_mask = true;
|
||||
stmpe_gpio->chip.irq.need_valid_mask = true;
|
||||
|
||||
if (irq < 0)
|
||||
dev_info(&pdev->dev,
|
||||
|
|
@ -482,7 +482,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
|
|||
/* Forbid unused lines to be mapped as IRQs */
|
||||
for (i = 0; i < sizeof(u32); i++)
|
||||
if (stmpe_gpio->norequest_mask & BIT(i))
|
||||
clear_bit(i, stmpe_gpio->chip.irq_valid_mask);
|
||||
clear_bit(i, stmpe_gpio->chip.irq.valid_mask);
|
||||
}
|
||||
ret = gpiochip_irqchip_add_nested(&stmpe_gpio->chip,
|
||||
&stmpe_gpio_irq_chip,
|
||||
|
|
|
|||
|
|
@ -1504,33 +1504,33 @@ static struct gpio_chip *find_chip_by_name(const char *name)
|
|||
|
||||
static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip)
|
||||
{
|
||||
if (!gpiochip->irq_need_valid_mask)
|
||||
if (!gpiochip->irq.need_valid_mask)
|
||||
return 0;
|
||||
|
||||
gpiochip->irq_valid_mask = kcalloc(BITS_TO_LONGS(gpiochip->ngpio),
|
||||
gpiochip->irq.valid_mask = kcalloc(BITS_TO_LONGS(gpiochip->ngpio),
|
||||
sizeof(long), GFP_KERNEL);
|
||||
if (!gpiochip->irq_valid_mask)
|
||||
if (!gpiochip->irq.valid_mask)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Assume by default all GPIOs are valid */
|
||||
bitmap_fill(gpiochip->irq_valid_mask, gpiochip->ngpio);
|
||||
bitmap_fill(gpiochip->irq.valid_mask, gpiochip->ngpio);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip)
|
||||
{
|
||||
kfree(gpiochip->irq_valid_mask);
|
||||
gpiochip->irq_valid_mask = NULL;
|
||||
kfree(gpiochip->irq.valid_mask);
|
||||
gpiochip->irq.valid_mask = NULL;
|
||||
}
|
||||
|
||||
static bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
|
||||
unsigned int offset)
|
||||
{
|
||||
/* No mask means all valid */
|
||||
if (likely(!gpiochip->irq_valid_mask))
|
||||
if (likely(!gpiochip->irq.valid_mask))
|
||||
return true;
|
||||
return test_bit(offset, gpiochip->irq_valid_mask);
|
||||
return test_bit(offset, gpiochip->irq.valid_mask);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue