mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] HID: introduce helper for hid_driver boilerplate
@ 2012-12-17 22:26 H Hartley Sweeten
  2013-01-03  9:33 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: H Hartley Sweeten @ 2012-12-17 22:26 UTC (permalink / raw)
  To: Linux Kernel; +Cc: jkosina, hsweeten

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 <hsweeten@visionengravers.com>
Cc: Jiri Kosina <jkosina@suse.cz>
---
 include/linux/hid.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index 7330a0f..d6c71a6 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -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);
-- 
1.8.0.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/3] HID: introduce helper for hid_driver boilerplate
  2012-12-17 22:26 [PATCH 1/3] HID: introduce helper for hid_driver boilerplate H Hartley Sweeten
@ 2013-01-03  9:33 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2013-01-03  9:33 UTC (permalink / raw)
  To: H Hartley Sweeten; +Cc: Linux Kernel, hsweeten

On Mon, 17 Dec 2012, H Hartley Sweeten wrote:

> 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 <hsweeten@visionengravers.com>
> Cc: Jiri Kosina <jkosina@suse.cz>
> ---
>  include/linux/hid.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index 7330a0f..d6c71a6 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -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);

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-03  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-17 22:26 [PATCH 1/3] HID: introduce helper for hid_driver boilerplate H Hartley Sweeten
2013-01-03  9:33 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®