Re: [PATCH v2] clk: Mark a fwnode as initialized when using CLK_OF_DECLARE() macro

From: Nathan Chancellor
Date: Wed Mar 08 2023 - 11:04:05 EST


On Mon, Mar 06, 2023 at 11:15:54AM -0800, Stephen Boyd wrote:
> Quoting Saravana Kannan (2023-03-03 13:24:00)
> > On Thu, Mar 2, 2023 at 5:14 AM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> > >
> > > Works like a charm on U8500!
> > > Tested-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> > > Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> >
> > Stephen, Does this look good? Can we have Greg pull this in?
> >
>
> I picked it up for fixes. Will send it off later this week.

This change causes a build regression:

drivers/clk/mvebu/kirkwood.c:358:1: error: expected identifier or '('
CLK_OF_DECLARE(98dx1135_clk, "marvell,mv98dx1135-core-clock",
^
include/linux/clk-provider.h:1367:21: note: expanded from macro 'CLK_OF_DECLARE'
static void __init name##_of_clk_init_declare(struct device_node *np) \
^
<scratch space>:124:1: note: expanded from here
98dx1135_clk_of_clk_init_declare
^
drivers/clk/mvebu/kirkwood.c:358:1: error: invalid digit 'd' in decimal constant
include/linux/clk-provider.h:1372:34: note: expanded from macro 'CLK_OF_DECLARE'
OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare)
^
<scratch space>:125:3: note: expanded from here
98dx1135_clk_of_clk_init_declare
^
drivers/clk/mvebu/kirkwood.c:358:1: error: invalid digit 'd' in decimal constant
include/linux/clk-provider.h:1372:34: note: expanded from macro 'CLK_OF_DECLARE'
OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare)
^
<scratch space>:125:3: note: expanded from here
98dx1135_clk_of_clk_init_declare
^
drivers/clk/mvebu/kirkwood.c:358:1: error: invalid digit 'd' in decimal constant
include/linux/clk-provider.h:1372:34: note: expanded from macro 'CLK_OF_DECLARE'
OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare)
^
<scratch space>:125:3: note: expanded from here
98dx1135_clk_of_clk_init_declare
^
4 errors generated.

The clock's name starts with a number, resulting in an invalid C
function name. Are clock names ABI? Should this be fixed by adjusting
the name like so or adjusting where the name appears in the function
defined by CLK_OF_DECLARE()?

diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c
index 8bc893df4736..5d0a7e3bfde5 100644
--- a/drivers/clk/mvebu/kirkwood.c
+++ b/drivers/clk/mvebu/kirkwood.c
@@ -355,5 +355,5 @@ CLK_OF_DECLARE(kirkwood_clk, "marvell,kirkwood-core-clock",
kirkwood_clk_init);
CLK_OF_DECLARE(mv88f6180_clk, "marvell,mv88f6180-core-clock",
kirkwood_clk_init);
-CLK_OF_DECLARE(98dx1135_clk, "marvell,mv98dx1135-core-clock",
+CLK_OF_DECLARE(mv98dx1135_clk, "marvell,mv98dx1135-core-clock",
kirkwood_clk_init);

Cheers,
Nathan