[PATCH] m68k: coldfire:Add const to clk_ops

Xiang wangx posted 1 patch 3 years, 11 months ago
arch/m68k/coldfire/clk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] m68k: coldfire:Add const to clk_ops
Posted by Xiang wangx 3 years, 11 months ago
Struct clk_ops should normally be const.

Signed-off-by: Xiang wangx <wangxiang@cdjrlc.com>
---
 arch/m68k/coldfire/clk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/coldfire/clk.c b/arch/m68k/coldfire/clk.c
index d03b6c4aa86b..a0cd4c79f0ee 100644
--- a/arch/m68k/coldfire/clk.c
+++ b/arch/m68k/coldfire/clk.c
@@ -50,7 +50,7 @@ static void __clk_disable0(struct clk *clk)
 	__raw_writeb(clk->slot, MCFPM_PPMSR0);
 }
 
-struct clk_ops clk_ops0 = {
+struct const clk_ops clk_ops0 = {
 	.enable		= __clk_enable0,
 	.disable	= __clk_disable0,
 };
@@ -66,7 +66,7 @@ static void __clk_disable1(struct clk *clk)
 	__raw_writeb(clk->slot, MCFPM_PPMSR1);
 }
 
-struct clk_ops clk_ops1 = {
+struct const clk_ops clk_ops1 = {
 	.enable		= __clk_enable1,
 	.disable	= __clk_disable1,
 };
-- 
2.36.1
Re: [PATCH] m68k: coldfire:Add const to clk_ops
Posted by kernel test robot 3 years, 11 months ago
Hi Xiang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on gerg-m68knommu/for-next]
[also build test ERROR on geert-m68k/for-next v5.18 next-20220531]
[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/intel-lab-lkp/linux/commits/Xiang-wangx/m68k-coldfire-Add-const-to-clk_ops/20220530-105531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git for-next
config: m68k-allnoconfig (https://download.01.org/0day-ci/archive/20220531/202205312132.iaViCBtV-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.3.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/intel-lab-lkp/linux/commit/e44f3b73f214f99802c9a010145922eb0a126933
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Xiang-wangx/m68k-coldfire-Add-const-to-clk_ops/20220530-105531
        git checkout e44f3b73f214f99802c9a010145922eb0a126933
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash arch/m68k/coldfire/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> arch/m68k/coldfire/clk.c:53:8: error: expected '{' before 'const'
      53 | struct const clk_ops clk_ops0 = {
         |        ^~~~~
   arch/m68k/coldfire/clk.c:48:13: warning: '__clk_disable0' defined but not used [-Wunused-function]
      48 | static void __clk_disable0(struct clk *clk)
         |             ^~~~~~~~~~~~~~
   arch/m68k/coldfire/clk.c:43:13: warning: '__clk_enable0' defined but not used [-Wunused-function]
      43 | static void __clk_enable0(struct clk *clk)
         |             ^~~~~~~~~~~~~


vim +53 arch/m68k/coldfire/clk.c

    52	
  > 53	struct const clk_ops clk_ops0 = {
    54		.enable		= __clk_enable0,
    55		.disable	= __clk_disable0,
    56	};
    57	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
Re: [PATCH] m68k: coldfire:Add const to clk_ops
Posted by Geert Uytterhoeven 3 years, 11 months ago
Hi Xiang,

On Mon, May 30, 2022 at 4:53 AM Xiang wangx <wangxiang@cdjrlc.com> wrote:
> Struct clk_ops should normally be const.
>
> Signed-off-by: Xiang wangx <wangxiang@cdjrlc.com>

Thanks for your patch!

> --- a/arch/m68k/coldfire/clk.c
> +++ b/arch/m68k/coldfire/clk.c
> @@ -50,7 +50,7 @@ static void __clk_disable0(struct clk *clk)
>         __raw_writeb(clk->slot, MCFPM_PPMSR0);
>  }
>
> -struct clk_ops clk_ops0 = {
> +struct const clk_ops clk_ops0 = {

The "const" should be first on the line.
Please test-compile your patches before submitting them.

>         .enable         = __clk_enable0,
>         .disable        = __clk_disable0,
>  };

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds