Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp784097pxb; Fri, 3 Sep 2021 13:25:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVGeK5Xw18KqQH/5TuBo7sdCyGSPWQ6sKQ98lzl1HU3UlAexTaT+c87APw6Jz2daXtA3+O X-Received: by 2002:a17:906:ce3a:: with SMTP id sd26mr664170ejb.227.1630700750188; Fri, 03 Sep 2021 13:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630700750; cv=none; d=google.com; s=arc-20160816; b=nKUOloclKO71XjJWVPpdmsjNeoQKUkkich+Q49pJHCuh2skAmfwHduc1ettFk6Hg+l LBNjFKbusAevu/5XCcby/t9UT9bO+Q4NicRX3wsjyPTGk4z+L7ZlZhW/JkrhfVl++btD +27jfg7c+rCu48ovVgYhKhOKpAmPJNS/Nh0k4qsdgK2NuRsGhDrUzbKupvyGPqtNlcfU sIndACWeLNswTj6Bevfst8d5m7c3UU7nOCU8xhWnqxuNs5FqFGyTcD6fe7nrCckLMsC4 MWiWH5M7QhltTSnnF9SB/mtyVjO1+5yFbi6XnvHQmUIl2cVBRxGK/vj7T8ckCrg7wN4K 1oHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yflInFI1ZzPQSDRilX9q5vY6M4ANYOf3X9tuAFnKZ94=; b=FTbwTtw1wE25RmrD1CbXx31z49z3TOMt5MmuZ2yMvZJrWzJG1vSh18JHEL209GGdX2 9+I8o6sFt4vvID3dFZdfZmjD2CzCx5CrcDduCX4NzvxnjIlyHad3H5DteqRzlGw5aeaK kBVQedUju9X6Ab7Rofmu4pfewdtGOKb66DF0E6jqORYJyZFPkuGsPwtVCmUWi9NCHNdm W6tW37UNJHWYjY/WcADzjQorALNM7jT+qQqsCDpi5iRf/E0/M77rSHpRQlzKAw53YZH8 hxfvgdCHssxHor17uU8PRSoJWKM64Zp7jL3xAVE2wIdL9edszNAr0QKNTKpWQ1ctyw7A SE4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rtOHcC7f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs22si280021ejc.85.2021.09.03.13.25.12; Fri, 03 Sep 2021 13:25:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rtOHcC7f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350383AbhICUYF (ORCPT + 99 others); Fri, 3 Sep 2021 16:24:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:47412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350304AbhICUYE (ORCPT ); Fri, 3 Sep 2021 16:24:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3550461058; Fri, 3 Sep 2021 20:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630700584; bh=w9uFvdy+MMe6lxlbi846nB1abNsuFlQkvxXg31gdmDU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rtOHcC7f+T3YkzmyytyucTKMwmisGPXw6k3cKdSQnV6rVIWJcsRi6KXVwN3WYfzua 1K/HvRCSF7Yc14UL5Ze++HAsOTI/iQRKPmiO+vNO4o83J2nyevKgcz1kXSCH+7bJwR EhSDgwqtAfRJ8jl3PSKKoG3p7B4J1B088sfmciUlJ/G/rJ9DzDEE6JhQfnnMn5eUUs wbysxpl+twACy4TAwF/vVU3RxufxVzE7KubEwvBvJCiIqTN2LyRLXI6C11oPqK9lM6 PzhiMXDasRtwhr/DZ5UZFLcyWp0G+DHzGauLV/kCUd2sicFC16rQEjC1MqrcIeUjJQ kj7rS47nXEdAQ== Received: by mail-ej1-f44.google.com with SMTP id i21so436463ejd.2; Fri, 03 Sep 2021 13:23:04 -0700 (PDT) X-Gm-Message-State: AOAM532aV7PCriadFkY86sZeUcp9JixA7Fc1wNRuoshLhD3ban05KpbD PTe7aJtmCiVaJwoluIhTvrrepr3ucv8I6xCoUg== X-Received: by 2002:a17:906:7217:: with SMTP id m23mr696026ejk.466.1630700582768; Fri, 03 Sep 2021 13:23:02 -0700 (PDT) MIME-Version: 1.0 References: <20210902092704.2678277-1-zhang.lyra@gmail.com> In-Reply-To: <20210902092704.2678277-1-zhang.lyra@gmail.com> From: Rob Herring Date: Fri, 3 Sep 2021 15:22:51 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] of: fix of_address_to_resource and of_iomap undefined To: Chunyan Zhang Cc: Frank Rowand , devicetree@vger.kernel.org, Chunyan Zhang , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 2, 2021 at 4:27 AM Chunyan Zhang wrote: > > From: Chunyan Zhang > > If CONFIG_OF is selected, but CONFIG_OF_ADDRESS is not, when compiling > files (sunch as timer_of.c) in which the function of_iomap() is invoked, > compiler would report 'undefined reference to of_iomap', the same case > is for of_address_to_resource(). What arch and config are you building? > This patch also makes sure that of_iomap() and of_address_to_resource() > are declared for sparc so that sparc can have its specific > implementations in arch/sparc/kernel/of_device_common.c, even if > including include/linux/of_address.h in it. > > Signed-off-by: Chunyan Zhang > --- > include/linux/of_address.h | 33 +++++++++++++++++---------------- > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/include/linux/of_address.h b/include/linux/of_address.h > index 45598dbec269..02a719d58466 100644 > --- a/include/linux/of_address.h > +++ b/include/linux/of_address.h > @@ -80,6 +80,23 @@ static inline u64 of_translate_address(struct device_node *np, > return OF_BAD_ADDR; > } > > +#ifdef CONFIG_SPARC > +extern int of_address_to_resource(struct device_node *dev, int index, > + struct resource *r); > +void __iomem *of_iomap(struct device_node *device, int index); This is now in the !CONFIG_OF_ADDRESS section. So for CONFIG_OF_ADDRESS, we'd never have a function declaration. This change does not look right at all to me. > +#else > +static inline int of_address_to_resource(struct device_node *dev, int index, > + struct resource *r) > +{ > + return -EINVAL; > +} > + > +static inline void __iomem *of_iomap(struct device_node *device, int index) > +{ > + return NULL; > +} > +#endif > + > static inline const __be32 *__of_get_address(struct device_node *dev, int index, int bar_no, > u64 *size, unsigned int *flags) > { > @@ -124,22 +141,6 @@ static inline bool of_dma_is_coherent(struct device_node *np) > } > #endif /* CONFIG_OF_ADDRESS */ > > -#ifdef CONFIG_OF > -extern int of_address_to_resource(struct device_node *dev, int index, > - struct resource *r); > -void __iomem *of_iomap(struct device_node *node, int index); > -#else > -static inline int of_address_to_resource(struct device_node *dev, int index, > - struct resource *r) > -{ > - return -EINVAL; > -} > - > -static inline void __iomem *of_iomap(struct device_node *device, int index) > -{ > - return NULL; > -} > -#endif > #define of_range_parser_init of_pci_range_parser_init > > static inline const __be32 *of_get_address(struct device_node *dev, int index, > -- > 2.25.1 >