File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -1534,9 +1534,14 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
1534
1534
}
1535
1535
1536
1536
if (gc -> irq .parent_handler ) {
1537
- void * data = gc -> irq .parent_handler_data ?: gc ;
1538
-
1539
1537
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
+
1540
1545
/*
1541
1546
* The parent IRQ chip is already using the chip_data
1542
1547
* 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 {
168
168
169
169
/**
170
170
* @parent_handler_data:
171
+ * @parent_handler_data_array:
171
172
*
172
173
* 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.
174
178
*/
175
- void * parent_handler_data ;
179
+ union {
180
+ void * parent_handler_data ;
181
+ void * * parent_handler_data_array ;
182
+ };
176
183
177
184
/**
178
185
* @num_parents:
@@ -203,6 +210,14 @@ struct gpio_irq_chip {
203
210
*/
204
211
bool threaded ;
205
212
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
+
206
221
/**
207
222
* @init_hw: optional routine to initialize hardware before
208
223
* an IRQ chip will be added. This is quite useful when
You can’t perform that action at this time.
0 commit comments