LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Du, Changbin" <changbin.du@intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: changbin.du@intel.com, yamada.masahiro@socionext.com,
	michal.lkml@markovi.net, tglx@linutronix.de, mingo@redhat.com,
	akpm@linux-foundation.org, x86@kernel.org, lgirdwood@gmail.com,
	arnd@arndb.de, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH 2/5] regulator: add dummy of_find_regulator_by_node
Date: Wed, 2 May 2018 17:24:09 +0800	[thread overview]
Message-ID: <20180502092409.ymjoykektm5kxgfc@intel.com> (raw)
In-Reply-To: <20180501204033.GB2714@sirena.org.uk>

On Wed, May 02, 2018 at 05:40:36AM +0900, Mark Brown wrote:
> On Tue, May 01, 2018 at 09:00:11PM +0800, changbin.du@intel.com wrote:
> > From: Changbin Du <changbin.du@intel.com>
> > 
> > If device tree is not enabled, of_find_regulator_by_node() should have
> > a dummy function since the function call is still there.
> > 
> > Signed-off-by: Changbin Du <changbin.du@intel.com>
> 
> This appears to have no obvious connection with the cover letter for the
> series...  The first question here is if this is something best fixed
> with a stub or by fixing the users - is the lack of a stub pointing out
> some bugs in them?  I'm a bit worried about how we've been managing to
> avoid any build test issues here though, surely the various builders
> would have spotted a problem?

This is to fix build error after 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 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.

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;
	....

It is safe we just provide a stub of_find_regulator_by_node() if no CONFIG_OF.

-- 
Thanks,
Changbin Du

  reply	other threads:[~2018-05-02  9:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 13:00 [PATCH 0/5] kernel hacking: GCC optimization for debug experience (-Og) changbin.du
2018-05-01 13:00 ` [PATCH 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif changbin.du
2018-05-01 13:00 ` [PATCH 2/5] regulator: add dummy of_find_regulator_by_node changbin.du
2018-05-01 20:40   ` Mark Brown
2018-05-02  9:24     ` Du, Changbin [this message]
2018-05-05  1:44   ` Applied "regulator: add dummy function of_find_regulator_by_node" to the regulator tree Mark Brown
2018-05-01 13:00 ` [PATCH 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler atuo-inline optimizations changbin.du
2018-05-01 14:54   ` Steven Rostedt
2018-05-02  9:27     ` Du, Changbin
2018-05-01 13:00 ` [PATCH 4/5] kernel hacking: new config DEBUG_EXPERIENCE to apply GCC -Og optimization changbin.du
2018-05-01 15:25   ` Randy Dunlap
2018-05-02  9:24     ` Du, Changbin
2018-05-02 20:30   ` Arnd Bergmann
2018-05-01 13:00 ` [PATCH 5/5] asm-generic: fix build error in fix_to_virt with CONFIG_DEBUG_EXPERIENCE changbin.du
2018-05-02  7:33 ` [PATCH 0/5] kernel hacking: GCC optimization for debug experience (-Og) Ingo Molnar
2018-05-02  9:07   ` Du, Changbin
2018-05-02 11:09     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180502092409.ymjoykektm5kxgfc@intel.com \
    --to=changbin.du@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    --subject='Re: [PATCH 2/5] regulator: add dummy of_find_regulator_by_node' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).