From patchwork Sun Mar 18 12:58:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Mork?= X-Patchwork-Id: 10291123 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8B1F3600F6 for ; Sun, 18 Mar 2018 12:58:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B03C28A3F for ; Sun, 18 Mar 2018 12:58:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 700E528AC7; Sun, 18 Mar 2018 12:58:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACBA028A3F for ; Sun, 18 Mar 2018 12:58:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754379AbeCRM6T (ORCPT ); Sun, 18 Mar 2018 08:58:19 -0400 Received: from canardo.mork.no ([148.122.252.1]:46333 "EHLO canardo.mork.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754344AbeCRM6R (ORCPT ); Sun, 18 Mar 2018 08:58:17 -0400 Received: from miraculix.mork.no (miraculix.mork.no [IPv6:2001:4641:0:2:7627:374e:db74:e353]) (authenticated bits=0) by canardo.mork.no (8.15.2/8.15.2) with ESMTPSA id w2ICwEJU025990 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 18 Mar 2018 13:58:14 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1521377894; bh=1i/MFMhEQqFJoWQJfPWbcNrfdx6G7wsafcIB86ez7ww=; h=From:To:Cc:Subject:Date:Message-Id:From; b=GuHOYZmGFRCd0QZ14wEAJWuox1jOSZMrWp7fhtBFYlQgdZco6UO81Y62WAOVXS9GT kMW/CI36d9IVBlEt9vgrqAOxvkSTLyeT92lluzuLAyIkUJoG4ZhKGz9UZ+aZ1HGsL0 PeEZmj3TnDgE9RrZdVbnWnjjkliiaAym5CchZqy0= Received: from bjorn by miraculix.mork.no with local (Exim 4.89) (envelope-from ) id 1exXt7-0003E6-JV; Sun, 18 Mar 2018 13:58:13 +0100 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, =?UTF-8?q?Bj=C3=B8rn=20Mork?= Subject: [PATCH] PCI: always define the of_node helpers Date: Sun, 18 Mar 2018 13:58:06 +0100 Message-Id: <20180318125806.12364-1-bjorn@mork.no> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.3 at canardo X-Virus-Status: Clean Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simply move these inline functions outside the ifdef instead of duplicating them as stubs in the !OF case. The struct device of_node field does not depend on OF. This also fixes the missing stubbed pci_bus_to_OF_node(). Signed-off-by: Bjørn Mork --- I noticed this as a missing pci_bus_to_OF_node stub. But adding a stub which does pretty much the same as the real thing didn't make much sense to me. Same goes for the existing pci_device_to_OF_node stub, which is why I replace that too. include/linux/pci.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/include/linux/pci.h b/include/linux/pci.h index 024a1beda008..d0396da9160e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2182,24 +2182,11 @@ int pci_parse_request_of_pci_ranges(struct device *dev, /* Arch may override this (weak) */ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); -static inline struct device_node * -pci_device_to_OF_node(const struct pci_dev *pdev) -{ - return pdev ? pdev->dev.of_node : NULL; -} - -static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) -{ - return bus ? bus->dev.of_node : NULL; -} - #else /* CONFIG_OF */ static inline void pci_set_of_node(struct pci_dev *dev) { } static inline void pci_release_of_node(struct pci_dev *dev) { } static inline void pci_set_bus_of_node(struct pci_bus *bus) { } static inline void pci_release_bus_of_node(struct pci_bus *bus) { } -static inline struct device_node * -pci_device_to_OF_node(const struct pci_dev *pdev) { return NULL; } static inline struct irq_domain * pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; } static inline int pci_parse_request_of_pci_ranges(struct device *dev, @@ -2210,6 +2197,17 @@ static inline int pci_parse_request_of_pci_ranges(struct device *dev, } #endif /* CONFIG_OF */ +static inline struct device_node * +pci_device_to_OF_node(const struct pci_dev *pdev) +{ + return pdev ? pdev->dev.of_node : NULL; +} + +static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) +{ + return bus ? bus->dev.of_node : NULL; +} + #ifdef CONFIG_ACPI struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus);