17
17
*/
18
18
19
19
#include <linux/bitops.h>
20
- #include <linux/gpio/consumer.h>
21
- #include <linux/gpio/machine.h>
22
20
#include <linux/gpio/driver.h>
23
21
#include <linux/hid.h>
24
22
#include <linux/hidraw.h>
@@ -168,7 +166,6 @@ struct cp2112_device {
168
166
u8 * in_out_buffer ;
169
167
struct mutex lock ;
170
168
171
- struct gpio_desc * desc [8 ];
172
169
bool gpio_poll ;
173
170
struct delayed_work gpio_poll_worker ;
174
171
unsigned long irq_mask ;
@@ -1181,51 +1178,6 @@ static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type)
1181
1178
return 0 ;
1182
1179
}
1183
1180
1184
- static int __maybe_unused cp2112_allocate_irq (struct cp2112_device * dev ,
1185
- int pin )
1186
- {
1187
- int ret ;
1188
-
1189
- if (dev -> desc [pin ])
1190
- return - EINVAL ;
1191
-
1192
- dev -> desc [pin ] = gpiochip_request_own_desc (& dev -> gc , pin ,
1193
- "HID/I2C:Event" ,
1194
- GPIO_ACTIVE_HIGH ,
1195
- GPIOD_IN );
1196
- if (IS_ERR (dev -> desc [pin ])) {
1197
- dev_err (dev -> gc .parent , "Failed to request GPIO\n" );
1198
- return PTR_ERR (dev -> desc [pin ]);
1199
- }
1200
-
1201
- ret = cp2112_gpio_direction_input (& dev -> gc , pin );
1202
- if (ret < 0 ) {
1203
- dev_err (dev -> gc .parent , "Failed to set GPIO to input dir\n" );
1204
- goto err_desc ;
1205
- }
1206
-
1207
- ret = gpiochip_lock_as_irq (& dev -> gc , pin );
1208
- if (ret ) {
1209
- dev_err (dev -> gc .parent , "Failed to lock GPIO as interrupt\n" );
1210
- goto err_desc ;
1211
- }
1212
-
1213
- ret = gpiod_to_irq (dev -> desc [pin ]);
1214
- if (ret < 0 ) {
1215
- dev_err (dev -> gc .parent , "Failed to translate GPIO to IRQ\n" );
1216
- goto err_lock ;
1217
- }
1218
-
1219
- return ret ;
1220
-
1221
- err_lock :
1222
- gpiochip_unlock_as_irq (& dev -> gc , pin );
1223
- err_desc :
1224
- gpiochip_free_own_desc (dev -> desc [pin ]);
1225
- dev -> desc [pin ] = NULL ;
1226
- return ret ;
1227
- }
1228
-
1229
1181
static const struct irq_chip cp2112_gpio_irqchip = {
1230
1182
.name = "cp2112-gpio" ,
1231
1183
.irq_startup = cp2112_gpio_irq_startup ,
@@ -1390,7 +1342,6 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
1390
1342
static void cp2112_remove (struct hid_device * hdev )
1391
1343
{
1392
1344
struct cp2112_device * dev = hid_get_drvdata (hdev );
1393
- int i ;
1394
1345
1395
1346
sysfs_remove_group (& hdev -> dev .kobj , & cp2112_attr_group );
1396
1347
i2c_del_adapter (& dev -> adap );
@@ -1400,11 +1351,6 @@ static void cp2112_remove(struct hid_device *hdev)
1400
1351
cancel_delayed_work_sync (& dev -> gpio_poll_worker );
1401
1352
}
1402
1353
1403
- for (i = 0 ; i < ARRAY_SIZE (dev -> desc ); i ++ ) {
1404
- gpiochip_unlock_as_irq (& dev -> gc , i );
1405
- gpiochip_free_own_desc (dev -> desc [i ]);
1406
- }
1407
-
1408
1354
gpiochip_remove (& dev -> gc );
1409
1355
/* i2c_del_adapter has finished removing all i2c devices from our
1410
1356
* adapter. Well behaved devices should no longer call our cp2112_xfer
0 commit comments