File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1534,9 +1534,14 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
15341534 }
15351535
15361536 if (gc -> irq .parent_handler ) {
1537- void * data = gc -> irq .parent_handler_data ?: gc ;
1538-
15391537 for (i = 0 ; i < gc -> irq .num_parents ; i ++ ) {
1538+ void * data ;
1539+
1540+ if (gc -> irq .per_parent_data )
1541+ data = gc -> irq .parent_handler_data_array [i ];
1542+ else
1543+ data = gc -> irq .parent_handler_data ?: gc ;
1544+
15401545 /*
15411546 * The parent IRQ chip is already using the chip_data
15421547 * for this IRQ chip, so our callbacks simply use the
Original file line number Diff line number Diff line change @@ -168,11 +168,18 @@ struct gpio_irq_chip {
168168
169169 /**
170170 * @parent_handler_data:
171+ * @parent_handler_data_array:
171172 *
172173 * Data associated, and passed to, the handler for the parent
173- * interrupt.
174+ * interrupt. Can either be a single pointer if @per_parent_data
175+ * is false, or an array of @num_parents pointers otherwise. If
176+ * @per_parent_data is true, @parent_handler_data_array cannot be
177+ * NULL.
174178 */
175- void * parent_handler_data ;
179+ union {
180+ void * parent_handler_data ;
181+ void * * parent_handler_data_array ;
182+ };
176183
177184 /**
178185 * @num_parents:
@@ -203,6 +210,14 @@ struct gpio_irq_chip {
203210 */
204211 bool threaded ;
205212
213+ /**
214+ * @per_parent_data:
215+ *
216+ * True if parent_handler_data_array describes a @num_parents
217+ * sized array to be used as parent data.
218+ */
219+ bool per_parent_data ;
220+
206221 /**
207222 * @init_hw: optional routine to initialize hardware before
208223 * an IRQ chip will be added. This is quite useful when
You can’t perform that action at this time.
0 commit comments