From patchwork Wed Oct 15 03:06:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 38755 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B83420973 for ; Wed, 15 Oct 2014 02:33:39 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id b13sf146552wgh.4 for ; Tue, 14 Oct 2014 19:33:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=qba7S23YurZ/no8NAjz7n+8py83L6e5Y2nvZNZ5vfto=; b=NyArBQNPeHD9DdEeZWoHlLRbsb1N9XKnqhRfiW1iaaPo6zm7hfiJGz1LTs2toviCq9 /VO804wWt+9U56ZT5L4nW2IypVLLJqvee3q6uL9Kbh6BolLGme5ezCGo/+AfD10kq8tY biLAdvWl0VLnauwd+YHlC9z5SgIQiNr50O+j9WWZISe0V+K298FCwB8Hmi9Kvxp/JsRg /zZqwIKBct+QeFMbLc4sjZrtn8YcTRxlzpYHauYR6UllUv8GKCm8LPY29y67oVcP+p35 //rps17pthse79iAj5J4Pr3z8b4RNoMMV863jhAgVwtb6O2BGqui2csHsn5sYEEv/tFa gbQg== X-Gm-Message-State: ALoCoQnQFxP3Rmh5J84UmolXmYtJOOBz6vfqkrT/Pm9wAaDuWzGudD1X+G7sXCM/zp9ys+WZW/nD X-Received: by 10.180.96.101 with SMTP id dr5mr1591752wib.0.1413340418673; Tue, 14 Oct 2014 19:33:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.132 with SMTP id c4ls7575lac.88.gmail; Tue, 14 Oct 2014 19:33:38 -0700 (PDT) X-Received: by 10.153.4.44 with SMTP id cb12mr9441300lad.10.1413340417982; Tue, 14 Oct 2014 19:33:37 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com [209.85.217.176]) by mx.google.com with ESMTPS id nb4si28725522lbb.35.2014.10.14.19.33.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 19:33:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so258206lbv.7 for ; Tue, 14 Oct 2014 19:33:37 -0700 (PDT) X-Received: by 10.112.94.133 with SMTP id dc5mr9148615lbb.11.1413340417891; Tue, 14 Oct 2014 19:33:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp517875lbz; Tue, 14 Oct 2014 19:33:37 -0700 (PDT) X-Received: by 10.66.66.136 with SMTP id f8mr8861061pat.55.1413340416041; Tue, 14 Oct 2014 19:33:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lp3si14479658pab.230.2014.10.14.19.33.34 for ; Tue, 14 Oct 2014 19:33:36 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756134AbaJOCdc (ORCPT + 27 others); Tue, 14 Oct 2014 22:33:32 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:39319 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932685AbaJOCZu (ORCPT ); Tue, 14 Oct 2014 22:25:50 -0400 Received: from 172.24.2.119 (EHLO szxeml412-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CAT35366; Wed, 15 Oct 2014 10:25:37 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml412-hub.china.huawei.com (10.82.67.91) with Microsoft SMTP Server id 14.3.158.1; Wed, 15 Oct 2014 10:25:30 +0800 From: Yijing Wang To: Bjorn Helgaas CC: , , Xinwei Hu , Wuyun , , Russell King , , , , , Arnd Bergmann , Thomas Gleixner , "Konrad Rzeszutek Wilk" , , Joerg Roedel , , , Benjamin Herrenschmidt , , , Sebastian Ott , "Tony Luck" , , "David S. Miller" , , Chris Metcalf , Ralf Baechle , Lucas Stach , David Vrabel , "Sergei Shtylyov" , Michael Ellerman , Thierry Reding , "Thomas Petazzoni" , Liviu Dudau , Yijing Wang Subject: [PATCH v3 11/27] PCI/MSI: Refactor struct msi_chip to make it become more common Date: Wed, 15 Oct 2014 11:06:59 +0800 Message-ID: <1413342435-7876-12-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1413342435-7876-1-git-send-email-wangyijing@huawei.com> References: <1413342435-7876-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangyijing@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Now there are a lot of __weak arch functions in MSI code. These functions make MSI driver complex. Thierry introduced MSI chip framework to configure MSI/MSI-X irq in arm. Use MSI chip framework to refactor all other platform MSI code to eliminate weak arch MSI functions. This patch add .restore_irqs(), .teardown_irqs() and .setup_irqs() to make it become more common. Signed-off-by: Yijing Wang Reviewed-by: Lucas Stach --- drivers/pci/msi.c | 15 +++++++++++++++ include/linux/msi.h | 4 ++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 56e54ad..5cbd774 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -61,6 +61,11 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) { struct msi_desc *entry; int ret; + struct msi_chip *chip; + + chip = pci_msi_chip(dev->bus); + if (chip && chip->setup_irqs) + return chip->setup_irqs(chip, dev, nvec, type); /* * If an architecture wants to support multiple MSI, it needs to @@ -103,6 +108,11 @@ void default_teardown_msi_irqs(struct pci_dev *dev) void __weak arch_teardown_msi_irqs(struct pci_dev *dev) { + struct msi_chip *chip = pci_msi_chip(dev->bus); + + if (chip && chip->teardown_irqs) + return chip->teardown_irqs(chip, dev); + return default_teardown_msi_irqs(dev); } @@ -126,6 +136,11 @@ static void default_restore_msi_irq(struct pci_dev *dev, int irq) void __weak arch_restore_msi_irqs(struct pci_dev *dev) { + struct msi_chip *chip = pci_msi_chip(dev->bus); + + if (chip && chip->restore_irqs) + return chip->restore_irqs(chip, dev); + return default_restore_msi_irqs(dev); } diff --git a/include/linux/msi.h b/include/linux/msi.h index 175aa21..eb5ae36 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -74,7 +74,11 @@ struct msi_chip { int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev, struct msi_desc *desc); + int (*setup_irqs)(struct msi_chip *chip, struct pci_dev *dev, + int nvec, int type); void (*teardown_irq)(struct msi_chip *chip, unsigned int irq); + void (*teardown_irqs)(struct msi_chip *chip, struct pci_dev *dev); + void (*restore_irqs)(struct msi_chip *chip, struct pci_dev *dev); }; #endif /* LINUX_MSI_H */