All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/3] parport: Introduce module_parport_driver() helper macro
@ 2021-02-15 20:23 Andy Shevchenko
  2021-02-15 20:23 ` [PATCH v1 2/3] spi: butterfly: Switch to use module_parport_driver() Andy Shevchenko
  2021-02-15 20:23 ` [PATCH v1 3/3] spi: lm70llp: " Andy Shevchenko
  0 siblings, 2 replies; 9+ messages in thread
From: Andy Shevchenko @ 2021-02-15 20:23 UTC (permalink / raw)
  To: Andy Shevchenko, Mauro Carvalho Chehab, Sudip Mukherjee,
	linux-spi, linux-kernel
  Cc: Mark Brown

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>
---
 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 f981f794c850..af9b707d9b54 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -332,9 +332,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_add_driver, parport_del_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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-16  0:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 20:23 [PATCH v1 1/3] parport: Introduce module_parport_driver() helper macro Andy Shevchenko
2021-02-15 20:23 ` [PATCH v1 2/3] spi: butterfly: Switch to use module_parport_driver() Andy Shevchenko
2021-02-15 20:43   ` Mark Brown
2021-02-15 22:15   ` kernel test robot
2021-02-15 22:15     ` kernel test robot
2021-02-15 20:23 ` [PATCH v1 3/3] spi: lm70llp: " Andy Shevchenko
2021-02-15 20:43   ` Mark Brown
2021-02-16  0:03   ` kernel test robot
2021-02-16  0:03     ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.