After changing the drivers to use GPIO core to add an IRQ chip it appears that some of them requires a hardware initialization before adding the IRQ chip. Add an optional callback ->init_hw() to allow that drivers to initialize hardware if needed. This change is a part of the fix NULL pointer dereference brought to the several drivers recently.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -201,6 +201,14 @@ struct gpio_irq_chip { · 200 unmodified lines | ||
| 201 | 201 | */ |
| 202 | 202 | bool threaded; |
| 203 | 203 | |
| 204 | + /** | |
| 205 | + * @init_hw: optional routine to initialize hardware before | |
| 206 | + * an IRQ chip will be added. This is quite useful when | |
| 207 | + * a particular driver wants to clear IRQ related registers | |
| 208 | + * in order to avoid undesired events. | |
| 209 | + */ | |
| 210 | + int (*init_hw)(struct gpio_chip *chip); | |
| 211 | + | |
| 204 | 212 | /** |
| 205 | 213 | * @init_valid_mask: optional routine to initialize @valid_mask, to be |
| 206 | 214 | * used if not all GPIO lines are valid interrupts. Sometimes some |