Received: by 10.192.165.148 with SMTP id m20csp1624356imm; Sat, 5 May 2018 17:31:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrQ8YofcoIWWuXA6otxSggdlQKW7RtABqz6y56ioxE6RZ01htdZPuzKD/CZf3rtBb2UBNla X-Received: by 2002:a17:902:1aa:: with SMTP id b39-v6mr33234954plb.120.1525566686356; Sat, 05 May 2018 17:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525566686; cv=none; d=google.com; s=arc-20160816; b=WiH6fHuah2flSWVC5hrvoCNtVaE9KPrmsDjHh2wUoWpaNypBT7y74Ej+CR2vlZzXWJ H1PsiLG1179I8LA2FDtvU1daVKLhFVJWnqVp4coSMx/kptebn+EVxFh2su5YZRoWkTwU azt/gw/yEo9CX8HSI7tYJf8HS7pKyb4qgyvjmOA+vNFiN2xgx2diHNXuQQk9QDElhDX7 Ogzbk+XP41xvg8aqWLgWzCSb3OT4j84D78zvyh3u9tN5tubp1srAaITx9E8H5xcWvQft S96NSQM2SNV5yDqHNGxJUmL/WZQ8xOf/DKrA96K7PPjStLq2u+SHTME27i+USOrrXhtD fvxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=SjDclrEDL9Iu04gmCE30jeY1Qbt9fTR2CstvGaBHBnA=; b=xH61DqGv5YEmNvgue3EYERGLpn6j7x5rrp+DJMJ+DnrV1yUPyNVNBC6jCDx1n0wLpI 8KzuNngaPSKEf871jKlbrY15Nc2vNo7AWKUaz/XMLKQRDnL26u9IBpSK+kyOX2TVRuJS ZxrFQirQnYtsEb+/ki/9LXBahhVVJTldzN/TMTXJcPi3OwUWZLEh2ssfFwfj0BVhEau0 QCPN5dB0rtKAgSZ9rWAjwW/LayNE6yGC0CaKp3xFfl7LbKZD7deO1l2dltF3VIGtgh98 NdpUEMng0pC7R23aqRzf5fhgxKQSNcUh0U0L7ON1JSnoS2CO1sJf2/pvM1k1iQrVvDmD RbfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si19451992pli.427.2018.05.05.17.31.12; Sat, 05 May 2018 17:31:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751977AbeEFAar (ORCPT + 99 others); Sat, 5 May 2018 20:30:47 -0400 Received: from mga02.intel.com ([134.134.136.20]:58221 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751952AbeEFAan (ORCPT ); Sat, 5 May 2018 20:30:43 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2018 17:30:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,367,1520924400"; d="scan'208";a="226149324" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by fmsmga006.fm.intel.com with ESMTP; 05 May 2018 17:30:40 -0700 From: changbin.du@intel.com To: yamada.masahiro@socionext.com, michal.lkml@markovi.net, tglx@linutronix.de, mingo@redhat.com, akpm@linux-foundation.org Cc: rostedt@goodmis.org, rdunlap@infradead.org, x86@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, arnd@arndb.de, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Changbin Du Subject: [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node Date: Sun, 6 May 2018 08:20:13 +0800 Message-Id: <1525566016-30172-3-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525566016-30172-1-git-send-email-changbin.du@intel.com> References: <1525566016-30172-1-git-send-email-changbin.du@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Changbin Du If device tree is not enabled, of_find_regulator_by_node() should have a dummy function since the function call is still there. This is to fix build error after CONFIG_NO_AUTO_INLINE is introduced. If this option is enabled, GCC will not auto-inline functions that are not explicitly marked as inline. In this case (no CONFIG_OF), the copmiler will report error in function regulator_dev_lookup(). W/O NO_AUTO_INLINE, function of_get_regulator() is auto-inlined and then the call to of_find_regulator_by_node() is optimized out since of_get_regulator() always return NULL. W/ NO_AUTO_INLINE, the return value of of_get_regulator() is a variable so the call to of_find_regulator_by_node() cannot be optimized out. So we need a stub of_find_regulator_by_node(). static struct regulator_dev *regulator_dev_lookup(struct device *dev, const char *supply) { struct regulator_dev *r = NULL; struct device_node *node; struct regulator_map *map; const char *devname = NULL; regulator_supply_alias(&dev, &supply); /* first do a dt based lookup */ if (dev && dev->of_node) { node = of_get_regulator(dev, supply); if (node) { r = of_find_regulator_by_node(node); if (r) return r; ... Signed-off-by: Changbin Du --- drivers/regulator/internal.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h index abfd56e..24fde1e 100644 --- a/drivers/regulator/internal.h +++ b/drivers/regulator/internal.h @@ -56,14 +56,19 @@ static inline struct regulator_dev *dev_to_rdev(struct device *dev) return container_of(dev, struct regulator_dev, dev); } -struct regulator_dev *of_find_regulator_by_node(struct device_node *np); - #ifdef CONFIG_OF +struct regulator_dev *of_find_regulator_by_node(struct device_node *np); struct regulator_init_data *regulator_of_get_init_data(struct device *dev, const struct regulator_desc *desc, struct regulator_config *config, struct device_node **node); #else +static inline struct regulator_dev * +of_find_regulator_by_node(struct device_node *np) +{ + return NULL; +} + static inline struct regulator_init_data * regulator_of_get_init_data(struct device *dev, const struct regulator_desc *desc, -- 2.7.4