[PATCH 1/4] PCI / PCIe: Introduce module_pci_port_service()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As used elsewhere in the kernel already. This will reduce amount of
boilerblate code PCIe port service drivers otherwise need to open-code.

Signed-off-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
---
 include/linux/pcieport_if.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index afcd130ab3a9..9276a85bffde 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -67,4 +67,17 @@ struct pcie_port_service_driver {
 int pcie_port_service_register(struct pcie_port_service_driver *new);
 void pcie_port_service_unregister(struct pcie_port_service_driver *new);
 
+/**
+ * module_pcie_port_service() - Helper macro for registering a PCI driver
+ * @__port_service: pcie_port_service struct
+ *
+ * Helper macro for PCIe port service 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_pcie_port_service(__port_service) \
+	module_driver(__port_service, pcie_port_service_register, \
+		      pcie_port_service_unregister)
+
 #endif /* _PCIEPORT_IF_H_ */
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux