[U-Boot] [PATCH] dm: check OF_LIVE is enabled
Simon Glass
sjg at chromium.org
Tue Mar 19 01:23:04 UTC 2019
Hi Ibai,
On Tue, 12 Mar 2019 at 15:19, Ibai Erkiaga Elorza <IBAIE at xilinx.com> wrote:
>
> Hi Simon,
>
> > -----Original Message-----
> > From: Simon Glass <sjg at chromium.org>
> > Sent: 10 March 2019 21:51
> > To: Ibai Erkiaga Elorza <IBAIE at xilinx.com>
> > Cc: U-Boot Mailing List <u-boot at lists.denx.de>; Patrick Delaunay
> > <patrick.delaunay at st.com>; Andy Shevchenko
> > <andriy.shevchenko at linux.intel.com>; Bin Meng <bmeng.cn at gmail.com>;
> > Patrice Chotard <patrice.chotard at st.com>
> > Subject: Re: [U-Boot][PATCH] dm: check OF_LIVE is enabled
> >
> > Hi Ibai,
> >
> > On Tue, 26 Feb 2019 at 02:26, Ibai Erkiaga <ibai.erkiaga-elorza at xilinx.com>
> > wrote:
> > >
> > > Livetree implemented functions does not have conditional compilation
> > > so check if CONFIG_IS_ENABLED prior using those functions.
> > >
> > > The issue does not report any error in a normal build as the toolchain
> > > optimize the code. Using -O0 triggers the error so the patch is
> > > intended to fix issues on a ongoing effor to build U-Boot with -O0.
> > >
> > > Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza at xilinx.com>
> > > ---
> > >
> > > drivers/core/ofnode.c | 60 +++++++++++++++++++++---------------------
> > > drivers/serial/serial-uclass.c | 2 +-
> > > 2 files changed, 31 insertions(+), 31 deletions(-)
> > >
> >
> > This is supposed to work by using of_live_active(), which is called from
> > ofnode_is_np(). Instead of changing all this code, is it possible to update
> > of_live_active() somehow?
> >
>
> I've been trying to figure out it but I think there is no way just changing of_live_active as the compiler does not discard branch statements with nested fixed return values. I was able to make it work just changing ofnode_is_np using pre-processor macro to set as false when OF_LIVE is not enabled, but not sure if it the right approach. I will take a deeper look to the entire OF code and maybe suggest a code refactoring.
Just returning false when OF_LIVE is not enabled seems fine to me. You
can never have an ofnode if livetree is not enabled.
Regards,
Simon
More information about the U-Boot
mailing list