RE: [linux-next:master 11663/12731] ERROR: modpost: "clk_unregister_fixed_rate" [drivers/regulator/raa215300.ko] undefined!

From: Biju Das
Date: Wed Jun 28 2023 - 11:47:25 EST


Hi All,

I have come up with two solutions for fixing this issue.

Please suggest which solution, I should submit.

First solution allows to build the driver for m68k architecture,
whereas the second solution skips it.

Solution 1: Add static inline functions in clk-provider.h
---------------------------------------------------------
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 28ff6f1a6ada..425a31c2816c 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -365,9 +365,6 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
const struct clk_parent_data *parent_data, unsigned long flags,
unsigned long fixed_rate, unsigned long fixed_accuracy,
unsigned long clk_fixed_flags, bool devm);
-struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
- const char *parent_name, unsigned long flags,
- unsigned long fixed_rate);
/**
* clk_hw_register_fixed_rate - register fixed-rate clock with the clock
* framework
@@ -481,7 +478,6 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
(parent_data), (flags), (fixed_rate), 0, \
CLK_FIXED_RATE_PARENT_ACCURACY, false)

-void clk_unregister_fixed_rate(struct clk *clk);
void clk_hw_unregister_fixed_rate(struct clk_hw *hw);

void of_fixed_clk_setup(struct device_node *np);
@@ -1297,11 +1293,22 @@ const char *__clk_get_name(const struct clk *clk);
const char *clk_hw_get_name(const struct clk_hw *hw);
#ifdef CONFIG_COMMON_CLK
struct clk_hw *__clk_get_hw(struct clk *clk);
+struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
+ const char *parent_name, unsigned long flags,
+ unsigned long fixed_rate);
+void clk_unregister_fixed_rate(struct clk *clk);
#else
static inline struct clk_hw *__clk_get_hw(struct clk *clk)
{
return (struct clk_hw *)clk;
}
+static inline struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
+ const char *parent_name, unsigned long flags,
+ unsigned long fixed_rate)
+{
+ return ERR_PTR(-ENOENT);
+}
+static inline void clk_unregister_fixed_rate(struct clk *clk) {}
#endif

struct clk *clk_hw_get_clk(struct clk_hw *hw, const char *con_id);
Solution 2: Add dependency to COMMON_CLK
--------------------------------------

config REGULATOR_RAA215300
tristate "Renesas RAA215300 driver"
select REGMAP_I2C
+ depends on COMMON_CLK
depends on I2C
help
Support for the Renesas RAA215300 PMIC.

Cheers,
Biju

> -----Original Message-----
> From: kernel test robot <lkp@xxxxxxxxx>
> Sent: Wednesday, June 28, 2023 1:53 PM
> To: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> Cc: oe-kbuild-all@xxxxxxxxxxxxxxx; Linux Memory Management List <linux-
> mm@xxxxxxxxx>; Mark Brown <broonie@xxxxxxxxxx>
> Subject: [linux-next:master 11663/12731] ERROR: modpost:
> "clk_unregister_fixed_rate" [drivers/regulator/raa215300.ko] undefined!
>
> tree:
>
>
> If you fix the issue in a separate patch/commit (i.e. not just a new
> version of the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes:
>
> All errors (new ones prefixed by >>, old ones prefixed by <<):
>
> >> ERROR: modpost: "clk_unregister_fixed_rate"
> [drivers/regulator/raa215300.ko] undefined!
> >> ERROR: modpost: "clk_register_fixed_rate"
> [drivers/regulator/raa215300.ko] undefined!
>
> --
> 0-DAY CI Kernel Test Service