From patchwork Fri Jul 21 21:09:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9857689 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 5101860393 for ; Fri, 21 Jul 2017 21:10:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4440328678 for ; Fri, 21 Jul 2017 21:10:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38EB328684; Fri, 21 Jul 2017 21:10:29 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 B9CA328678 for ; Fri, 21 Jul 2017 21:10:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509AbdGUVK1 (ORCPT ); Fri, 21 Jul 2017 17:10:27 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:58267 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752091AbdGUVK0 (ORCPT ); Fri, 21 Jul 2017 17:10:26 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lk8aY-1e9dpN48Ec-00c5Uu; Fri, 21 Jul 2017 23:10:08 +0200 From: Arnd Bergmann To: Rob Herring , Frank Rowand Cc: Arnd Bergmann , Bjorn Helgaas , Magnus Damm , Geert Uytterhoeven , Ben Dooks , linux-pci@vger.kernel.org, linux-sh@vger.kernel.org, Sakari Ailus , Kieran Bingham , Geert Uytterhoeven , Mika Westerberg , Sudeep Holla , Richard Fitzgerald , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] of: provide of_n_{addr, size}_cells wrappers for !CONFIG_OF Date: Fri, 21 Jul 2017 23:09:50 +0200 Message-Id: <20170721211000.3382004-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:1LhXtUPTYmakQIONxrnpyShWdC7dU5cjVFTlBpQHizx1OQ3h6Wn OhDMhrpXilBCuSCF6VEBlBckLNNPqr7zCYWtEBBIq7CNanpqTXu3hNovv5ztHQJFm2pYQOh cWFVFaQWEsE1Mi7v7C+nbaoDgCUCjEpk1qXKbYvC/5Ics8ccpOtr8Vnggt24ZJYP2LxkzAv RnlO6LOVVrX1FOXw3Yh3g== X-UI-Out-Filterresults: notjunk:1; V01:K0:Kut1zLLvQTM=:g/P6HJBbSZyC2du85NjZ8/ b7sCFcwvVEHDaRRZCBPQ6dHXxgL1hspArlQc5nV6mwEnwfsJ4ADWZ0qYt+Q24wqd379fb7Oxz HXkQFjFTCfyC6vHdFS5BguyWmp9g+DxNIA1OXpWC1xnA9fGFua/L6oUnbHApjjXhnPolnwxst XIdNxn6ZZ5dEbYVFwpI+VG5K/5+bq1nmQp8A6SYaheXIY1W9l1m/dUPdaxpXfG2UeroUfTA7l Kj/LY3jkPE/KKyhS9dkUopdWhmdETZL+3xaHYmu8vtI6QbzVkDXA2l3QydJesvb+2ZqyqyB+Z +Qh2TBnt50r+75Cz7JOgEsaUh9iHSfMG8O2AFC0fR+3sFKCUHP6RQvuNSSj0BMYkNcyACA3Jb E0Ma4gPW6EbTgZWCZSjubxRo2kLzAW1ekgJlPqF8/aNFTJNdVfPGP2hoWB0dzuTVeG7ggXn9J O6qAxuYcnwlGah9NTZJKleLTF0P2RvKFlTBOhUuwkGLnWL37QiDxA09C7CeiTWkjmNk9LtD/m 7KhnnawPB01J5FtK+KcwVKP4kHLk0eGPoWtIb9uAeQZzcqNk5Mf6NB+jkRDwEMSK1aPaJxJ2K jx4blQyWqP0NJlCSzUnkwzDEAem8LRPbcVa2D8tzmSsnXrGIt56u0Np57emRdprJBg+7HHwUw gUrzdg4bgtqqjFT91xC9wb+WlD+N4AQLUs9/PiKJsxOmcymcCPxhZ4m3gQmgfoAc7UfKKGF6B YhSh+VcO8TT+uUsC0H6LE3UoZ7GZsIOPih6O0A== 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 The pci-rcar driver is enabled for compile tests, and this has shown that the driver cannot build without CONFIG_OF: drivers/pci/host/pcie-rcar.c: In function 'pci_dma_range_parser_init': drivers/pci/host/pcie-rcar.c:1039:2: error: implicit declaration of function 'of_n_addr_cells' [-Werror=implicit-function-declaration] parser->pna = of_n_addr_cells(node); ^ As pointed out by Ben Dooks and Geert Uytterhoeven, this is actually supposed to build fine, which we can achieve if we make the declaration of of_irq_parse_and_map_pci conditional on CONFIG_OF and provide an empty inline function otherwise, as we do for a lot of other of interfaces. This lets us build the rcar_pci driver again without CONFIG_OF for build testing. All platforms using this driver select OF, so this doesn't change anything for the users. Cc: Bjorn Helgaas Cc: Magnus Damm Cc: Geert Uytterhoeven Cc: Ben Dooks Cc: linux-pci@vger.kernel.org Cc: linux-sh@vger.kernel.org Acked-by: Geert Uytterhoeven Reviewed-by: Frank Rowand Fixes: c25da4778803 ("PCI: rcar: Add Renesas R-Car PCIe driver") Signed-off-by: Arnd Bergmann --- I originally sent the patch in 2014 when things initially broke and then forgot about while it was applied in my randconfig patch stack. I sent it again in 2016 without reply. It's still broken and I think this is the correct fix. v2: modify changelog as Geert suggested. include/linux/of.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/of.h b/include/linux/of.h index 4a8a70916237..1efdbe53136c 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -735,6 +735,9 @@ static inline struct device_node *of_get_cpu_node(int cpu, return NULL; } +static inline int of_n_addr_cells(struct device_node *np) { return 0; } +static inline int of_n_size_cells(struct device_node *np) { return 0; } + static inline int of_property_read_u64(const struct device_node *np, const char *propname, u64 *out_value) {