[PATCH 07/25] tegra: Change #ifdef for nop

Simon Glass sjg at chromium.org
Tue Oct 10 16:42:13 CEST 2023


Hi Sean,

On Mon, 9 Oct 2023 at 17:40, Sean Anderson <seanga2 at gmail.com> wrote:
>
> On 10/9/23 11:32, Simon Glass wrote:
> > Hi Sean,
> >
> > On Sat, 7 Oct 2023 at 17:21, Sean Anderson <seanga2 at gmail.com> wrote:
> >>
> >> On 10/7/23 19:10, Simon Glass wrote:
> >>> Hi Tom.
> >>>
> >>> On Sun, 24 Sept 2023 at 18:43, Tom Rini <trini at konsulko.com> wrote:
> >>>>
> >>>> On Sun, Sep 24, 2023 at 02:39:25PM -0600, Simon Glass wrote:
> >>>>
> >>>>> This code is normally compiled for Tegra, but sandbox can also compile
> >>>>> it. We should not use UNIT_TEST as a synonym for SANDBOX, since it is
> >>>>> possible to disable UNIT_TEST for sandbox.
> >>>>>
> >>>>> Correct the condition.
> >>>>>
> >>>>> Signed-off-by: Simon Glass <sjg at chromium.org>
> >>>>> ---
> >>>>>
> >>>>>    include/k210/pll.h | 2 +-
> >>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>
> >>>>> diff --git a/include/k210/pll.h b/include/k210/pll.h
> >>>>> index fd16a89cb203..6dd60b2eb4fc 100644
> >>>>> --- a/include/k210/pll.h
> >>>>> +++ b/include/k210/pll.h
> >>>>> @@ -13,7 +13,7 @@ struct k210_pll_config {
> >>>>>         u8 od;
> >>>>>    };
> >>>>>
> >>>>> -#ifdef CONFIG_UNIT_TEST
> >>>>> +#ifdef CONFIG_SANDBOX
> >>>>>    TEST_STATIC int k210_pll_calc_config(u32 rate, u32 rate_in,
> >>>>>                                      struct k210_pll_config *best);
> >>>>>    #ifndef nop
> >>>>
> >>>> Tegra? Do you mean sifive?  That's where CLK_K210 stuff is... but it
> >>>
> >>> Oh yes, I got confused.
> >>>
> >>>> also seems wrong, you can run unit test on real hardware, and this is a
> >>>> test that could (should?) be run on that platform.
> >>>
> >>> Only if it enables UNIT_TEST. You cannot run unit tests without that.
> >>> The current tests are designed for sandbox.
> >>
> >> FWIW I have run this test on actual hardware. My intent here was to allow
> >> unit tests to access functions which would otherwise be declared static.
> >
> > Er, with or without UNIT_TEST enabled? How can it even build if this
> > declaration is only for sandbox?
>
> With UNIT_TEST of course. Although since this is a forward-declaration, the
> UNIT_TEST ifdef isn't really even necessary. If it's on actual hardware, nop
> should already be defined. So maybe this should be something like
>
> #if CONFIG_SANDBOX
> #define nop()
> #endif

It is the CONFIG_SANDBOX that I am trying to remove. Can it be
CONFIG_UNIT_TEST instead?

Regards,
Simon


More information about the U-Boot mailing list