1717 */
1818
1919#include <linux/bitops.h>
20- #include <linux/gpio/consumer.h>
21- #include <linux/gpio/machine.h>
2220#include <linux/gpio/driver.h>
2321#include <linux/hid.h>
2422#include <linux/hidraw.h>
@@ -168,7 +166,6 @@ struct cp2112_device {
168166 u8 * in_out_buffer ;
169167 struct mutex lock ;
170168
171- struct gpio_desc * desc [8 ];
172169 bool gpio_poll ;
173170 struct delayed_work gpio_poll_worker ;
174171 unsigned long irq_mask ;
@@ -1181,51 +1178,6 @@ static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type)
11811178 return 0 ;
11821179}
11831180
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-
12291181static const struct irq_chip cp2112_gpio_irqchip = {
12301182 .name = "cp2112-gpio" ,
12311183 .irq_startup = cp2112_gpio_irq_startup ,
@@ -1390,7 +1342,6 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
13901342static void cp2112_remove (struct hid_device * hdev )
13911343{
13921344 struct cp2112_device * dev = hid_get_drvdata (hdev );
1393- int i ;
13941345
13951346 sysfs_remove_group (& hdev -> dev .kobj , & cp2112_attr_group );
13961347 i2c_del_adapter (& dev -> adap );
@@ -1400,11 +1351,6 @@ static void cp2112_remove(struct hid_device *hdev)
14001351 cancel_delayed_work_sync (& dev -> gpio_poll_worker );
14011352 }
14021353
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-
14081354 gpiochip_remove (& dev -> gc );
14091355 /* i2c_del_adapter has finished removing all i2c devices from our
14101356 * adapter. Well behaved devices should no longer call our cp2112_xfer
0 commit comments