From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Keith Busch <keith.busch@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-pci@vger.kernel.org
Subject: [PATCH 1/4] PCI / PCIe: Introduce module_pci_port_service()
Date: Mon, 6 Jun 2016 16:06:05 +0300 [thread overview]
Message-ID: <1465218368-36494-2-git-send-email-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <1465218368-36494-1-git-send-email-mika.westerberg@linux.intel.com>
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@linux.intel.com>
---
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
next prev parent reply other threads:[~2016-06-06 13:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-06 13:06 [PATCH 0/4] PCI / DPC: Few improvements Mika Westerberg
2016-06-06 13:06 ` Mika Westerberg [this message]
2016-06-06 13:06 ` [PATCH 2/4] PCI / DPC: Convert to use module_pcie_port_service() Mika Westerberg
2016-06-06 13:06 ` [PATCH 3/4] PCI / DPC: Convert the driver to use devm_* functions Mika Westerberg
2016-06-06 13:06 ` [PATCH 4/4] PCI / DPC: Fix whitespace in struct dpc_dev Mika Westerberg
2016-06-06 14:44 ` [PATCH 0/4] PCI / DPC: Few improvements Keith Busch
2016-06-17 9:57 ` Mika Westerberg
2016-06-21 18:57 ` Bjorn Helgaas
2016-06-22 10:09 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465218368-36494-2-git-send-email-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=keith.busch@intel.com \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).