Re: [PATCHv2] firmware/tegra: add COMPILE_TEST

From: Thierry Reding

Date: Tue Mar 24 2026 - 07:38:16 EST


On Mon, Mar 23, 2026 at 11:42:18PM -0700, Rosen Penev wrote:
> On Mon, Mar 23, 2026 at 11:01 PM Mikko Perttunen <mperttunen@xxxxxxxxxx> wrote:
> >
> > On Tuesday, March 24, 2026 10:57 AM Rosen Penev wrote:
> > > For this driver specifically, there's no arch specific stuff needed.
> > >
> > > Build the tegra clk stuff as tegra_bpmp_init_clocks is defined there.
> > > CLK_TEGRA_BPMP also depends on TEGRA_BPMP.
> > >
> > > Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> > > ---
> > > v2: also build the tegra clk stuff.
> > > drivers/clk/Makefile | 2 +-
> > > drivers/firmware/tegra/Kconfig | 4 ++--
> > > 2 files changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> > > index 760d9643705f..334d5c522394 100644
> > > --- a/drivers/clk/Makefile
> > > +++ b/drivers/clk/Makefile
> > > @@ -154,7 +154,7 @@ obj-$(CONFIG_ARCH_STM32) += stm32/
> > > obj-y += starfive/
> > > obj-$(CONFIG_ARCH_SUNXI) += sunxi/
> > > obj-y += sunxi-ng/
> > > -obj-$(CONFIG_ARCH_TEGRA) += tegra/
> > > +obj-y += tegra/
> >
> > clk/tegra/Makefile doesn't separately check for ARCH_TEGRA, so this will cause
> > much of it to get built on non-Tegra platforms as well.
> Sure. It builds fine.

I think the point that Mikko was trying to make is that with the current
setup you get the Tegra clock code built on all platforms, whether you
enable ARCH_TEGRA or not. Meaning you will get this included in your
kernel builds even on x86 or MIPS systems, or ARM systems that don't
enable any Tegra code.

If you really want to make this build with COMPILE_TEST, the right way
to do so is by adding a dedicated Kconfig symbol that uses something
like:

config CLK_TEGRA
...
depends ARCH_TEGRA || COMPILE_TEST

and then use that symbol instead of CONFIG_ARCH_TEGRA above:

obj-$(CONFIG_CLK_TEGRA) += tegra/

That way you ensure that it gets enabled for build testing or if Tegra
support is explicitly enabled.

Thierry

Attachment: signature.asc
Description: PGP signature