summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/comedidev.h
diff options
context:
space:
mode:
authorH Hartley Sweeten <hartleys@visionengravers.com>2012-05-02 00:20:04 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-02 22:55:24 (GMT)
commit204162572ff4a679a47c68a5d5b3ac2bcba3830e (patch)
tree55316da470056d5a2839af565d7eb1ef1eec0ccd /drivers/staging/comedi/comedidev.h
parente8ccc11fbd32d26884943ea2001c3dea6c7ea14a (diff)
downloadlinux-fsl-qoriq-204162572ff4a679a47c68a5d5b3ac2bcba3830e.tar.xz
staging: comedi: Add helper macro for comedi_driver boilerplate
Introduce the module_comedi_driver macro which is a convenience macro for comedi driver modules similar to module_platform_driver. It is intended to be used by drivers where the init/exit section does nothing but register/unregister the comedi driver. By using this macro it is possible to eliminate a few lines of boilerplate code per comedi driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r--drivers/staging/comedi/comedidev.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index 02e4ae0..8828609 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -298,6 +298,18 @@ int comedi_device_attach(struct comedi_device *dev,
int comedi_driver_register(struct comedi_driver *);
int comedi_driver_unregister(struct comedi_driver *);
+/**
+ * module_comedi_driver() - Helper macro for registering a comedi driver
+ * @__comedi_driver: comedi_driver struct
+ *
+ * Helper macro for comedi 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_comedi_driver(__comedi_driver) \
+ module_driver(__comedi_driver, comedi_driver_register, \
+ comedi_driver_unregister)
+
void init_polling(void);
void cleanup_polling(void);
void start_polling(struct comedi_device *);