[1/4] clk: mmp2: Move number of clocks into driver source
Commit Message
The number of clocks should not be in the dt binding as it is not used
by the respective device tree and thus needlessly bloats the ABI.
Move this number of clocks into the driver source.
Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
---
drivers/clk/mmp/clk-audio.c | 4 +++-
drivers/clk/mmp/clk-of-mmp2.c | 4 +++-
include/dt-bindings/clock/marvell,mmp2-audio.h | 1 -
include/dt-bindings/clock/marvell,mmp2.h | 1 -
4 files changed, 6 insertions(+), 4 deletions(-)
Comments
Hi Duje,
kernel test robot noticed the following build errors:
[auto build test ERROR on 52a93d39b17dc7eb98b6aa3edb93943248e03b2f]
url: https://github.com/intel-lab-lkp/linux/commits/Duje-Mihanovi/clk-mmp2-Move-number-of-clocks-into-driver-source/20230809-202111
base: 52a93d39b17dc7eb98b6aa3edb93943248e03b2f
patch link: https://lore.kernel.org/r/20230809-mmp-nr-clks-v1-1-5f3cdbbb89b8%40skole.hr
patch subject: [PATCH 1/4] clk: mmp2: Move number of clocks into driver source
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20230811/202308110800.KkX1CemC-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230811/202308110800.KkX1CemC-lkp@intel.com/reproduce)
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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308110800.KkX1CemC-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/bits.h:5,
from include/linux/bitops.h:6,
from include/linux/of.h:15,
from include/linux/clk-provider.h:9,
from drivers/clk/mmp/clk-audio.c:8:
drivers/clk/mmp/clk-audio.c: In function 'mmp2_audio_clk_probe':
>> drivers/clk/mmp/clk-audio.c:354:41: error: 'MMP2_CLK_AUDIO_NR_CLKS' undeclared (first use in this function); did you mean 'MMP2_CLK_AUDIO_SYSCLK'?
354 | MMP2_CLK_AUDIO_NR_CLKS),
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/const.h:12:55: note: in definition of macro '__is_constexpr'
12 | (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
| ^
drivers/clk/mmp/clk-audio.c:353:29: note: in expansion of macro 'struct_size'
353 | struct_size(priv, clk_data.hws,
| ^~~~~~~~~~~
drivers/clk/mmp/clk-audio.c:354:41: note: each undeclared identifier is reported only once for each function it appears in
354 | MMP2_CLK_AUDIO_NR_CLKS),
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/const.h:12:55: note: in definition of macro '__is_constexpr'
12 | (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
| ^
drivers/clk/mmp/clk-audio.c:353:29: note: in expansion of macro 'struct_size'
353 | struct_size(priv, clk_data.hws,
| ^~~~~~~~~~~
In file included from include/linux/vmalloc.h:11,
from include/asm-generic/io.h:994,
from arch/arm/include/asm/io.h:416,
from include/linux/io.h:13,
from drivers/clk/mmp/clk-audio.c:9:
>> include/linux/overflow.h:276:9: error: first argument to '__builtin_choose_expr' not a constant
276 | __builtin_choose_expr(__is_constexpr(count), \
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:293:32: note: in expansion of macro 'flex_array_size'
293 | sizeof(*(p)) + flex_array_size(p, member, count), \
| ^~~~~~~~~~~~~~~
drivers/clk/mmp/clk-audio.c:353:29: note: in expansion of macro 'struct_size'
353 | struct_size(priv, clk_data.hws,
| ^~~~~~~~~~~
>> include/linux/overflow.h:276:9: error: first argument to '__builtin_choose_expr' not a constant
276 | __builtin_choose_expr(__is_constexpr(count), \
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/overflow.h:294:40: note: in expansion of macro 'flex_array_size'
294 | size_add(sizeof(*(p)), flex_array_size(p, member, count)))
| ^~~~~~~~~~~~~~~
drivers/clk/mmp/clk-audio.c:353:29: note: in expansion of macro 'struct_size'
353 | struct_size(priv, clk_data.hws,
| ^~~~~~~~~~~
include/linux/overflow.h:292:9: error: first argument to '__builtin_choose_expr' not a constant
292 | __builtin_choose_expr(__is_constexpr(count), \
| ^~~~~~~~~~~~~~~~~~~~~
drivers/clk/mmp/clk-audio.c:353:29: note: in expansion of macro 'struct_size'
353 | struct_size(priv, clk_data.hws,
| ^~~~~~~~~~~
vim +354 drivers/clk/mmp/clk-audio.c
725262d29139cc Lubomir Rintel 2020-05-20 346
725262d29139cc Lubomir Rintel 2020-05-20 347 static int mmp2_audio_clk_probe(struct platform_device *pdev)
725262d29139cc Lubomir Rintel 2020-05-20 348 {
725262d29139cc Lubomir Rintel 2020-05-20 349 struct mmp2_audio_clk *priv;
725262d29139cc Lubomir Rintel 2020-05-20 350 int ret;
725262d29139cc Lubomir Rintel 2020-05-20 351
725262d29139cc Lubomir Rintel 2020-05-20 352 priv = devm_kzalloc(&pdev->dev,
725262d29139cc Lubomir Rintel 2020-05-20 353 struct_size(priv, clk_data.hws,
725262d29139cc Lubomir Rintel 2020-05-20 @354 MMP2_CLK_AUDIO_NR_CLKS),
725262d29139cc Lubomir Rintel 2020-05-20 355 GFP_KERNEL);
725262d29139cc Lubomir Rintel 2020-05-20 356 if (!priv)
725262d29139cc Lubomir Rintel 2020-05-20 357 return -ENOMEM;
725262d29139cc Lubomir Rintel 2020-05-20 358
725262d29139cc Lubomir Rintel 2020-05-20 359 spin_lock_init(&priv->lock);
725262d29139cc Lubomir Rintel 2020-05-20 360 platform_set_drvdata(pdev, priv);
725262d29139cc Lubomir Rintel 2020-05-20 361
725262d29139cc Lubomir Rintel 2020-05-20 362 priv->mmio_base = devm_platform_ioremap_resource(pdev, 0);
725262d29139cc Lubomir Rintel 2020-05-20 363 if (IS_ERR(priv->mmio_base))
725262d29139cc Lubomir Rintel 2020-05-20 364 return PTR_ERR(priv->mmio_base);
725262d29139cc Lubomir Rintel 2020-05-20 365
725262d29139cc Lubomir Rintel 2020-05-20 366 pm_runtime_enable(&pdev->dev);
725262d29139cc Lubomir Rintel 2020-05-20 367 ret = pm_clk_create(&pdev->dev);
725262d29139cc Lubomir Rintel 2020-05-20 368 if (ret)
725262d29139cc Lubomir Rintel 2020-05-20 369 goto disable_pm_runtime;
725262d29139cc Lubomir Rintel 2020-05-20 370
725262d29139cc Lubomir Rintel 2020-05-20 371 ret = pm_clk_add(&pdev->dev, "audio");
725262d29139cc Lubomir Rintel 2020-05-20 372 if (ret)
725262d29139cc Lubomir Rintel 2020-05-20 373 goto destroy_pm_clk;
725262d29139cc Lubomir Rintel 2020-05-20 374
725262d29139cc Lubomir Rintel 2020-05-20 375 ret = register_clocks(priv, &pdev->dev);
725262d29139cc Lubomir Rintel 2020-05-20 376 if (ret)
725262d29139cc Lubomir Rintel 2020-05-20 377 goto destroy_pm_clk;
725262d29139cc Lubomir Rintel 2020-05-20 378
725262d29139cc Lubomir Rintel 2020-05-20 379 return 0;
725262d29139cc Lubomir Rintel 2020-05-20 380
725262d29139cc Lubomir Rintel 2020-05-20 381 destroy_pm_clk:
725262d29139cc Lubomir Rintel 2020-05-20 382 pm_clk_destroy(&pdev->dev);
725262d29139cc Lubomir Rintel 2020-05-20 383 disable_pm_runtime:
725262d29139cc Lubomir Rintel 2020-05-20 384 pm_runtime_disable(&pdev->dev);
725262d29139cc Lubomir Rintel 2020-05-20 385
725262d29139cc Lubomir Rintel 2020-05-20 386 return ret;
725262d29139cc Lubomir Rintel 2020-05-20 387 }
725262d29139cc Lubomir Rintel 2020-05-20 388
@@ -55,6 +55,8 @@
#define SSPA_AUD_PLL_CTRL1_DIV_OCLK_PATTERN_MASK (0x7ff << 0)
#define SSPA_AUD_PLL_CTRL1_DIV_OCLK_PATTERN(x) ((x) << 0)
+#define CLK_AUDIO_NR_CLKS 3
+
struct mmp2_audio_clk {
void __iomem *mmio_base;
@@ -336,7 +338,7 @@ static int register_clocks(struct mmp2_audio_clk *priv, struct device *dev)
priv->clk_data.hws[MMP2_CLK_AUDIO_SYSCLK] = &priv->sysclk_gate.hw;
priv->clk_data.hws[MMP2_CLK_AUDIO_SSPA0] = &priv->sspa0_gate.hw;
priv->clk_data.hws[MMP2_CLK_AUDIO_SSPA1] = &priv->sspa1_gate.hw;
- priv->clk_data.num = MMP2_CLK_AUDIO_NR_CLKS;
+ priv->clk_data.num = CLK_AUDIO_NR_CLKS;
return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
&priv->clk_data);
@@ -78,6 +78,8 @@
#define MPMU_PLL_DIFF_CTRL 0x68
#define MPMU_PLL2_CTRL1 0x414
+#define NR_CLKS 200
+
enum mmp2_clk_model {
CLK_MODEL_MMP2,
CLK_MODEL_MMP3,
@@ -543,7 +545,7 @@ static void __init mmp2_clk_init(struct device_node *np)
mmp2_pm_domain_init(np, pxa_unit);
- mmp_clk_init(np, &pxa_unit->unit, MMP2_NR_CLKS);
+ mmp_clk_init(np, &pxa_unit->unit, NR_CLKS);
mmp2_main_clk_init(pxa_unit);
@@ -6,5 +6,4 @@
#define MMP2_CLK_AUDIO_SSPA0 1
#define MMP2_CLK_AUDIO_SSPA1 2
-#define MMP2_CLK_AUDIO_NR_CLKS 3
#endif
@@ -91,5 +91,4 @@
#define MMP3_CLK_SDH4 126
#define MMP2_CLK_AUDIO 127
-#define MMP2_NR_CLKS 200
#endif