[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YDkpzZ8jL7O9HJuG@smile.fi.intel.com>
Date: Fri, 26 Feb 2021 19:03:09 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Mark Brown <broonie@...nel.org>,
Sudip Mukherjee <sudipm.mukherjee@...il.com>,
linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] parport: Introduce module_parport_driver() helper
macro
On Tue, Feb 16, 2021 at 01:07:39PM +0200, Andy Shevchenko wrote:
> Introduce module_parport_driver() helper macro to reduce boilerplate
> in the existing and new code.
Sudip, any comments on this?
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> v2: fixed typo in the macro
> include/linux/parport.h | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/parport.h b/include/linux/parport.h
> index 1fb508c19e83..54539b80021e 100644
> --- a/include/linux/parport.h
> +++ b/include/linux/parport.h
> @@ -301,9 +301,19 @@ int __must_check __parport_register_driver(struct parport_driver *,
> __parport_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
>
> /* Unregister a high-level driver. */
> -extern void parport_unregister_driver (struct parport_driver *);
> void parport_unregister_driver(struct parport_driver *);
>
> +/**
> + * module_parport_driver() - Helper macro for registering a modular parport driver
> + * @__parport_driver: struct parport_driver to be used
> + *
> + * Helper macro for parport drivers which do not do anything special in module
> + * init and 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_parport_driver(__parport_driver) \
> + module_driver(__parport_driver, parport_register_driver, parport_unregister_driver)
> +
> /* If parport_register_driver doesn't fit your needs, perhaps
> * parport_find_xxx does. */
> extern struct parport *parport_find_number (int);
> --
> 2.30.0
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists