@@ -1187,17 +1187,10 @@ static int sx150x_probe(struct i2c_client *client,
1187
1187
if (pctl -> data -> model != SX150X_789 )
1188
1188
pctl -> gpio .set_multiple = sx150x_gpio_set_multiple ;
1189
1189
1190
- ret = devm_gpiochip_add_data (dev , & pctl -> gpio , pctl );
1191
- if (ret )
1192
- return ret ;
1193
-
1194
- ret = gpiochip_add_pin_range (& pctl -> gpio , dev_name (dev ),
1195
- 0 , 0 , pctl -> data -> npins );
1196
- if (ret )
1197
- return ret ;
1198
-
1199
1190
/* Add Interrupt support if an irq is specified */
1200
1191
if (client -> irq > 0 ) {
1192
+ struct gpio_irq_chip * girq ;
1193
+
1201
1194
pctl -> irq_chip .irq_mask = sx150x_irq_mask ;
1202
1195
pctl -> irq_chip .irq_unmask = sx150x_irq_unmask ;
1203
1196
pctl -> irq_chip .irq_set_type = sx150x_irq_set_type ;
@@ -1213,22 +1206,24 @@ static int sx150x_probe(struct i2c_client *client,
1213
1206
1214
1207
/*
1215
1208
* Because sx150x_irq_threaded_fn invokes all of the
1216
- * nested interrrupt handlers via handle_nested_irq,
1217
- * any "handler" passed to gpiochip_irqchip_add()
1209
+ * nested interrupt handlers via handle_nested_irq,
1210
+ * any "handler" assigned to struct gpio_irq_chip
1218
1211
* below is going to be ignored, so the choice of the
1219
1212
* function does not matter that much.
1220
1213
*
1221
1214
* We set it to handle_bad_irq to avoid confusion,
1222
1215
* plus it will be instantly noticeable if it is ever
1223
1216
* called (should not happen)
1224
1217
*/
1225
- ret = gpiochip_irqchip_add_nested (& pctl -> gpio ,
1226
- & pctl -> irq_chip , 0 ,
1227
- handle_bad_irq , IRQ_TYPE_NONE );
1228
- if (ret ) {
1229
- dev_err (dev , "could not connect irqchip to gpiochip\n" );
1230
- return ret ;
1231
- }
1218
+ girq = & pctl -> gpio .irq ;
1219
+ girq -> chip = & pctl -> irq_chip ;
1220
+ /* This will let us handle the parent IRQ in the driver */
1221
+ girq -> parent_handler = NULL ;
1222
+ girq -> num_parents = 0 ;
1223
+ girq -> parents = NULL ;
1224
+ girq -> default_type = IRQ_TYPE_NONE ;
1225
+ girq -> handler = handle_bad_irq ;
1226
+ girq -> threaded = true;
1232
1227
1233
1228
ret = devm_request_threaded_irq (dev , client -> irq , NULL ,
1234
1229
sx150x_irq_thread_fn ,
@@ -1237,12 +1232,17 @@ static int sx150x_probe(struct i2c_client *client,
1237
1232
pctl -> irq_chip .name , pctl );
1238
1233
if (ret < 0 )
1239
1234
return ret ;
1240
-
1241
- gpiochip_set_nested_irqchip (& pctl -> gpio ,
1242
- & pctl -> irq_chip ,
1243
- client -> irq );
1244
1235
}
1245
1236
1237
+ ret = devm_gpiochip_add_data (dev , & pctl -> gpio , pctl );
1238
+ if (ret )
1239
+ return ret ;
1240
+
1241
+ ret = gpiochip_add_pin_range (& pctl -> gpio , dev_name (dev ),
1242
+ 0 , 0 , pctl -> data -> npins );
1243
+ if (ret )
1244
+ return ret ;
1245
+
1246
1246
return 0 ;
1247
1247
}
1248
1248
0 commit comments