Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753062AbaJ0MmH (ORCPT ); Mon, 27 Oct 2014 08:42:07 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:28071 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752570AbaJ0Mlm (ORCPT ); Mon, 27 Oct 2014 08:41:42 -0400 From: Yijing Wang To: Bjorn Helgaas CC: , , Xinwei Hu , Wuyun , , Russell King , , 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" , Yijing Wang Subject: [PATCH 01/16] PCI/MSI: Refactor MSI controller to make it become more common Date: Mon, 27 Oct 2014 21:22:07 +0800 Message-ID: <1414416142-31239-2-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1414416142-31239-1-git-send-email-wangyijing@huawei.com> References: <1414416142-31239-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now there are a lot of weak arch MSI functions in MSI code. These functions make MSI driver complex. Because people need to know much which arch MSI function should be overrode and which is not. Thierry introduced MSI chip framework to configure MSI/MSI-X irq in arm. MSI chip framework is better than raw arch MSI functions, people can clearly know they should implement which MSI ops in specific platform. 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 | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 27b6a54..0e1da3e 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -70,6 +70,11 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) { struct msi_desc *entry; int ret; + struct msi_controller *ctrl; + + ctrl = pci_msi_controller(dev->bus); + if (ctrl && ctrl->setup_irqs) + return ctrl->setup_irqs(ctrl, dev, nvec, type); /* * If an architecture wants to support multiple MSI, it needs to @@ -112,6 +117,11 @@ void default_teardown_msi_irqs(struct pci_dev *dev) void __weak arch_teardown_msi_irqs(struct pci_dev *dev) { + struct msi_controller *ctrl = pci_msi_controller(dev->bus); + + if (ctrl && ctrl->teardown_irqs) + return ctrl->teardown_irqs(ctrl, dev); + return default_teardown_msi_irqs(dev); } @@ -135,6 +145,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_controller *ctrl = pci_msi_controller(dev->bus); + + if (ctrl && ctrl->restore_irqs) + return ctrl->restore_irqs(ctrl, dev); + return default_restore_msi_irqs(dev); } diff --git a/include/linux/msi.h b/include/linux/msi.h index 6704991..4426cb4 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -71,9 +71,13 @@ struct msi_controller { struct device_node *of_node; struct list_head list; - int (*setup_irq)(struct msi_controller *chip, struct pci_dev *dev, + int (*setup_irq)(struct msi_controller *ctrl, struct pci_dev *dev, struct msi_desc *desc); - void (*teardown_irq)(struct msi_controller *chip, unsigned int irq); + int (*setup_irqs)(struct msi_controller *ctrl, struct pci_dev *dev, + int nvec, int type); + void (*teardown_irq)(struct msi_controller *ctrl, unsigned int irq); + void (*teardown_irqs)(struct msi_controller *ctrl, struct pci_dev *dev); + void (*restore_irqs)(struct msi_controller *ctrl, struct pci_dev *dev); }; #endif /* LINUX_MSI_H */ -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/