hid-zydacron.c (bf61c8840efe60fd8f91446860b63338fb424158) hid-zydacron.c (abf832bfc349b54fd500f1e3b612f7f3cd9dfcc6)
1/*
2* HID driver for zydacron remote control
3*
4* Copyright (c) 2010 Don Prince <dhprince.devel@yahoo.co.uk>
5*/
6
7/*
8* This program is free software; you can redistribute it and/or modify it

--- 155 unchanged lines hidden (view full) ---

164 return ret;
165}
166
167static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id)
168{
169 int ret;
170 struct zc_device *zc;
171
1/*
2* HID driver for zydacron remote control
3*
4* Copyright (c) 2010 Don Prince <dhprince.devel@yahoo.co.uk>
5*/
6
7/*
8* This program is free software; you can redistribute it and/or modify it

--- 155 unchanged lines hidden (view full) ---

164 return ret;
165}
166
167static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id)
168{
169 int ret;
170 struct zc_device *zc;
171
172 zc = kzalloc(sizeof(*zc), GFP_KERNEL);
172 zc = devm_kzalloc(&hdev->dev, sizeof(*zc), GFP_KERNEL);
173 if (zc == NULL) {
174 hid_err(hdev, "can't alloc descriptor\n");
175 return -ENOMEM;
176 }
177
178 hid_set_drvdata(hdev, zc);
179
180 ret = hid_parse(hdev);
181 if (ret) {
182 hid_err(hdev, "parse failed\n");
173 if (zc == NULL) {
174 hid_err(hdev, "can't alloc descriptor\n");
175 return -ENOMEM;
176 }
177
178 hid_set_drvdata(hdev, zc);
179
180 ret = hid_parse(hdev);
181 if (ret) {
182 hid_err(hdev, "parse failed\n");
183 goto err_free;
183 return ret;
184 }
185
186 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
187 if (ret) {
188 hid_err(hdev, "hw start failed\n");
184 }
185
186 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
187 if (ret) {
188 hid_err(hdev, "hw start failed\n");
189 goto err_free;
189 return ret;
190 }
191
192 return 0;
190 }
191
192 return 0;
193err_free:
194 kfree(zc);
195
196 return ret;
197}
198
193}
194
199static void zc_remove(struct hid_device *hdev)
200{
201 struct zc_device *zc = hid_get_drvdata(hdev);
202
203 hid_hw_stop(hdev);
204 kfree(zc);
205}
206
207static const struct hid_device_id zc_devices[] = {
208 { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
209 { }
210};
211MODULE_DEVICE_TABLE(hid, zc_devices);
212
213static struct hid_driver zc_driver = {
214 .name = "zydacron",
215 .id_table = zc_devices,
216 .report_fixup = zc_report_fixup,
217 .input_mapping = zc_input_mapping,
218 .raw_event = zc_raw_event,
219 .probe = zc_probe,
195static const struct hid_device_id zc_devices[] = {
196 { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
197 { }
198};
199MODULE_DEVICE_TABLE(hid, zc_devices);
200
201static struct hid_driver zc_driver = {
202 .name = "zydacron",
203 .id_table = zc_devices,
204 .report_fixup = zc_report_fixup,
205 .input_mapping = zc_input_mapping,
206 .raw_event = zc_raw_event,
207 .probe = zc_probe,
220 .remove = zc_remove,
221};
222module_hid_driver(zc_driver);
223
224MODULE_LICENSE("GPL");
208};
209module_hid_driver(zc_driver);
210
211MODULE_LICENSE("GPL");