diff mbox

[4/4] spi: introduce helper macro initcall_spi_driver()

Message ID 1380518035-5319-5-git-send-email-hanjun.guo@linaro.org
State New
Headers show

Commit Message

Hanjun Guo Sept. 30, 2013, 5:13 a.m. UTC
Introduce a helper macro initcall_spi_driver() which based on
initcall_driver() for spi driver to eliminate boilerplate code.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 include/linux/spi/spi.h |   11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox

Patch

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 887116d..8bf8690 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -221,6 +221,17 @@  static inline void spi_unregister_driver(struct spi_driver *sdrv)
 			spi_unregister_driver)
 
 /**
+ * initcall_spi_driver() - Helper macro for registering a SPI driver
+ * for buid-in module with doing nothing special in driver
+ * xxx_initcall/module_exit. This eliminates a lot of boilerplate.
+ * @__type: initcall type
+ * @__spi_driver: spi_driver struct
+ */
+#define initcall_spi_driver(__type, __spi_driver) \
+	initcall_driver(__type, __spi_driver, spi_register_driver, \
+			spi_unregister_driver)
+
+/**
  * struct spi_master - interface to SPI master controller
  * @dev: device interface to this driver
  * @list: link with the global spi_master list