From patchwork Sun May 31 11:55:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 6515801 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1D427C0020 for ; Sun, 31 May 2015 11:58:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3BC90204E7 for ; Sun, 31 May 2015 11:58:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 52FD5204D2 for ; Sun, 31 May 2015 11:58:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yz1qe-00029B-UY; Sun, 31 May 2015 11:56:12 +0000 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yz1qK-0001zi-9H for linux-arm-kernel@lists.infradead.org; Sun, 31 May 2015 11:55:53 +0000 Received: by wibut5 with SMTP id ut5so16259674wib.1 for ; Sun, 31 May 2015 04:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XHOxy9bAtTsI46jZaokmMpITs1BkhzFOEEdk5FF6AoE=; b=sjtXz0QpG2dJ0x29rcEc1hf7Aa4RB1sysfpOW926gODlAyQlsQ11oscAQj4iVjskqj uu5fHyQhTY0ckfX5lueJifKsHad2HdAlOVemDBFknU10RbF7fD99CC0t3zKFfWOYz9A7 gD8Fnxm9SZp0fEuSZkJhDO04yJu4HAScdSdaCJRhlYI0q9QyotybIQbbdlc2z7Ib2aCL a5uwYxsuIvTzUvoSTit6TnSoU8o8oK+7DtUWcaiKEdjiV1qceuLgSEwGxZ5qEb/ejvAU TTBkLp92U0qGjJHMmk72Jd/XU59+fANBCoQtJVGYXnTt5VQLoiZmPmlEs7T3EWwOpEAk 0EIg== X-Received: by 10.180.85.42 with SMTP id e10mr11543825wiz.17.1433073329362; Sun, 31 May 2015 04:55:29 -0700 (PDT) Received: from rric.localhost (f053086201.adsl.alicedsl.de. [78.53.86.201]) by mx.google.com with ESMTPSA id n3sm12283995wix.1.2015.05.31.04.55.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 31 May 2015 04:55:28 -0700 (PDT) From: Robert Richter To: Tejun Heo Subject: [PATCH v4 1/3] ahci: Move interrupt enablement code to a separate function Date: Sun, 31 May 2015 13:55:17 +0200 Message-Id: <1433073319-13796-2-git-send-email-rric@kernel.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1433073319-13796-1-git-send-email-rric@kernel.org> References: <1433073319-13796-1-git-send-email-rric@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150531_045552_494087_831A2BB1 X-CRM114-Status: GOOD ( 13.54 ) X-Spam-Score: -0.7 (/) Cc: linux-kernel@vger.kernel.org, Robert Richter , linux-ide@vger.kernel.org, Sunil Goutham , Jiang Liu , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Robert Richter This patch refactors ahci_init_interrupts() and moves msi code to a separate function. Need the split since we add msix initialization in a later patch. The initialization for msix will be done after msi but before intx. Signed-off-by: Robert Richter --- drivers/ata/ahci.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index c7a92a743ed0..7ba5332476c6 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1201,17 +1201,17 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host) {} #endif -static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, - struct ahci_host_priv *hpriv) +static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports, + struct ahci_host_priv *hpriv) { int rc, nvec; if (hpriv->flags & AHCI_HFLAG_NO_MSI) - goto intx; + return -ENODEV; nvec = pci_msi_vec_count(pdev); if (nvec < 0) - goto intx; + return nvec; /* * If number of MSIs is less than number of ports then Sharing Last @@ -1224,8 +1224,8 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, rc = pci_enable_msi_exact(pdev, nvec); if (rc == -ENOSPC) goto single_msi; - else if (rc < 0) - goto intx; + if (rc < 0) + return rc; /* fallback to single MSI mode if the controller enforced MRSM mode */ if (readl(hpriv->mmio + HOST_CTL) & HOST_MRSM) { @@ -1240,12 +1240,25 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, return nvec; single_msi: - if (pci_enable_msi(pdev)) - goto intx; + rc = pci_enable_msi(pdev); + if (rc < 0) + return rc; + return 1; +} -intx: +static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, + struct ahci_host_priv *hpriv) +{ + int nvec; + + nvec = ahci_init_msi(pdev, n_ports, hpriv); + if (nvec >= 0) + return nvec; + + /* lagacy intx interrupts */ pci_intx(pdev, 1); + return 0; }