aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-core.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-05-16 05:49:16 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:48 -0400
commitc500c9714011edab021591340042787722db9cf0 (patch)
treed6bb0fe483c9f1c71c3d757e9c13d261ca01cd5f /drivers/hid/hid-core.c
parent85cdaf524b7ddab627e7d15405693f2511ef7505 (diff)
HID: hid, make parsing event driven
Next step for complete hid bus, this patch includes: - call parser either from probe or from hid-core if there is no probe. - add ll_driver structure and centralize some stuff there (open, close...) - split and merge usb_hid_configure and hid_probe into several functions to allow hooks/fixes between them Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r--drivers/hid/hid-core.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 017fc20167d4..3dacbcd7e41c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -648,6 +648,9 @@ int hid_parse_report(struct hid_device *device, __u8 *start,
648 hid_parser_reserved 648 hid_parser_reserved
649 }; 649 };
650 650
651 if (device->driver->report_fixup)
652 device->driver->report_fixup(device, start, size);
653
651 device->rdesc = kmalloc(size, GFP_KERNEL); 654 device->rdesc = kmalloc(size, GFP_KERNEL);
652 if (device->rdesc == NULL) 655 if (device->rdesc == NULL)
653 return -ENOMEM; 656 return -ENOMEM;
@@ -1152,15 +1155,20 @@ static int hid_device_probe(struct device *dev)
1152 int ret = 0; 1155 int ret = 0;
1153 1156
1154 if (!hdev->driver) { 1157 if (!hdev->driver) {
1155 if (hdrv->probe) { 1158 id = hid_match_id(hdev, hdrv->id_table);
1156 ret = -ENODEV; 1159 if (id == NULL)
1160 return -ENODEV;
1157 1161
1158 id = hid_match_id(hdev, hdrv->id_table); 1162 hdev->driver = hdrv;
1159 if (id) 1163 if (hdrv->probe) {
1160 ret = hdrv->probe(hdev, id); 1164 ret = hdrv->probe(hdev, id);
1165 } else { /* default probe */
1166 ret = hid_parse(hdev);
1167 if (!ret)
1168 ret = hid_hw_start(hdev);
1161 } 1169 }
1162 if (!ret) 1170 if (ret)
1163 hdev->driver = hdrv; 1171 hdev->driver = NULL;
1164 } 1172 }
1165 return ret; 1173 return ret;
1166} 1174}
@@ -1173,6 +1181,8 @@ static int hid_device_remove(struct device *dev)
1173 if (hdrv) { 1181 if (hdrv) {
1174 if (hdrv->remove) 1182 if (hdrv->remove)
1175 hdrv->remove(hdev); 1183 hdrv->remove(hdev);
1184 else /* default remove */
1185 hid_hw_stop(hdev);
1176 hdev->driver = NULL; 1186 hdev->driver = NULL;
1177 } 1187 }
1178 1188