History

gpiolib: Initialize the hardware with a callback

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.

Andy Shevchenko committed 7 years ago

Commit 9411e3a1 parent 6658f872 files · +29 −1Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/gpio/driver.h+8−0
@@ -201,6 +201,14 @@ struct gpio_irq_chip { · 200 unmodified lines
201201 */
202202 bool threaded;
203203
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+
204212 /**
205213 * @init_valid_mask: optional routine to initialize @valid_mask, to be
206214 * used if not all GPIO lines are valid interrupts. Sometimes some

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t