From patchwork Wed Mar 27 08:56:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 2348611 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A85443FD40 for ; Wed, 27 Mar 2013 08:56:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753515Ab3C0I4P (ORCPT ); Wed, 27 Mar 2013 04:56:15 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:44488 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754447Ab3C0I4O (ORCPT ); Wed, 27 Mar 2013 04:56:14 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Mar 2013 02:56:13 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 27 Mar 2013 02:56:11 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 595223E4003E for ; Wed, 27 Mar 2013 02:55:59 -0600 (MDT) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2R8uAUx125406 for ; Wed, 27 Mar 2013 02:56:10 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2R8u9hw012663 for ; Wed, 27 Mar 2013 02:56:09 -0600 Received: from shangw (shangw.cn.ibm.com [9.125.213.106]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id r2R8u7IA012574; Wed, 27 Mar 2013 02:56:07 -0600 Received: by shangw (Postfix, from userid 1000) id 7F8573021DA; Wed, 27 Mar 2013 16:56:06 +0800 (CST) From: Gavin Shan To: linux-pci@vger.kernel.org Cc: bhelgaas@google.com, Gavin Shan Subject: [PATCH 3/4] PCI: Allow msix_capability_init() take MSIX cap struct Date: Wed, 27 Mar 2013 16:56:03 +0800 Message-Id: <1364374564-19096-4-git-send-email-shangw@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1364374564-19096-1-git-send-email-shangw@linux.vnet.ibm.com> References: <1364374564-19096-1-git-send-email-shangw@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13032708-3620-0000-0000-000001CA1680 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The patch introduces additional parameter to msix_capability_init() so that we can pass the address of MSI-X capability structure to the function. Signed-off-by: Gavin Shan --- drivers/pci/msi.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 7ba9461..a20cb0a 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -674,19 +674,20 @@ static void msix_program_entries(struct pci_dev *dev, * @dev: pointer to the pci_dev data structure of MSI-X device function * @entries: pointer to an array of struct msix_entry entries * @nvec: number of @entries + * @pos: address of MSI-X capability structure * * Setup the MSI-X capability structure of device function with a * single MSI-X irq. A return of zero indicates the successful setup of * requested MSI-X entries with allocated irqs or non-zero for otherwise. **/ static int msix_capability_init(struct pci_dev *dev, - struct msix_entry *entries, int nvec) + struct msix_entry *entries, + int nvec, int pos) { - int pos, ret; + int ret; u16 control; void __iomem *base; - pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control); /* Ensure MSI-X is disabled while it is set up */ @@ -980,7 +981,8 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) "(MSI IRQ already assigned)\n"); return -EINVAL; } - status = msix_capability_init(dev, entries, nvec); + + status = msix_capability_init(dev, entries, nvec, pos); return status; } EXPORT_SYMBOL(pci_enable_msix);