Message ID | 20210216110741.1286-1-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 9c9b536e1ee94558f1ae5ed8d13b76295b2dfef4 |
Headers | show |
Series | [v2,1/3] parport: Introduce module_parport_driver() helper macro | expand |
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@linux.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 >
Hi Andy, On Fri, Feb 26, 2021 at 07:03:09PM +0200, Andy Shevchenko wrote: > 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? Sorry for the delay in reply. lgtm. I think there are few more drivers which can also use this new helper. Will you like to do them also? Acked-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> -- Regards Sudip
On Sun, Feb 28, 2021 at 11:27:10PM +0000, Sudip Mukherjee wrote: > On Fri, Feb 26, 2021 at 07:03:09PM +0200, Andy Shevchenko wrote: > > 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? > > Sorry for the delay in reply. > lgtm. I think there are few more drivers which can also use this new helper. > Will you like to do them also? Yes, that's the (slow going) plan. > Acked-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Thanks! I considered that you take it thru parport tree. Do you have something else in mind?
On Mon, Mar 1, 2021 at 12:12 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > On Sun, Feb 28, 2021 at 11:27:10PM +0000, Sudip Mukherjee wrote: > > On Fri, Feb 26, 2021 at 07:03:09PM +0200, Andy Shevchenko wrote: > > > 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? > > > > Sorry for the delay in reply. > > lgtm. I think there are few more drivers which can also use this new helper. > > Will you like to do them also? > > Yes, that's the (slow going) plan. > > > Acked-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> > > Thanks! I considered that you take it thru parport tree. Do you have something > else in mind? I dont have a separate parport tree (parport is not under active development to have a separate tree). I send everything parport related to Greg and then he adds it to his tree. I guess in this case if Greg agrees it can go via Mark's tree as the series will also have SPI related patches. -- Regards Sudip
On Tue, Mar 02, 2021 at 02:51:45PM +0000, Sudip Mukherjee wrote: > On Mon, Mar 1, 2021 at 12:12 PM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > > > On Sun, Feb 28, 2021 at 11:27:10PM +0000, Sudip Mukherjee wrote: > > > On Fri, Feb 26, 2021 at 07:03:09PM +0200, Andy Shevchenko wrote: > > > > 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? > > > > > > Sorry for the delay in reply. > > > lgtm. I think there are few more drivers which can also use this new helper. > > > Will you like to do them also? > > > > Yes, that's the (slow going) plan. > > > > > Acked-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> > > > > Thanks! I considered that you take it thru parport tree. Do you have something > > else in mind? > > I dont have a separate parport tree (parport is not under active > development to have a separate tree). I send everything parport > related to Greg and then he adds it to his tree. MAINTAINERS doesn't show this. But good to know. > I guess in this case if Greg agrees it can go via Mark's tree as the > series will also have SPI related patches. Okay, if Greg wants to handle this himself, I think I have to resend (he wasn't in the Cc list). Otherwise Mark can also apply this if Greg is okay (but sounds like I have to resend anyway to let him understand what's going on here).
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);
Introduce module_parport_driver() helper macro to reduce boilerplate in the existing and new code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- v2: fixed typo in the macro include/linux/parport.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)