[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50B550C0.80506@synaptics.com>
Date: Tue, 27 Nov 2012 15:46:08 -0800
From: Christopher Heiny <cheiny@...aptics.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
CC: Linus Walleij <linus.walleij@...ricsson.com>,
Linux Input <linux-input@...r.kernel.org>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Allie Xiong <axiong@...aptics.com>,
Vivian Ly <vly@...aptics.com>,
Daniel Rosenberg <daniel.rosenberg@...aptics.com>,
Alexandra Chin <alexandra.chin@...synaptics.com>,
Joerie de Gram <j.de.gram@...il.com>,
Wolfram Sang <w.sang@...gutronix.de>,
Mathieu Poirier <mathieu.poirier@...aro.org>
Subject: Re: [PATCH 4/4] Input: RMI4 - introduce rmi_module_driver() macro
On 11/27/2012 01:21 AM, Dmitry Torokhov wrote:
> This also allows us to cut down on the boilerplate code in the function
> handler modules.
I like this idea a lot. We'll adopt it.
Thanks!
Chris
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
> drivers/input/rmi4/rmi_f11.c | 13 +------------
> include/linux/rmi.h | 14 ++++++++++++++
> 2 files changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
> index dbb6060..8457ab4 100644
> --- a/drivers/input/rmi4/rmi_f11.c
> +++ b/drivers/input/rmi4/rmi_f11.c
> @@ -2756,18 +2756,7 @@ static struct rmi_function_handler rmi_f11_handler = {
> #endif /* defined(CONFIG_HAS_EARLYSUSPEND) */
> };
>
> -static int __init rmi_f11_module_init(void)
> -{
> - return rmi_register_function_handler(&rmi_f11_handler);
> -}
> -
> -static void __exit rmi_f11_module_exit(void)
> -{
> - rmi_unregister_function_handler(&rmi_f11_handler);
> -}
> -
> -module_init(rmi_f11_module_init);
> -module_exit(rmi_f11_module_exit);
> +module_rmi_driver(rmi_f11_handler);
>
> MODULE_AUTHOR("Christopher Heiny <cheiny@...aptics.com");
> MODULE_DESCRIPTION("RMI F11 module");
> diff --git a/include/linux/rmi.h b/include/linux/rmi.h
> index 8a74066..daca41b 100644
> --- a/include/linux/rmi.h
> +++ b/include/linux/rmi.h
> @@ -600,4 +600,18 @@ int rmi_register_phys_device(struct rmi_phys_device *phys);
> void rmi_unregister_phys_device(struct rmi_phys_device *phys);
> int rmi_for_each_dev(void *data, int (*func)(struct device *dev, void *data));
>
> +/**
> + * module_serio_driver() - Helper macro for registering a serio driver
> + * @__serio_driver: serio_driver struct
> + *
> + * Helper macro for serio 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_rmi_driver(__rmi_driver) \
> + module_driver(__rmi_driver, \
> + rmi_register_function_handler, \
> + rmi_unregister_function_handler)
> +
> #endif
>
--
Christopher Heiny
Senior Staff Firmware Engineer
Synaptics Incorporated
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists