[1/2] include: linux: siox: more for declaring siox drivers
diff mbox series

Message ID 1560795688-10496-1-git-send-email-info@metux.net
State New
Headers show
Series
  • [1/2] include: linux: siox: more for declaring siox drivers
Related show

Commit Message

Enrico Weigelt, metux IT consult June 17, 2019, 6:21 p.m. UTC
From: Enrico Weigelt <info@metux.net>

Add more helper macros for trivial driver init cases, similar to the
already existing module_platform_driver or module_i2c_driver().

This helps to reduce driver init boilerplate.

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 include/linux/siox.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Uwe Kleine-K├Ânig June 18, 2019, 5:54 a.m. UTC | #1
On Mon, Jun 17, 2019 at 08:21:27PM +0200, Enrico Weigelt, metux IT consult wrote:
> From: Enrico Weigelt <info@metux.net>
> 
> Add more helper macros for trivial driver init cases, similar to the
> already existing module_platform_driver or module_i2c_driver().

Inconsistent use of () after macro names.

Other than that (and my remark for patch 2) I'm ok with this series.
Usually Greg (on Cc:) merges siox stuff, but I don't expect anything to
happen which conflicts with this series so I think it's fine if both
patches go in via the gpio tree.

> +
> +/* module_siox_driver() - Helper macro for drivers that don't do
> + * anything special in module init/exit.  This eliminates a lot of
> + * boilerplate.  Each module may only use this macro once, and

Given there is only one siox driver in the tree, "a lot" seems bold, but
I don't mind it.

> + * calling it replaces module_init() and module_exit()
> + */
> +#define module_siox_driver(__siox_driver) \
> +	module_driver(__siox_driver, siox_driver_register, \
> +			siox_driver_unregister)

Best regards
Uwe

Patch
diff mbox series

diff --git a/include/linux/siox.h b/include/linux/siox.h
index d79624e..d53b2b2 100644
--- a/include/linux/siox.h
+++ b/include/linux/siox.h
@@ -75,3 +75,12 @@  static inline void siox_driver_unregister(struct siox_driver *sdriver)
 {
 	return driver_unregister(&sdriver->driver);
 }
+
+/* module_siox_driver() - Helper macro for drivers that don't 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_siox_driver(__siox_driver) \
+	module_driver(__siox_driver, siox_driver_register, \
+			siox_driver_unregister)