linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] clk: Declare mux tables as const u32[]
@ 2022-01-29  9:51 Jonathan Neuschäfer
  2022-01-29  9:51 ` [PATCH 1/5] clk: mux: Declare u32 *table parameter as const Jonathan Neuschäfer
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2022-01-29  9:51 UTC (permalink / raw)
  To: linux-clk; +Cc: linux-kernel, Jonathan Neuschäfer

I noticed that the 'table' parameter to clk_register_mux_table is never
used for modifying the table elements, and so it can be declared const.

Jonathan Neuschäfer (5):
  clk: mux: Declare u32 *table parameter as const
  clk: hisilicon: Remove unnecessary cast of mux table to u32 *
  clk: mmp: Declare mux tables as const u32[]
  clk: qcom: Declare mux table as const u32[]
  clk: pistachio: Declare mux table as const u32[]

 drivers/clk/clk-mux.c                 | 10 +++++-----
 drivers/clk/hisilicon/clk.c           |  2 +-
 drivers/clk/mmp/clk-of-mmp2.c         |  4 ++--
 drivers/clk/pistachio/clk-pistachio.c |  2 +-
 drivers/clk/qcom/kpss-xcc.c           |  2 +-
 include/linux/clk-provider.h          | 12 ++++++------
 6 files changed, 16 insertions(+), 16 deletions(-)

--
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] clk: mux: Declare u32 *table parameter as const
  2022-01-29  9:51 [PATCH 0/5] clk: Declare mux tables as const u32[] Jonathan Neuschäfer
@ 2022-01-29  9:51 ` Jonathan Neuschäfer
  2022-01-31  3:44   ` kernel test robot
  2022-01-31  4:15   ` kernel test robot
  2022-01-29  9:51 ` [PATCH 2/5] clk: hisilicon: Remove unnecessary cast of mux table to u32 * Jonathan Neuschäfer
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2022-01-29  9:51 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, Jonathan Neuschäfer, Michael Turquette, Stephen Boyd

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(-)

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);
--
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] clk: hisilicon: Remove unnecessary cast of mux table to u32 *
  2022-01-29  9:51 [PATCH 0/5] clk: Declare mux tables as const u32[] Jonathan Neuschäfer
  2022-01-29  9:51 ` [PATCH 1/5] clk: mux: Declare u32 *table parameter as const Jonathan Neuschäfer
@ 2022-01-29  9:51 ` Jonathan Neuschäfer
  2022-01-29  9:51 ` [PATCH 3/5] clk: mmp: Declare mux tables as const u32[] Jonathan Neuschäfer
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2022-01-29  9:51 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, Jonathan Neuschäfer, Michael Turquette,
	Stephen Boyd, Dongjiu Geng

Now that clk_register_mux_table takes a const u32 *, we don't need the
cast anymore.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 drivers/clk/hisilicon/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c
index 9361fba7cd4cf..54d9fdc935990 100644
--- a/drivers/clk/hisilicon/clk.c
+++ b/drivers/clk/hisilicon/clk.c
@@ -162,7 +162,7 @@ int hisi_clk_register_mux(const struct hisi_mux_clock *clks,
 					clks[i].num_parents, clks[i].flags,
 					base + clks[i].offset, clks[i].shift,
 					mask, clks[i].mux_flags,
-					(u32 *)clks[i].table, &hisi_clk_lock);
+					clks[i].table, &hisi_clk_lock);
 		if (IS_ERR(clk)) {
 			pr_err("%s: failed to register clock %s\n",
 			       __func__, clks[i].name);
--
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] clk: mmp: Declare mux tables as const u32[]
  2022-01-29  9:51 [PATCH 0/5] clk: Declare mux tables as const u32[] Jonathan Neuschäfer
  2022-01-29  9:51 ` [PATCH 1/5] clk: mux: Declare u32 *table parameter as const Jonathan Neuschäfer
  2022-01-29  9:51 ` [PATCH 2/5] clk: hisilicon: Remove unnecessary cast of mux table to u32 * Jonathan Neuschäfer
@ 2022-01-29  9:51 ` Jonathan Neuschäfer
  2022-01-29  9:51 ` [PATCH 4/5] clk: qcom: Declare mux table " Jonathan Neuschäfer
  2022-01-29  9:51 ` [PATCH 5/5] clk: pistachio: " Jonathan Neuschäfer
  4 siblings, 0 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2022-01-29  9:51 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, Jonathan Neuschäfer, Michael Turquette, Stephen Boyd

Now that clk_register_mux_table takes a const u32 *, we can declare the
mux tables as const u32[].

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 drivers/clk/mmp/clk-of-mmp2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 0839fb2049e94..50a780274ba0c 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -317,9 +317,9 @@ static const char * const ccic_parent_names[] = {"pll1_2", "pll1_16", "vctcxo"};

 static DEFINE_SPINLOCK(gpu_lock);
 static const char * const mmp2_gpu_gc_parent_names[] =  {"pll1_2", "pll1_3", "pll2_2", "pll2_3", "pll2", "usb_pll"};
-static u32 mmp2_gpu_gc_parent_table[] =          { 0x0000,   0x0040,   0x0080,   0x00c0,   0x1000, 0x1040   };
+static const u32 mmp2_gpu_gc_parent_table[] = { 0x0000,   0x0040,   0x0080,   0x00c0,   0x1000, 0x1040   };
 static const char * const mmp2_gpu_bus_parent_names[] = {"pll1_4", "pll2",   "pll2_2", "usb_pll"};
-static u32 mmp2_gpu_bus_parent_table[] =         { 0x0000,   0x0020,   0x0030,   0x4020   };
+static const u32 mmp2_gpu_bus_parent_table[] = { 0x0000,   0x0020,   0x0030,   0x4020   };
 static const char * const mmp3_gpu_bus_parent_names[] = {"pll1_4", "pll1_6", "pll1_2", "pll2_2"};
 static const char * const mmp3_gpu_gc_parent_names[] =  {"pll1",   "pll2",   "pll1_p", "pll2_p"};

--
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] clk: qcom: Declare mux table as const u32[]
  2022-01-29  9:51 [PATCH 0/5] clk: Declare mux tables as const u32[] Jonathan Neuschäfer
                   ` (2 preceding siblings ...)
  2022-01-29  9:51 ` [PATCH 3/5] clk: mmp: Declare mux tables as const u32[] Jonathan Neuschäfer
@ 2022-01-29  9:51 ` Jonathan Neuschäfer
  2022-01-29  9:51 ` [PATCH 5/5] clk: pistachio: " Jonathan Neuschäfer
  4 siblings, 0 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2022-01-29  9:51 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, Jonathan Neuschäfer, Bjorn Andersson,
	Andy Gross, Michael Turquette, Stephen Boyd, linux-arm-msm

Now that clk_register_mux_table takes a const u32 *, we can declare the
mux tables as const u32[].

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 drivers/clk/qcom/kpss-xcc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c
index 4fec1f9142b82..88d4b33ac0cc3 100644
--- a/drivers/clk/qcom/kpss-xcc.c
+++ b/drivers/clk/qcom/kpss-xcc.c
@@ -17,7 +17,7 @@ static const char *aux_parents[] = {
 	"pxo",
 };

-static unsigned int aux_parent_map[] = {
+static const u32 aux_parent_map[] = {
 	3,
 	0,
 };
--
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] clk: pistachio: Declare mux table as const u32[]
  2022-01-29  9:51 [PATCH 0/5] clk: Declare mux tables as const u32[] Jonathan Neuschäfer
                   ` (3 preceding siblings ...)
  2022-01-29  9:51 ` [PATCH 4/5] clk: qcom: Declare mux table " Jonathan Neuschäfer
@ 2022-01-29  9:51 ` Jonathan Neuschäfer
  4 siblings, 0 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2022-01-29  9:51 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-kernel, Jonathan Neuschäfer, Michael Turquette, Stephen Boyd

Now that clk_register_mux_table takes a const u32 *, we can declare the
mux table as const u32[].

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
 drivers/clk/pistachio/clk-pistachio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/pistachio/clk-pistachio.c b/drivers/clk/pistachio/clk-pistachio.c
index 76f492c7e917e..2a6d583237dc7 100644
--- a/drivers/clk/pistachio/clk-pistachio.c
+++ b/drivers/clk/pistachio/clk-pistachio.c
@@ -154,7 +154,7 @@ static struct pistachio_pll pistachio_plls[] __initdata = {
 PNAME(mux_debug) = { "mips_pll_mux", "rpu_v_pll_mux",
 		     "rpu_l_pll_mux", "sys_pll_mux",
 		     "wifi_pll_mux", "bt_pll_mux" };
-static u32 mux_debug_idx[] = { 0x0, 0x1, 0x2, 0x4, 0x8, 0x10 };
+static const u32 mux_debug_idx[] = { 0x0, 0x1, 0x2, 0x4, 0x8, 0x10 };

 static unsigned int pistachio_critical_clks_core[] __initdata = {
 	CLK_MIPS
--
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/5] clk: mux: Declare u32 *table parameter as const
  2022-01-29  9:51 ` [PATCH 1/5] clk: mux: Declare u32 *table parameter as const Jonathan Neuschäfer
@ 2022-01-31  3:44   ` kernel test robot
  2022-01-31 14:45     ` Jonathan Neuschäfer
  2022-01-31  4:15   ` kernel test robot
  1 sibling, 1 reply; 9+ messages in thread
From: kernel test robot @ 2022-01-31  3:44 UTC (permalink / raw)
  To: Jonathan Neuschäfer, linux-clk
  Cc: kbuild-all, linux-kernel, Jonathan Neuschäfer,
	Michael Turquette, Stephen Boyd

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/5] clk: mux: Declare u32 *table parameter as const
  2022-01-29  9:51 ` [PATCH 1/5] clk: mux: Declare u32 *table parameter as const Jonathan Neuschäfer
  2022-01-31  3:44   ` kernel test robot
@ 2022-01-31  4:15   ` kernel test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2022-01-31  4:15 UTC (permalink / raw)
  To: Jonathan Neuschäfer, linux-clk
  Cc: llvm, kbuild-all, linux-kernel, Jonathan Neuschäfer,
	Michael Turquette, Stephen Boyd

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/5] clk: mux: Declare u32 *table parameter as const
  2022-01-31  3:44   ` kernel test robot
@ 2022-01-31 14:45     ` Jonathan Neuschäfer
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Neuschäfer @ 2022-01-31 14:45 UTC (permalink / raw)
  To: kernel test robot
  Cc: Jonathan Neuschäfer, linux-clk, kbuild-all, linux-kernel,
	Michael Turquette, Stephen Boyd

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-31 14:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-29  9:51 [PATCH 0/5] clk: Declare mux tables as const u32[] Jonathan Neuschäfer
2022-01-29  9:51 ` [PATCH 1/5] clk: mux: Declare u32 *table parameter as const Jonathan Neuschäfer
2022-01-31  3:44   ` kernel test robot
2022-01-31 14:45     ` Jonathan Neuschäfer
2022-01-31  4:15   ` kernel test robot
2022-01-29  9:51 ` [PATCH 2/5] clk: hisilicon: Remove unnecessary cast of mux table to u32 * Jonathan Neuschäfer
2022-01-29  9:51 ` [PATCH 3/5] clk: mmp: Declare mux tables as const u32[] Jonathan Neuschäfer
2022-01-29  9:51 ` [PATCH 4/5] clk: qcom: Declare mux table " Jonathan Neuschäfer
2022-01-29  9:51 ` [PATCH 5/5] clk: pistachio: " Jonathan Neuschäfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).