[lkml]   [2021]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v1] kbuild: Disable compile testing if HAVE_LEGACY_CLK enabled
On Mon, May 24, 2021 at 2:39 PM Dmitry Osipenko <> wrote:
> 24.05.2021 11:54, Geert Uytterhoeven пишет:
> > Hi Dmitry,
> >
> > On Mon, May 24, 2021 at 1:26 AM Dmitry Osipenko <> wrote:
> >> There are couple older platforms that can't be compile-tested because they
> >> partially implement CLK API. It causes build failure of kernel drivers due
> >> to the missing symbols of the unimplemented part of CLK API.
> >>
> >> These platforms are: ARM EP93XX, ARM OMAP1, m68k ColdFire, MIPS AR7,
> >> MIPS Ralink.

There is also most of arch/sh/, with the one exception of J2.

On MIPS, I see BCM63XX and Lantiq in addition to AR7 and Ralink.

I think the patches to convert ep93xx are under discussion at the moment,
and I have previously done an implementation for omap1 that I have meant
to dig out for a while.

Both of the Arm platforms should work fine with compile testing, as I
have previously added the stubs as necessary.

> >> @@ -131,7 +131,7 @@ config INIT_ENV_ARG_LIMIT
> >>
> >> config COMPILE_TEST
> >> bool "Compile also drivers which will not load"
> >> - depends on HAS_IOMEM
> >> + depends on HAS_IOMEM && !HAVE_LEGACY_CLK
> >
> > That sounds a bit drastic to me. Usually we just try to implement the
> > missing functionality, or provide stubs.
> > Which functions are missing?
> Everything that belongs to CONFIG_COMMON_CLK needs stubs.
> That is everything under CONFIG_HAVE_CLK [1], excluding functions
> belonging to clk-devres.o and clk-bulk.o [2]. The HAVE_LEGACY_CLK
> selects HAVE_CLK, but the COMMON_CLK is under HAVE_CLK too.
> [1]
> [2]
> This problem is repeated over and over again for the past years. Some
> maintainers are adding "depends on COMMON_CLK" for COMPILE_TEST of each
> driver, but this doesn't solve the root of the problem, and thus, it's
> constantly reoccurring.

These dependencies tend to reflect the actual requirements though: if a
driver calls the clk interfaces, it is likely to require them at
runtime as well.

If a driver that calls clk_get_rate() does not have a fallback to deal with '0'
getting returned, this means that building it without CONFIG_COMMON_CLK
gives you a driver that can't work on any hardware at all. In this case


does reflect what we want.depends onb

> Recently Krzysztof Kozlowski added couple more clk stubs for MIPS, but
> still lots of stubs are missing. Some platforms don't have any stubs at
> all and apparently nobody cares to fix them.
> There 3 possible solutions:
> 1. Factor out COMMON_CLK from HAVE_LEGACY_CLK, if this is possible
> 2. Build stubs universally, maybe using weak functions.
> 3. Disable compile-testing for HAVE_LEGACY_CLK
> The third option is the simplest. If anyone will care to fix those
> legacy platforms properly, then compile-testing could be re-enabled for
> them. This is my proposal.

It is pretty much a given that arch/sh won't be converted to common clk
at this point, and I think disabling COMPILE_TEST on arch/sh globabally
makes sense.

Converting coldfire and ar7/lantiq/bcm63xx/ralink to common_clk shouldn't
actually be too hard, but I don't think it's a priority for anyone at
the moment.

One other idea I can think of is to redefine CONFIG_HAVE_CLK. At the
moment, this is defined as (COMMON_CLK || HAVE_LEGACY_CLK),
not literally, but for all practical purposes. If HAVE_CLK is disabled,
we get the stubs, so the build failures you saw happen very rarely
on drivers that use clk interfaces but have no such Kconfig dependency.

If we change this to define it as

config HAVE_CLK

while annotating the sh/coldfire/ar7/bcm63xx/lantiq/ralink specific
drivers as 'depends on HAVE_CLK || HAVE_LEGACY_CLK', then
we can compile test any driver, but actually get the build failures
for drivers that lack a 'depends on COMMON_CLK' and can fix
them up more easily. This probably requires adding a ton of
missing dependencies first that happened to get ignored in the

If we don't do this, another approach would be to provide
global stubs for anything that isn't already provided by
the platforms. Here is a list of which interfaces each version
actually has implemented (Y), stubbed out (S) or lacks (N):

omap1 ep93xx ar7 bcm63xx lantiq ralink coldf sh
clk_enable Y Y S Y Y S Y Y
clk_disable Y Y S Y Y S Y Y
clk_get_rate Y Y Y Y Y Y S Y
clk_round_rate Y S S S Y S S Y
clk_set_rate Y Y S S Y S S Y
clk_set_parent S S S N N S S Y
clk_get_parent S Y S N N S S Y
clk_get N N Y N N N Y N
clk_put N N S N N N S N

- ar7 and coldfire are the only ones that lack the generic
clkdev lookup but instead provide their own clk_get/clk_put
functions. This can probably get addressed easily.

- The clk_get_parent/set_parent functions are only
provided on ep93xx and sh. Once ep93xx is out of the
way, we could remove the private stubs and always
provide the global ones, except for sh.

- The remaining five functions
(enable/disable/get_rate/set_rate/round_rate) have a
consistent interface across all eight platforms, they
are always exported in that case.


 \ /
  Last update: 2021-05-28 11:27    [W:0.075 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site