static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) { int ret, i; struct mt_device *td; struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ for (i = 0; mt_classes[i].name ; i++) { if (id->driver_data == mt_classes[i].name) { mtclass = &(mt_classes[i]); break; } } #ifdef MT_DBG if (trace) printk(KERN_ERR "hid-multitouch: class=%d\n", mtclass->name); #endif /* MT_DBG */ /* This allows the driver to correctly support devices * that emit events over several HID messages. */ hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); if (!td) { dev_err(&hdev->dev, "cannot allocate multitouch data\n"); return -ENOMEM; } td->mtclass = mtclass; td->inputmode = -1; hid_set_drvdata(hdev, td); ret = hid_parse(hdev); if (ret != 0) goto fail; ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (ret) goto fail; td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), GFP_KERNEL); mt_set_input_mode(hdev); return 0; fail: kfree(td); return ret; }
static int mt_reset_resume(struct hid_device *hdev) { mt_set_input_mode(hdev); return 0; }