backports: add module_spi_driver
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 15 Jun 2013 10:19:57 +0000 (12:19 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Wed, 19 Jun 2013 20:22:28 +0000 (22:22 +0200)
module_spi_driver was added in the following commit to mainline:
commit 3acbb0142d48713a8f65cde678a54f419801c189
Author: Lars-Peter Clausen <lars@metafoo.de>
Date:   Wed Nov 16 10:13:37 2011 +0100

    SPI: Add helper macro for spi_driver boilerplate

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
backport/backport-include/linux/spi/spi.h [new file with mode: 0644]

diff --git a/backport/backport-include/linux/spi/spi.h b/backport/backport-include/linux/spi/spi.h
new file mode 100644 (file)
index 0000000..672cf5b
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef _BACKPORTS_LINUX_SPI_H
+#define _BACKPORTS_LINUX_SPI_H 1
+
+#include_next <linux/spi/spi.h>
+
+#ifndef module_spi_driver
+/**
+ * module_spi_driver() - Helper macro for registering a SPI driver
+ * @__spi_driver: spi_driver struct
+ *
+ * Helper macro for SPI 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_spi_driver(__spi_driver) \
+       module_driver(__spi_driver, spi_register_driver, \
+                       spi_unregister_driver)
+#endif
+
+#endif /* _BACKPORTS_LINUX_SPI_H */