Message ID | 20220129095159.2202366-2-j.neuschaefer@gmx.net (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | clk: Declare mux tables as const u32[] | expand |
Hi "Jonathan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on clk/clk-next]
[also build test WARNING on linux/master linus/master v5.17-rc2 next-20220128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jonathan-Neusch-fer/clk-Declare-mux-tables-as-const-u32/20220129-175243
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: arm-buildonly-randconfig-r002-20220131 (https://download.01.org/0day-ci/archive/20220131/202201311102.kgy44sMD-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/b97ffeed127cccf9159b9de1e9a1527b963460c4
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Neusch-fer/clk-Declare-mux-tables-as-const-u32/20220129-175243
git checkout b97ffeed127cccf9159b9de1e9a1527b963460c4
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/clk/nxp/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/clk/nxp/clk-lpc18xx-cgu.c: In function 'lpc18xx_pll1_recalc_rate':
drivers/clk/nxp/clk-lpc18xx-cgu.c:460:13: warning: variable 'stat' set but not used [-Wunused-but-set-variable]
460 | u32 stat, ctrl;
| ^~~~
drivers/clk/nxp/clk-lpc18xx-cgu.c: In function 'lpc18xx_cgu_register_div':
>> drivers/clk/nxp/clk-lpc18xx-cgu.c:545:52: warning: passing argument 2 of 'lpc18xx_fill_parent_names' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
545 | lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents);
| ~~~~~~~~^~~~~~
drivers/clk/nxp/clk-lpc18xx-cgu.c:526:65: note: expected 'u32 *' {aka 'unsigned int *'} but argument is of type 'const u32 *' {aka 'const unsigned int *'}
526 | static void lpc18xx_fill_parent_names(const char **parent, u32 *id, int size)
| ~~~~~^~
drivers/clk/nxp/clk-lpc18xx-cgu.c: In function 'lpc18xx_register_base_clk':
drivers/clk/nxp/clk-lpc18xx-cgu.c:567:52: warning: passing argument 2 of 'lpc18xx_fill_parent_names' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
567 | lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents);
| ~~~~~~~~^~~~~~
drivers/clk/nxp/clk-lpc18xx-cgu.c:526:65: note: expected 'u32 *' {aka 'unsigned int *'} but argument is of type 'const u32 *' {aka 'const unsigned int *'}
526 | static void lpc18xx_fill_parent_names(const char **parent, u32 *id, int size)
| ~~~~~^~
drivers/clk/nxp/clk-lpc18xx-cgu.c: In function 'lpc18xx_cgu_register_pll':
drivers/clk/nxp/clk-lpc18xx-cgu.c:592:52: warning: passing argument 2 of 'lpc18xx_fill_parent_names' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
592 | lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents);
| ~~~~~~~~^~~~~~
drivers/clk/nxp/clk-lpc18xx-cgu.c:526:65: note: expected 'u32 *' {aka 'unsigned int *'} but argument is of type 'const u32 *' {aka 'const unsigned int *'}
526 | static void lpc18xx_fill_parent_names(const char **parent, u32 *id, int size)
| ~~~~~^~
vim +545 drivers/clk/nxp/clk-lpc18xx-cgu.c
b04e0b8fd5443b Joachim Eastwood 2015-05-28 533
b04e0b8fd5443b Joachim Eastwood 2015-05-28 534 static struct clk *lpc18xx_cgu_register_div(struct lpc18xx_cgu_src_clk_div *clk,
b04e0b8fd5443b Joachim Eastwood 2015-05-28 535 void __iomem *base, int n)
b04e0b8fd5443b Joachim Eastwood 2015-05-28 536 {
b04e0b8fd5443b Joachim Eastwood 2015-05-28 537 void __iomem *reg = base + LPC18XX_CGU_IDIV_CTRL(n);
b04e0b8fd5443b Joachim Eastwood 2015-05-28 538 const char *name = clk_src_names[clk->clk_id];
b04e0b8fd5443b Joachim Eastwood 2015-05-28 539 const char *parents[CLK_SRC_MAX];
b04e0b8fd5443b Joachim Eastwood 2015-05-28 540
b04e0b8fd5443b Joachim Eastwood 2015-05-28 541 clk->div.reg = reg;
b04e0b8fd5443b Joachim Eastwood 2015-05-28 542 clk->mux.reg = reg;
b04e0b8fd5443b Joachim Eastwood 2015-05-28 543 clk->gate.reg = reg;
b04e0b8fd5443b Joachim Eastwood 2015-05-28 544
b04e0b8fd5443b Joachim Eastwood 2015-05-28 @545 lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents);
b04e0b8fd5443b Joachim Eastwood 2015-05-28 546
b04e0b8fd5443b Joachim Eastwood 2015-05-28 547 return clk_register_composite(NULL, name, parents, clk->n_parents,
b04e0b8fd5443b Joachim Eastwood 2015-05-28 548 &clk->mux.hw, &clk_mux_ops,
b04e0b8fd5443b Joachim Eastwood 2015-05-28 549 &clk->div.hw, &clk_divider_ops,
c23a5847695dbd Joachim Eastwood 2015-10-24 550 &clk->gate.hw, &lpc18xx_gate_ops, 0);
b04e0b8fd5443b Joachim Eastwood 2015-05-28 551 }
b04e0b8fd5443b Joachim Eastwood 2015-05-28 552
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi "Jonathan,
I love your patch! Yet something to improve:
[auto build test ERROR on clk/clk-next]
[also build test ERROR on linux/master linus/master v5.17-rc2 next-20220128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jonathan-Neusch-fer/clk-Declare-mux-tables-as-const-u32/20220129-175243
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: arm-randconfig-r004-20220131 (https://download.01.org/0day-ci/archive/20220131/202201311204.ggE2FHa7-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f1c18acb07aa40f42b87b70462a6d1ab77a4825c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/b97ffeed127cccf9159b9de1e9a1527b963460c4
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Neusch-fer/clk-Declare-mux-tables-as-const-u32/20220129-175243
git checkout b97ffeed127cccf9159b9de1e9a1527b963460c4
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/clk/nxp/clk-lpc18xx-cgu.c:460:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]
u32 stat, ctrl;
^
>> drivers/clk/nxp/clk-lpc18xx-cgu.c:545:37: error: passing 'const u32 *' (aka 'const unsigned int *') to parameter of type 'u32 *' (aka 'unsigned int *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents);
^~~~~~~~~~~~~~
drivers/clk/nxp/clk-lpc18xx-cgu.c:526:65: note: passing argument to parameter 'id' here
static void lpc18xx_fill_parent_names(const char **parent, u32 *id, int size)
^
drivers/clk/nxp/clk-lpc18xx-cgu.c:567:37: error: passing 'const u32 *' (aka 'const unsigned int *') to parameter of type 'u32 *' (aka 'unsigned int *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents);
^~~~~~~~~~~~~~
drivers/clk/nxp/clk-lpc18xx-cgu.c:526:65: note: passing argument to parameter 'id' here
static void lpc18xx_fill_parent_names(const char **parent, u32 *id, int size)
^
drivers/clk/nxp/clk-lpc18xx-cgu.c:592:37: error: passing 'const u32 *' (aka 'const unsigned int *') to parameter of type 'u32 *' (aka 'unsigned int *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents);
^~~~~~~~~~~~~~
drivers/clk/nxp/clk-lpc18xx-cgu.c:526:65: note: passing argument to parameter 'id' here
static void lpc18xx_fill_parent_names(const char **parent, u32 *id, int size)
^
1 warning and 3 errors generated.
vim +545 drivers/clk/nxp/clk-lpc18xx-cgu.c
b04e0b8fd5443b Joachim Eastwood 2015-05-28 533
b04e0b8fd5443b Joachim Eastwood 2015-05-28 534 static struct clk *lpc18xx_cgu_register_div(struct lpc18xx_cgu_src_clk_div *clk,
b04e0b8fd5443b Joachim Eastwood 2015-05-28 535 void __iomem *base, int n)
b04e0b8fd5443b Joachim Eastwood 2015-05-28 536 {
b04e0b8fd5443b Joachim Eastwood 2015-05-28 537 void __iomem *reg = base + LPC18XX_CGU_IDIV_CTRL(n);
b04e0b8fd5443b Joachim Eastwood 2015-05-28 538 const char *name = clk_src_names[clk->clk_id];
b04e0b8fd5443b Joachim Eastwood 2015-05-28 539 const char *parents[CLK_SRC_MAX];
b04e0b8fd5443b Joachim Eastwood 2015-05-28 540
b04e0b8fd5443b Joachim Eastwood 2015-05-28 541 clk->div.reg = reg;
b04e0b8fd5443b Joachim Eastwood 2015-05-28 542 clk->mux.reg = reg;
b04e0b8fd5443b Joachim Eastwood 2015-05-28 543 clk->gate.reg = reg;
b04e0b8fd5443b Joachim Eastwood 2015-05-28 544
b04e0b8fd5443b Joachim Eastwood 2015-05-28 @545 lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents);
b04e0b8fd5443b Joachim Eastwood 2015-05-28 546
b04e0b8fd5443b Joachim Eastwood 2015-05-28 547 return clk_register_composite(NULL, name, parents, clk->n_parents,
b04e0b8fd5443b Joachim Eastwood 2015-05-28 548 &clk->mux.hw, &clk_mux_ops,
b04e0b8fd5443b Joachim Eastwood 2015-05-28 549 &clk->div.hw, &clk_divider_ops,
c23a5847695dbd Joachim Eastwood 2015-10-24 550 &clk->gate.hw, &lpc18xx_gate_ops, 0);
b04e0b8fd5443b Joachim Eastwood 2015-05-28 551 }
b04e0b8fd5443b Joachim Eastwood 2015-05-28 552
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Mon, Jan 31, 2022 at 11:44:25AM +0800, kernel test robot wrote: > Hi "Jonathan, > > I love your patch! Perhaps something to improve: > [...] > drivers/clk/nxp/clk-lpc18xx-cgu.c: In function 'lpc18xx_pll1_recalc_rate': > drivers/clk/nxp/clk-lpc18xx-cgu.c:460:13: warning: variable 'stat' set but not used [-Wunused-but-set-variable] > 460 | u32 stat, ctrl; > | ^~~~ This is unrelated to my changes, I'll leave it up to the LPC18xx developers. > drivers/clk/nxp/clk-lpc18xx-cgu.c: In function 'lpc18xx_cgu_register_div': > >> drivers/clk/nxp/clk-lpc18xx-cgu.c:545:52: warning: passing argument 2 of 'lpc18xx_fill_parent_names' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] > 545 | lpc18xx_fill_parent_names(parents, clk->mux.table, clk->n_parents); > | ~~~~~~~~^~~~~~ I'll fix this for v2. Jonathan
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 20582aae7a35f..214045f6e9895 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -40,7 +40,7 @@ static inline void clk_mux_writel(struct clk_mux *mux, u32 val) writel(val, mux->reg); } -int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags, +int clk_mux_val_to_index(struct clk_hw *hw, const u32 *table, unsigned int flags, unsigned int val) { int num_parents = clk_hw_get_num_parents(hw); @@ -67,7 +67,7 @@ int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags, } EXPORT_SYMBOL_GPL(clk_mux_val_to_index); -unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8 index) +unsigned int clk_mux_index_to_val(const u32 *table, unsigned int flags, u8 index) { unsigned int val = index; @@ -152,7 +152,7 @@ struct clk_hw *__clk_hw_register_mux(struct device *dev, struct device_node *np, const struct clk_hw **parent_hws, const struct clk_parent_data *parent_data, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, - u8 clk_mux_flags, u32 *table, spinlock_t *lock) + u8 clk_mux_flags, const u32 *table, spinlock_t *lock) { struct clk_mux *mux; struct clk_hw *hw; @@ -218,7 +218,7 @@ struct clk_hw *__devm_clk_hw_register_mux(struct device *dev, struct device_node const struct clk_hw **parent_hws, const struct clk_parent_data *parent_data, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, - u8 clk_mux_flags, u32 *table, spinlock_t *lock) + u8 clk_mux_flags, const u32 *table, spinlock_t *lock) { struct clk_hw **ptr, *hw; @@ -244,7 +244,7 @@ EXPORT_SYMBOL_GPL(__devm_clk_hw_register_mux); struct clk *clk_register_mux_table(struct device *dev, const char *name, const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, - u8 clk_mux_flags, u32 *table, spinlock_t *lock) + u8 clk_mux_flags, const u32 *table, spinlock_t *lock) { struct clk_hw *hw; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 2faa6f7aa8a87..27be575288747 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -888,7 +888,7 @@ void clk_hw_unregister_divider(struct clk_hw *hw); struct clk_mux { struct clk_hw hw; void __iomem *reg; - u32 *table; + const u32 *table; u32 mask; u8 shift; u8 flags; @@ -913,18 +913,18 @@ struct clk_hw *__clk_hw_register_mux(struct device *dev, struct device_node *np, const struct clk_hw **parent_hws, const struct clk_parent_data *parent_data, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, - u8 clk_mux_flags, u32 *table, spinlock_t *lock); + u8 clk_mux_flags, const u32 *table, spinlock_t *lock); struct clk_hw *__devm_clk_hw_register_mux(struct device *dev, struct device_node *np, const char *name, u8 num_parents, const char * const *parent_names, const struct clk_hw **parent_hws, const struct clk_parent_data *parent_data, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, - u8 clk_mux_flags, u32 *table, spinlock_t *lock); + u8 clk_mux_flags, const u32 *table, spinlock_t *lock); struct clk *clk_register_mux_table(struct device *dev, const char *name, const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, - u8 clk_mux_flags, u32 *table, spinlock_t *lock); + u8 clk_mux_flags, const u32 *table, spinlock_t *lock); #define clk_register_mux(dev, name, parent_names, num_parents, flags, reg, \ shift, width, clk_mux_flags, lock) \ @@ -962,9 +962,9 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name, (shift), BIT((width)) - 1, (clk_mux_flags), \ NULL, (lock)) -int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags, +int clk_mux_val_to_index(struct clk_hw *hw, const u32 *table, unsigned int flags, unsigned int val); -unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8 index); +unsigned int clk_mux_index_to_val(const u32 *table, unsigned int flags, u8 index); void clk_unregister_mux(struct clk *clk); void clk_hw_unregister_mux(struct clk_hw *hw);
The elements of the table are never modified in clk-mux.c. To make this clear to clock drivers, declare the parameter as const u32 *table. Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> --- drivers/clk/clk-mux.c | 10 +++++----- include/linux/clk-provider.h | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) -- 2.34.1