[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1426538797-28131-2-git-send-email-peterhuewe@gmx.de>
Date: Mon, 16 Mar 2015 21:46:30 +0100
From: Peter Huewe <peterhuewe@....de>
To: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Cc: linux-kernel@...r.kernel.org, Peter Huewe <peterhuewe@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Greg Kroah-Hartman <gregkh@...e.de>
Subject: [PATCH 1/8] pnp: Add helper macro for pnp_register_driver boilerplate
This patch introduces the module_pnp_driver macro which is a
convenience macro for PNP driver modules similar to module_pci_driver.
It is intended to be used by drivers which init/exit section does nothing
but register/unregister the PNP driver. By using this macro it is
possible to eliminate a few lines of boilerplate code per PNP driver.
Based on work done by Lars-Peter Clausen <lars@...afoo.de> for other
busses (i2c and spi) and Greg KH for PCI.
Cc: Lars-Peter Clausen <lars@...afoo.de>
Cc: Greg Kroah-Hartman <gregkh@...e.de>
Signed-off-by: Peter Huewe <peterhuewe@....de>
---
include/linux/pnp.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 6512e9cbc6d5..5df733b8f704 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -510,4 +510,16 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
#endif /* CONFIG_PNP */
+/**
+ * module_pnp_driver() - Helper macro for registering a PnP driver
+ * @__pnp_driver: pnp_driver struct
+ *
+ * Helper macro for PnP 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_pnp_driver(__pnp_driver) \
+ module_driver(__pnp_driver, pnp_register_driver, \
+ pnp_unregister_driver)
+
#endif /* _LINUX_PNP_H */
--
2.0.5
--
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