]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mmc: sdio: Add helper macro for sdio_driver boilerplate
authorSean Wang <sean.wang@mediatek.com>
Wed, 13 Mar 2019 21:01:58 +0000 (05:01 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 23 Apr 2019 16:09:07 +0000 (18:09 +0200)
This patch introduces the module_sdio_driver macro which is a convenience
macro for SDIO driver modules similar to module_usb_driver. It is intended
to be used by drivers which init/exit section does nothing but register/
unregister the SDIO driver. By using this macro it is possible to eliminate
a few lines of boilerplate code per SDIO driver.

Suggested-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/linux/mmc/sdio_func.h

index 97ca105347a6c5e608297ae1a3562925dc6f6834..5685805533b57c172f57efd423a223c90ee03991 100644 (file)
@@ -111,6 +111,18 @@ struct sdio_driver {
 extern int sdio_register_driver(struct sdio_driver *);
 extern void sdio_unregister_driver(struct sdio_driver *);
 
+/**
+ * module_sdio_driver() - Helper macro for registering a SDIO driver
+ * @__sdio_driver: sdio_driver struct
+ *
+ * Helper macro for SDIO 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_sdio_driver(__sdio_driver) \
+       module_driver(__sdio_driver, sdio_register_driver, \
+                     sdio_unregister_driver)
+
 /*
  * SDIO I/O operations
  */