From patchwork Fri Apr 10 22:54:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 6200231 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 54A5DBF4A6 for ; Fri, 10 Apr 2015 22:54:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59B55202A1 for ; Fri, 10 Apr 2015 22:54:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A25A20265 for ; Fri, 10 Apr 2015 22:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753741AbbDJWyg (ORCPT ); Fri, 10 Apr 2015 18:54:36 -0400 Received: from mail-ig0-f179.google.com ([209.85.213.179]:38635 "EHLO mail-ig0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756440AbbDJWyf (ORCPT ); Fri, 10 Apr 2015 18:54:35 -0400 Received: by igbqf9 with SMTP id qf9so9442400igb.1 for ; Fri, 10 Apr 2015 15:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=W7haW78PQDknx9YQ5WzlEc97lkSK2xKknyag45/BivQ=; b=BFU1wj98FW0ZDLZeOux7IERrRSRnk9HebpQhYZ9WjTGQhJkY0KTFnGOmEmtKqZoWTf r3Mq8HTpJHuyY77Zb+UG7phT1u6SnmYaZgL4PjkFiKo1+FWm4imKlouEkdJo+VlwCGee welqMhkJR5BsdTlclyoaLGproihkRmqaBgyu4UVoRHOtE1sbTfjiRzxXY6kJtlW9+LY9 5vpr9Fb4luzk7d+IFRRzXXoE/Shsa3w66BfuM4woA8QI8ONC2+rlHO1aRCRBcYeHXpkH tMxIeGOw7CZc0Pa5X0VoXhWkWKIh81S2gSGP/Xg1n+U7Pgo/pWfruuyJkNB2XYR5IRJP /Gmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=W7haW78PQDknx9YQ5WzlEc97lkSK2xKknyag45/BivQ=; b=V3OgBaVgOOBGIUeL/D+HDHUAfGl3JjHIwcPmlIvjGarHYZVWl8yjWKKbptFc5TYJS0 4kvWjvV9iotbq+u97CaZskJQ4B/ZEx+wvKnOc3ucbuFuG6Qsb99aLCXw9jn/Bgw47I/r DYutGMYKXWwJe01PPxgkV7l4S788kaVpmfw8np4vgTpF+yQUeto9VxoEpWAhZf8EHM/c HcbXt7/mfKhgGGOKFMsiTzRyrV5IAgE+vpqc6nuF+BSl7wYqT4v45uoFgn8nXmdJ9EOW mQ8r8lVpRs65kb5XK/L18gzOJO4pgwluC/7xyi9Wr/tIGx+jyZ+RCY/F1LZwRyVxy+IH o6MA== X-Gm-Message-State: ALoCoQlGRr5lf+WI4e8O2E5GhXBHaCiwSNiROm8PMw8FzGk+apmEFk0/qaR+oQJm4lM2k3BUdFeI X-Received: by 10.107.153.129 with SMTP id b123mr5863947ioe.63.1428706474956; Fri, 10 Apr 2015 15:54:34 -0700 (PDT) Received: from localhost ([69.71.1.1]) by mx.google.com with ESMTPSA id x9sm694334igl.2.2015.04.10.15.54.34 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 10 Apr 2015 15:54:34 -0700 (PDT) Subject: [PATCH v6 02/10] PCI/MSI: Export pci_msi_set_enable(), pci_msix_clear_and_set_ctrl() To: "Michael S. Tsirkin" From: Bjorn Helgaas Cc: Fam Zheng , linux-pci@vger.kernel.org, stable@vger.kernel.org, "Eric W. Biederman" , Yijing Wang , Yinghai Lu Date: Fri, 10 Apr 2015 17:54:33 -0500 Message-ID: <20150410225433.20848.65505.stgit@bhelgaas-glaptop2.roam.corp.google.com> In-Reply-To: <20150410223533.20848.95316.stgit@bhelgaas-glaptop2.roam.corp.google.com> References: <20150410223533.20848.95316.stgit@bhelgaas-glaptop2.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_HI,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: Michael S. Tsirkin Move pci_msi_set_enable() and pci_msix_clear_and_set_ctrl() to drivers/pci/pci.h so they're available even when MSI isn't configured into the kernel. No functional change. [bhelgaas: changelog, split into separate patch] Signed-off-by: Michael S. Tsirkin Signed-off-by: Bjorn Helgaas Reviewed-by: Fam Zheng CC: stable@vger.kernel.org --- drivers/pci/msi.c | 21 --------------------- drivers/pci/pci.h | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 6cd366058ec4..9942f6827a4a 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -185,27 +185,6 @@ void __weak arch_restore_msi_irqs(struct pci_dev *dev) return default_restore_msi_irqs(dev); } -static void pci_msi_set_enable(struct pci_dev *dev, int enable) -{ - u16 control; - - pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); - control &= ~PCI_MSI_FLAGS_ENABLE; - if (enable) - control |= PCI_MSI_FLAGS_ENABLE; - pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); -} - -static void pci_msix_clear_and_set_ctrl(struct pci_dev *dev, u16 clear, u16 set) -{ - u16 ctrl; - - pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl); - ctrl &= ~clear; - ctrl |= set; - pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, ctrl); -} - static inline __attribute_const__ u32 msi_mask(unsigned x) { /* Don't shift by >= width of type */ diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 4091f82239cd..17f213d494de 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -146,6 +146,27 @@ static inline void pci_no_msi(void) { } static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } #endif +static inline void pci_msi_set_enable(struct pci_dev *dev, int enable) +{ + u16 control; + + pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); + control &= ~PCI_MSI_FLAGS_ENABLE; + if (enable) + control |= PCI_MSI_FLAGS_ENABLE; + pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); +} + +static inline void pci_msix_clear_and_set_ctrl(struct pci_dev *dev, u16 clear, u16 set) +{ + u16 ctrl; + + pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl); + ctrl &= ~clear; + ctrl |= set; + pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, ctrl); +} + void pci_realloc_get_opt(char *); static inline int pci_no_d1d2(struct pci_dev *dev)