From patchwork Mon Jun 6 13:06:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 9158117 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ABD4C60573 for ; Mon, 6 Jun 2016 13:06:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E24A2654B for ; Mon, 6 Jun 2016 13:06:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93071281AA; Mon, 6 Jun 2016 13:06:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22D0A2654B for ; Mon, 6 Jun 2016 13:06:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752018AbcFFNGs (ORCPT ); Mon, 6 Jun 2016 09:06:48 -0400 Received: from mga02.intel.com ([134.134.136.20]:22354 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751901AbcFFNGr (ORCPT ); Mon, 6 Jun 2016 09:06:47 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 06 Jun 2016 06:06:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,427,1459839600"; d="scan'208";a="991934967" Received: from black.fi.intel.com ([10.237.72.93]) by orsmga002.jf.intel.com with ESMTP; 06 Jun 2016 06:06:10 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 466A593; Mon, 6 Jun 2016 16:06:08 +0300 (EEST) From: Mika Westerberg To: Bjorn Helgaas Cc: Keith Busch , Mika Westerberg , 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 Message-Id: <1465218368-36494-2-git-send-email-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1465218368-36494-1-git-send-email-mika.westerberg@linux.intel.com> References: <1465218368-36494-1-git-send-email-mika.westerberg@linux.intel.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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_ */