static int u2fzero_probe(struct hid_device *hdev, const struct hid_device_id *id) { struct u2fzero_device *dev; unsigned int minor; int ret; if (!hid_is_using_ll_driver(hdev, &usb_hid_driver)) return -EINVAL; dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); if (dev == NULL) return -ENOMEM; dev->buf_out = devm_kmalloc(&hdev->dev, sizeof(struct u2f_hid_report), GFP_KERNEL); if (dev->buf_out == NULL) return -ENOMEM; dev->buf_in = devm_kmalloc(&hdev->dev, sizeof(struct u2f_hid_msg), GFP_KERNEL); if (dev->buf_in == NULL) return -ENOMEM; ret = hid_parse(hdev); if (ret) return ret; dev->hdev = hdev; hid_set_drvdata(hdev, dev); mutex_init(&dev->lock); ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); if (ret) return ret; u2fzero_fill_in_urb(dev); dev->present = true; minor = ((struct hidraw *) hdev->hidraw)->minor; ret = u2fzero_init_led(dev, minor); if (ret) { hid_hw_stop(hdev); return ret; } hid_info(hdev, "U2F Zero LED initialised\n"); ret = u2fzero_init_hwrng(dev, minor); if (ret) { hid_hw_stop(hdev); return ret; } hid_info(hdev, "U2F Zero RNG initialised\n"); return 0; }
static void tpkbd_remove(struct hid_device *hdev) { if (hid_get_drvdata(hdev)) tpkbd_remove_tp(hdev); hid_hw_stop(hdev); }
static int tpkbd_probe(struct hid_device *hdev, const struct hid_device_id *id) { int ret; ret = hid_parse(hdev); if (ret) { hid_err(hdev, "hid_parse failed\n"); goto err; } ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (ret) { hid_err(hdev, "hid_hw_start failed\n"); goto err; } if (hid_get_drvdata(hdev)) { hid_set_drvdata(hdev, NULL); ret = tpkbd_probe_tp(hdev); if (ret) goto err_hid; } return 0; err_hid: hid_hw_stop(hdev); err: return ret; }
static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id) { int ret; dev_dbg(&hdev->dev, "DragonRise Inc. HID hardware probe..."); ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); goto err; } ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); if (ret) { hid_err(hdev, "hw start failed\n"); goto err; } switch (hdev->product) { case 0x0006: ret = drff_init(hdev); if (ret) { dev_err(&hdev->dev, "force feedback init failed\n"); hid_hw_stop(hdev); goto err; } break; } return 0; err: return ret; }
static int kovaplus_probe(struct hid_device *hdev, const struct hid_device_id *id) { int retval; retval = hid_parse(hdev); if (retval) { hid_err(hdev, "parse failed\n"); goto exit; } retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (retval) { hid_err(hdev, "hw start failed\n"); goto exit; } retval = kovaplus_init_specials(hdev); if (retval) { hid_err(hdev, "couldn't install mouse\n"); goto exit_stop; } return 0; exit_stop: hid_hw_stop(hdev); exit: return retval; }
void gcore_hid_close(struct gcore_data *gdata) { struct hid_device *hdev = gdata->hdev; hdev->ll_driver->close(hdev); hid_hw_stop(hdev); }
static void a4_remove(struct hid_device *hdev) { struct a4tech_sc *a4 = hid_get_drvdata(hdev); hid_hw_stop(hdev); kfree(a4); }
static void waltop_remove(struct hid_device *hdev) { struct waltop_state *s = hid_get_drvdata(hdev); hid_hw_stop(hdev); kfree(s); }
/** * Unbind function */ static void razer_core_disconnect(struct hid_device *hdev) { struct razer_kbd_device *dev; struct usb_interface *intf = to_usb_interface(hdev->dev.parent); //struct usb_device *usb_dev = interface_to_usbdev(intf); dev = hid_get_drvdata(hdev); device_remove_file(&hdev->dev, &dev_attr_version); device_remove_file(&hdev->dev, &dev_attr_matrix_custom_frame); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_wave); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_spectrum); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_none); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_reactive); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_breath); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_custom); device_remove_file(&hdev->dev, &dev_attr_device_serial); device_remove_file(&hdev->dev, &dev_attr_firmware_version); device_remove_file(&hdev->dev, &dev_attr_device_type); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_static); device_remove_file(&hdev->dev, &dev_attr_matrix_brightness); device_remove_file(&hdev->dev, &dev_attr_device_mode); hid_hw_stop(hdev); kfree(dev); dev_info(&intf->dev, "Razer Device disconnected\n"); }
static void g19_remove(struct hid_device *hdev) { struct g19_data *data; int i; /* Get the internal g19 data buffer */ data = hid_get_drvdata(hdev); input_unregister_device(data->input_dev); kfree(data->name); /* Clean up the leds */ for (i = 0; i < LED_COUNT; i++) { led_classdev_unregister(data->led_cdev[i]); kfree(data->led_cdev[i]->name); kfree(data->led_cdev[i]); } gfb_remove(data->gfb_data); hdev->ll_driver->close(hdev); hid_hw_stop(hdev); sysfs_remove_group(&(hdev->dev.kobj), &g19_attr_group); usb_free_urb(data->ep1_urb); /* Finally, clean up the g19 data itself */ kfree(data); }
static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id) { int ret; ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); goto err; } ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); if (ret) { hid_err(hdev, "hw start failed\n"); goto err; } ret = emsff_init(hdev); if (ret) { dev_err(&hdev->dev, "force feedback init failed\n"); hid_hw_stop(hdev); goto err; } return 0; err: return ret; }
static void mt_remove(struct hid_device *hdev) { struct mt_device *td = hid_get_drvdata(hdev); hid_hw_stop(hdev); kfree(td); hid_set_drvdata(hdev, NULL); }
static void logi_dj_remove(struct hid_device *hdev) { struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); struct dj_device *dj_dev; int i; dbg_hid("%s\n", __func__); cancel_work_sync(&djrcv_dev->work); hdev->ll_driver->close(hdev); hid_hw_stop(hdev); /* I suppose that at this point the only context that can access * the djrecv_data is this thread as the work item is guaranteed to * have finished and no more raw_event callbacks should arrive after * the remove callback was triggered so no locks are put around the * code below */ for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN); i++) { dj_dev = djrcv_dev->paired_dj_devices[i]; if (dj_dev != NULL) { hid_destroy_device(dj_dev->hdev); kfree(dj_dev); djrcv_dev->paired_dj_devices[i] = NULL; } } kfifo_free(&djrcv_dev->notif_fifo); kfree(djrcv_dev); hid_set_drvdata(hdev, NULL); }
static void logi_dj_remove(struct hid_device *hdev) { struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); struct dj_device *dj_dev; int i; dbg_hid("%s\n", __func__); cancel_work_sync(&djrcv_dev->work); hdev->ll_driver->close(hdev); hid_hw_stop(hdev); for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN); i++) { dj_dev = djrcv_dev->paired_dj_devices[i]; if (dj_dev != NULL) { hid_destroy_device(dj_dev->hdev); kfree(dj_dev); djrcv_dev->paired_dj_devices[i] = NULL; } } kfifo_free(&djrcv_dev->notif_fifo); kfree(djrcv_dev); hid_set_drvdata(hdev, NULL); }
static void zc_remove(struct hid_device *hdev) { struct zc_device *zc = hid_get_drvdata(hdev); hid_hw_stop(hdev); kfree(zc); }
static void avr_remove(struct hid_device *hd) { //call hid_hw_close(hdev) if hid_hw_open() is called in probe() printk("avr remove\n"); //hid_hw_close(hd); hid_hw_stop(hd); }
static void lg_remove(struct hid_device *hdev) { unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); if(quirks & LG_FF4) lg4ff_deinit(hdev); hid_hw_stop(hdev); }
static void lg_remove(struct hid_device *hdev) { struct lg_drv_data *drv_data = hid_get_drvdata(hdev); if (drv_data->quirks & LG_FF4) lg4ff_deinit(hdev); else hid_hw_stop(hdev); kfree(drv_data); }
//------------------------------------------------------ static void penmount_remove(struct hid_device *pHidDevice) { if (!pHidDevice) return; hid_hw_stop(pHidDevice); return; }
static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) { int ret; unsigned long quirks = id->driver_data; struct sony_sc *sc; unsigned int connect_mask = HID_CONNECT_DEFAULT; sc = kzalloc(sizeof(*sc), GFP_KERNEL); if (sc == NULL) { hid_err(hdev, "can't alloc sony descriptor\n"); return -ENOMEM; } sc->quirks = quirks; hid_set_drvdata(hdev, sc); ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); goto err_free; } if (sc->quirks & VAIO_RDESC_CONSTANT) connect_mask |= HID_CONNECT_HIDDEV_FORCE; else if (sc->quirks & SIXAXIS_CONTROLLER_USB) connect_mask |= HID_CONNECT_HIDDEV_FORCE; else if (sc->quirks & SIXAXIS_CONTROLLER_BT) connect_mask |= HID_CONNECT_HIDDEV_FORCE; ret = hid_hw_start(hdev, connect_mask); if (ret) { hid_err(hdev, "hw start failed\n"); goto err_free; } if (sc->quirks & SIXAXIS_CONTROLLER_USB) { hdev->hid_output_raw_report = sixaxis_usb_output_raw_report; ret = sixaxis_set_operational_usb(hdev); } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) ret = sixaxis_set_operational_bt(hdev); else if (sc->quirks & BUZZ_CONTROLLER) ret = buzz_init(hdev); else ret = 0; if (ret < 0) goto err_stop; return 0; err_stop: hid_hw_stop(hdev); err_free: kfree(sc); return ret; }
static void sony_remove(struct hid_device *hdev) { struct sony_sc *sc = hid_get_drvdata(hdev); if (sc->quirks & BUZZ_CONTROLLER) buzz_remove(hdev); hid_hw_stop(hdev); kfree(sc); }
static int mousevsc_remove(struct hv_device *dev) { struct mousevsc_dev *input_dev = hv_get_drvdata(dev); vmbus_close(dev->channel); hid_hw_stop(input_dev->hid_device); hid_destroy_device(input_dev->hid_device); mousevsc_free_device(input_dev); return 0; }
static void u2fzero_remove(struct hid_device *hdev) { struct u2fzero_device *dev = hid_get_drvdata(hdev); mutex_lock(&dev->lock); dev->present = false; mutex_unlock(&dev->lock); hid_hw_stop(hdev); usb_poison_urb(dev->urb); usb_free_urb(dev->urb); }
/** * Unbind function */ static void razer_mousemat_disconnect(struct hid_device *hdev) { struct razer_kbd_device *dev; struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_device *usb_dev = interface_to_usbdev(intf); dev = hid_get_drvdata(hdev); if(intf->cur_altsetting->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) { switch(usb_dev->descriptor.idProduct) { case USB_DEVICE_ID_RAZER_GOLIATHUS_CHROMA: case USB_DEVICE_ID_RAZER_GOLIATHUS_CHROMA_EXTENDED: device_remove_file(&hdev->dev, &dev_attr_version); device_remove_file(&hdev->dev, &dev_attr_matrix_custom_frame); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_spectrum); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_none); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_breath); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_custom); device_remove_file(&hdev->dev, &dev_attr_device_serial); device_remove_file(&hdev->dev, &dev_attr_firmware_version); device_remove_file(&hdev->dev, &dev_attr_device_type); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_static); device_remove_file(&hdev->dev, &dev_attr_matrix_brightness); device_remove_file(&hdev->dev, &dev_attr_device_mode); break; default: device_remove_file(&hdev->dev, &dev_attr_version); device_remove_file(&hdev->dev, &dev_attr_matrix_custom_frame); device_remove_file(&hdev->dev, &dev_attr_matrix_reactive_trigger); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_wave); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_spectrum); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_none); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_reactive); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_breath); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_custom); device_remove_file(&hdev->dev, &dev_attr_device_serial); device_remove_file(&hdev->dev, &dev_attr_firmware_version); device_remove_file(&hdev->dev, &dev_attr_device_type); device_remove_file(&hdev->dev, &dev_attr_matrix_effect_static); device_remove_file(&hdev->dev, &dev_attr_matrix_brightness); device_remove_file(&hdev->dev, &dev_attr_device_mode); break; } } hid_hw_stop(hdev); kfree(dev); dev_info(&intf->dev, "Razer Device disconnected\n"); }
static void valve_sc_remove(struct hid_device *hdev) { struct valve_sc_device *sc = hid_get_drvdata (hdev); sysfs_remove_group(&hdev->dev.kobj, &valve_sc_attr_group); cancel_work_sync(&sc->connect_work); cancel_work_sync(&sc->disconnect_work); if (sc->connected) valve_sc_stop_device(sc); hid_hw_stop(hdev); }
static void ntrig_usbhid_remove(struct hid_device *hdev) { struct ntrig_usbhid_data* nd; ntrig_dbg("Entering %s\n", __FUNCTION__); hid_hw_stop(hdev); nd = hid_get_drvdata(hdev); UnregNtrigDispatcher(nd->ntrig_dispatcher, nd->sensor_id, TYPE_BUS_USB_HID, hdev->uniq); remove_device(&nd->ntrig_dispatcher); kfree(nd); ntrig_dbg("%s all resource released\n", __FUNCTION__); }
static void lenovo_remove(struct hid_device *hdev) { switch (hdev->product) { case USB_DEVICE_ID_LENOVO_TPKBD: lenovo_remove_tpkbd(hdev); break; case USB_DEVICE_ID_LENOVO_CUSBKBD: case USB_DEVICE_ID_LENOVO_CBTKBD: lenovo_remove_cptkbd(hdev); break; } hid_hw_stop(hdev); }
static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) { int ret; unsigned long quirks = id->driver_data; struct sony_sc *sc; sc = kzalloc(sizeof(*sc), GFP_KERNEL); if (sc == NULL) { hid_err(hdev, "can't alloc sony descriptor\n"); return -ENOMEM; } sc->quirks = quirks; hid_set_drvdata(hdev, sc); ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); goto err_free; } ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | HID_CONNECT_HIDDEV_FORCE); if (ret) { hid_err(hdev, "hw start failed\n"); goto err_free; } if (sc->quirks & SIXAXIS_CONTROLLER_USB) { #ifndef CONFIG_HID_SONY_PS3_CTRL_BT hdev->hid_output_raw_report = sixaxis_usb_output_raw_report; #endif ret = sixaxis_set_operational_usb(hdev); } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) ret = sixaxis_set_operational_bt(hdev); else ret = 0; if (ret < 0) goto err_stop; return 0; err_stop: hid_hw_stop(hdev); err_free: kfree(sc); return ret; }
static void rmi_hid_remove(struct hid_device *hdev) { struct rmi_transport_device *xport = hid_get_drvdata(hdev); struct rmi_hid_data * hdata = xport->data; clear_bit(RMI_HID_STARTED, &hdata->flags); cancel_work_sync(&hdata->attn_report_work); cancel_work_sync(&hdata->reset_work); if (IS_ENABLED(CONFIG_RMI4_DEBUG)) teardown_debugfs(xport->data); rmi_unregister_transport_device(xport); hdev->ll_driver->close(hdev); hid_hw_stop(hdev); }
/** * Unbind function */ static void razer_kbd_disconnect(struct hid_device *hdev) { struct razer_kbd_device *dev; struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_device *usb_dev = interface_to_usbdev(intf); dev = hid_get_drvdata(hdev); if(usb_dev->descriptor.idProduct == USB_DEVICE_ID_RAZER_BLACKWIDOW_ULTIMATE_2013) { device_remove_file(&hdev->dev, &dev_attr_mode_pulsate); } else if(usb_dev->descriptor.idProduct == USB_DEVICE_ID_RAZER_BLACKWIDOW_ULTIMATE_2016) { device_remove_file(&hdev->dev, &dev_attr_mode_wave); device_remove_file(&hdev->dev, &dev_attr_mode_starlight); device_remove_file(&hdev->dev, &dev_attr_mode_none); device_remove_file(&hdev->dev, &dev_attr_mode_reactive); device_remove_file(&hdev->dev, &dev_attr_mode_breath); device_remove_file(&hdev->dev, &dev_attr_mode_custom); device_remove_file(&hdev->dev, &dev_attr_temp_clear_row); device_remove_file(&hdev->dev, &dev_attr_set_key_row); } else // Chroma { device_remove_file(&hdev->dev, &dev_attr_mode_wave); device_remove_file(&hdev->dev, &dev_attr_mode_spectrum); device_remove_file(&hdev->dev, &dev_attr_mode_none); device_remove_file(&hdev->dev, &dev_attr_mode_reactive); device_remove_file(&hdev->dev, &dev_attr_mode_breath); device_remove_file(&hdev->dev, &dev_attr_mode_custom); device_remove_file(&hdev->dev, &dev_attr_temp_clear_row); device_remove_file(&hdev->dev, &dev_attr_set_key_row); } device_remove_file(&hdev->dev, &dev_attr_mode_game); device_remove_file(&hdev->dev, &dev_attr_get_serial); device_remove_file(&hdev->dev, &dev_attr_mode_static); device_remove_file(&hdev->dev, &dev_attr_reset); device_remove_file(&hdev->dev, &dev_attr_macro_keys); device_remove_file(&hdev->dev, &dev_attr_set_brightness); device_remove_file(&hdev->dev, &dev_attr_test); device_remove_file(&hdev->dev, &dev_attr_device_type); hid_hw_stop(hdev); kfree(dev); dev_info(&intf->dev, "Razer Device disconnected\n"); }