From 8f3fd89593377d15df88ad26dcf48318d8c9896f Mon Sep 17 00:00:00 2001 From: Enrico Weigelt Date: Mon, 24 Jun 2019 07:40:33 +0200 Subject: [PATCH] siox: Add helper macro to simplify driver registration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Acked-by: Uwe Kleine-König Signed-off-by: Linus Walleij --- include/linux/siox.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/siox.h b/include/linux/siox.h index d79624e83134..21d770078540 100644 --- a/include/linux/siox.h +++ b/include/linux/siox.h @@ -75,3 +75,13 @@ 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) -- 2.30.2