Skip to content

Commit

Permalink
Merge branch 'ib-gpio-ppid' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
Linus Walleij committed Oct 26, 2021
2 parents f0c142f + cfe6807 commit 5853fd5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
9 changes: 7 additions & 2 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,9 +1534,14 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
}

if (gc->irq.parent_handler) {
void *data = gc->irq.parent_handler_data ?: gc;

for (i = 0; i < gc->irq.num_parents; i++) {
void *data;

if (gc->irq.per_parent_data)
data = gc->irq.parent_handler_data_array[i];
else
data = gc->irq.parent_handler_data ?: gc;

/*
* The parent IRQ chip is already using the chip_data
* for this IRQ chip, so our callbacks simply use the
Expand Down
19 changes: 17 additions & 2 deletions include/linux/gpio/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,18 @@ struct gpio_irq_chip {

/**
* @parent_handler_data:
* @parent_handler_data_array:
*
* Data associated, and passed to, the handler for the parent
* interrupt.
* interrupt. Can either be a single pointer if @per_parent_data
* is false, or an array of @num_parents pointers otherwise. If
* @per_parent_data is true, @parent_handler_data_array cannot be
* NULL.
*/
void *parent_handler_data;
union {
void *parent_handler_data;
void **parent_handler_data_array;
};

/**
* @num_parents:
Expand Down Expand Up @@ -203,6 +210,14 @@ struct gpio_irq_chip {
*/
bool threaded;

/**
* @per_parent_data:
*
* True if parent_handler_data_array describes a @num_parents
* sized array to be used as parent data.
*/
bool per_parent_data;

/**
* @init_hw: optional routine to initialize hardware before
* an IRQ chip will be added. This is quite useful when
Expand Down

0 comments on commit 5853fd5

Please sign in to comment.