Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: Add GPIOLIB_IRQCHIP cleanup to TODO

We now have two APIs for registering GPIOLIB_IRQCHIP, this is not
working and creating confusion. Add a TODO item to fix it up.

Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+40
+40
drivers/gpio/TODO
··· 90 90 The GPIOLIB irqchip is a helper irqchip for "simple cases" that should 91 91 try to cover any generic kind of irqchip cascaded from a GPIO. 92 92 93 + - Convert all the GPIOLIB_IRQCHIP users to pass an irqchip template, 94 + parent and flags before calling [devm_]gpiochip_add[_data](). 95 + Currently we set up the irqchip after setting up the gpiochip 96 + using gpiochip_irqchip_add() and gpiochip_set_[chained|nested]_irqchip(). 97 + This is too complex, so convert all users over to just set up 98 + the irqchip before registering the gpio_chip, typical example: 99 + 100 + /* Typical state container with dynamic irqchip */ 101 + struct my_gpio { 102 + struct gpio_chip gc; 103 + struct irq_chip irq; 104 + }; 105 + 106 + int irq; /* from platform etc */ 107 + struct my_gpio *g; 108 + struct gpio_irq_chip *girq 109 + 110 + /* Set up the irqchip dynamically */ 111 + g->irq.name = "my_gpio_irq"; 112 + g->irq.irq_ack = my_gpio_ack_irq; 113 + g->irq.irq_mask = my_gpio_mask_irq; 114 + g->irq.irq_unmask = my_gpio_unmask_irq; 115 + g->irq.irq_set_type = my_gpio_set_irq_type; 116 + 117 + /* Get a pointer to the gpio_irq_chip */ 118 + girq = &g->gc.irq; 119 + girq->chip = &g->irq; 120 + girq->parent_handler = ftgpio_gpio_irq_handler; 121 + girq->num_parents = 1; 122 + girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), 123 + GFP_KERNEL); 124 + if (!girq->parents) 125 + return -ENOMEM; 126 + girq->default_type = IRQ_TYPE_NONE; 127 + girq->handler = handle_bad_irq; 128 + girq->parents[0] = irq; 129 + 130 + When this is done, we will delete the old APIs for instatiating 131 + GPIOLIB_IRQCHIP and simplify the code. 132 + 93 133 - Look over and identify any remaining easily converted drivers and 94 134 dry-code conversions to gpiolib irqchip for maintainers to test 95 135