HID: introduce helper for hid_driver boilerplate
PATCH 1/3 HID: introduce helper for hid_driver boilerplate
Introduce the module_hid_driver macro which is a convenience macro for HID driver modules similar to module_usb_driver. It is intended to be used by drivers with init/exit sections that do nothing but register/unregister the HID driver.
Signed-off-by H Hartley Sweeten <[email protected]>
Cc Jiri Kosina <[email protected]>
--- include/linux/hid.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/linux/hid.h +12 -0
@@ -700,6 +700,18 @@ extern int __must_check __hid_register_driver(struct hid_driver *,extern void hid_unregister_driver (struct hid_driver *); +/** +* module_hid_driver() - Helper macro for registering a HID driver +* @__hid_driver: hid_driver struct +* +* Helper macro for HID drivers which do not do anything special in module +* init/exit. This eliminates a lot of boilerplate. Each module may only +* use this macro once, and calling it replaces module_init() and module_exit() +*/ +#define module_hid_driver (__hid_driver) \ + module_driver(__hid_driver, hid_register_driver, \ + hid_unregister_driver) +extern void hidinput_hid_event (struct hid_device *,struct hid_field *,struct hid_usage *,__s32 );extern void hidinput_report_event (struct hid_device *hid,struct hid_report *report);extern int hidinput_connect (struct hid_device *hid,unsigned int force);
Signature · 1 line
1.8.0.2
Jiri Kosina
AppliedQuoted 24 lines · H Hartley Sweeten
Introduce the
module_hid_drivermacro which is a convenience macro for HID driver modules similar tomodule_usb_driver. It is intended to be used by drivers with init/exit sections that do nothing but register/unregister the HID driver.Signed-off-by H Hartley Sweeten <[email protected]>Cc Jiri Kosina <[email protected]>--- include/linux/hid.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)include/linux/hid.h +5
-0@@ -700,6 +700,18 @@ extern int __must_check __hid_register_driver(struct hid_driver *,extern void hid_unregister_driver (struct hid_driver *); +/** +* module_hid_driver() - Helper macro for registering a HID driver +* @__hid_driver: hid_driver struct +* +* Helper macro for HID drivers which do not do anything special in module
include/linux/hid.h extern int __must_check __hid_register_driver(struct hid_driver *, · line 717
Quoted 10 lines
include/linux/hid.h +7
-0+* init/exit. This eliminates a lot of boilerplate. Each module may only +* use this macro once, and calling it replaces module_init() and module_exit() +*/ +#define module_hid_driver (__hid_driver) \ + module_driver(__hid_driver, hid_register_driver, \ + hid_unregister_driver) +extern void hidinput_hid_event (struct hid_device *,struct hid_field *,struct hid_usage *,__s32 );extern void hidinput_report_event (struct hid_device *hid,struct hid_report *report);extern int hidinput_connect (struct hid_device *hid,unsigned int force);
Applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs