Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754776AbdGUUVF (ORCPT ); Fri, 21 Jul 2017 16:21:05 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:56500 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752811AbdGUUVC (ORCPT ); Fri, 21 Jul 2017 16:21:02 -0400 From: Arnd Bergmann To: Rob Herring , Frank Rowand Cc: Arnd Bergmann , devicetree@vger.kernel.org, Grant Likely , Lucas Stach , Bjorn Helgaas , Magnus Damm , Geert Uytterhoeven , Ben Dooks , linux-pci@vger.kernel.org, linux-sh@vger.kernel.org, Sakari Ailus , Sudeep Holla , "Rafael J. Wysocki" , Kieran Bingham , Alan Tull , Geert Uytterhoeven , Richard Fitzgerald , linux-kernel@vger.kernel.org Subject: [PATCH] of: provide of_n_{addr,size}_cells wrappers for !CONFIG_OF Date: Fri, 21 Jul 2017 22:19:58 +0200 Message-Id: <20170721202012.3360244-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:m0AJDlvFNFN5S4BekrJw8eDPuyfvl15Y0rRnJQ4yczpYbEMBgUn 1Qufo223VM4mMtoHCoYeKgtAI5UTwPU09G5oRzcvznk1k+D6GzkKtk/UO2EGAU/jFvWYGLy crEkM/O4NYMNJHYi1BLAAjrnT3AHHPADhzvn6PV3d5/Zoxeq+UYmpL1Mwtr12Hy4PTi6w+s +qzRMD7bvFNG2RIfMMs2g== X-UI-Out-Filterresults: notjunk:1;V01:K0:uJJeMPH9gU8=:WqFQnLZta3m6Xnj+Eb6S0m KC6g1yw03rx4zi5p4oTbrAlgXk5K1yK0F+UpL7cR3hB3Asem0BkU0GCEr1gVu7t4M87/iBQeb podkhQGFczuRdewW0DBXLeZJ/F2bXmF5NvwGx3jRDylfjzxDnPuFWpGMxi+P/FcMKHsqd0DtG cKTBF3RwHPDHMLBMhUGdQs5SwGAYQWB3XaqTtBsLxMQN84txW/N6OEi7B1Y1quv9yszPGm/fo C/P4FG2DXkj0UzvJeBFwtdrhSuwRNUmAf3JrueftjRZzIjPbRsxIsPP4uT9nXKlbfPiCoDWME NBwT/fo4DuJAxJRmyIEF5fIcSC6mlqOgo5xtZPx+76ymHDHi9q6Fz5zMJcIw3mXpMkIEH880I 5eFTkoCjOg/H6S2RVZ65THP7jT/OiwXXl05AMAiaSikKppGXF/9+hsxXQEQFL1z1xd3mhdayt 6DLHEDKfiQnR6yOKhExN6RuNydoOZS9lLAvcdZXpbdLolFmojwoGWmYXT1si2vZIbe99kGvCo 1XbbO01rHJUglcCljVvhvHGRdvtP2Ks3M51nMcTew6Pnr6H3Gvi2RqSS8iiY8QdDx/hVTOcrM fUD6SCo66Kpouak/fB4Fx5wkYuSe0v7vhe60OMJVrs154AnM9NCBvs1BdNrAZBXm/V5+ICNR1 4PuJs2oscnk2307Mazn94u4FVCBVKFUMTGNJOpWSLo10GnkZ3OE6RfhXGafs72W7l5tXiDF+d spYwLR0cJC/Zy5AH2AbmDtmWY9hmuR+Q/amGbg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2180 Lines: 57 The pci-rcar driver is enabled for compile tests, and this has now shown that the driver cannot build without CONFIG_OF, following the inclusion of f8f2fe7355fb "PCI: rcar: Use new OF interrupt mapping when possible": ../drivers/pci/host/pcie-rcar.c: In function 'pci_dma_range_parser_init': ../drivers/pci/host/pcie-rcar.c:856: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. Signed-off-by: Arnd Bergmann Cc: devicetree@vger.kernel.org Cc: Rob Herring Cc: Grant Likely Cc: Lucas Stach Cc: Bjorn Helgaas Cc: Magnus Damm Cc: Geert Uytterhoeven Cc: Ben Dooks Cc: linux-pci@vger.kernel.org Cc: linux-sh@vger.kernel.org --- 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 replay. It's still broken and I think this is the correct fix. --- 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) { -- 2.9.0