From: Enrico Weigelt <[email protected]>
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 <[email protected]>
---
include/linux/siox.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/siox.h b/include/linux/siox.h
index a860cb8..da7225b 100644
--- a/include/linux/siox.h
+++ b/include/linux/siox.h
@@ -72,3 +72,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)
--
1.9.1
On Mon, Jun 24, 2019 at 07:40:33AM +0200, Enrico Weigelt, metux IT consult wrote:
> From: Enrico Weigelt <[email protected]>
>
> 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 <[email protected]>
Acked-by: Uwe Kleine-K?nig <[email protected]>
@Linus: Feel free to apply both patches via your gpio tree.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
On Mon, Jun 24, 2019 at 7:40 AM Enrico Weigelt, metux IT consult
<[email protected]> wrote:
> From: Enrico Weigelt <[email protected]>
>
> 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 <[email protected]>
Patch applied with Uwe's ACK.
Yours,
Linus Walleij
On 25.06.19 11:26, Linus Walleij wrote:
> On Mon, Jun 24, 2019 at 7:40 AM Enrico Weigelt, metux IT consult
> <[email protected]> wrote:
>
>> From: Enrico Weigelt <[email protected]>
>>
>> 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 <[email protected]>
>
> Patch applied with Uwe's ACK.
thanks to both of you :)
--mtx
--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287