Subject: Re: [PATCH v1 2/4] powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode

From: kernel test robot <[email-masked]>
Date: Thu, 5 May 2022 09:03:02 +0800

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on wsa/i2c/for-next mkl-can-next/testing broonie-spi/for-next tty/tty-testing linus/master v5.18-rc5 next-20220504]
[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/Andy-Shevchenko/powerpc-52xx-Remove-dead-code-i-e-mpc52xx_get_xtal_freq/20220504-215701
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-pcm030_defconfig (https://download.01.org/0day-ci/archive/20220505/[email-masked]/config)
compiler: powerpc-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/7bff10cee4f441153a56de337715dd4f40c55521
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Andy-Shevchenko/powerpc-52xx-Remove-dead-code-i-e-mpc52xx_get_xtal_freq/20220504-215701
        git checkout 7bff10cee4f441153a56de337715dd4f40c55521
        # 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=powerpc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All errors (new ones prefixed by >>):

   drivers/i2c/busses/i2c-mpc.c: In function 'mpc_i2c_get_fdr_52xx':
>> drivers/i2c/busses/i2c-mpc.c:242:30: error: expected identifier or '(' before '=' token
     242 |         struct fwnode_handle = of_fwnode_handle(node);
         |                              ^
   In file included from include/linux/of_address.h:6,
                    from drivers/i2c/busses/i2c-mpc.c:14:
>> include/linux/of.h:176:10: error: expected statement before ')' token
     176 |         })
         |          ^
   drivers/i2c/busses/i2c-mpc.c:242:32: note: in expansion of macro 'of_fwnode_handle'
     242 |         struct fwnode_handle = of_fwnode_handle(node);
         |                                ^~~~~~~~~~~~~~~~
   drivers/i2c/busses/i2c-mpc.c:243:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     243 |         const struct mpc_i2c_divider *div = NULL;
         |         ^~~~~
>> drivers/i2c/busses/i2c-mpc.c:250:62: error: 'fwnode' undeclared (first use in this function); did you mean 'node'?
     250 |                 *real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / 2048;
         |                                                              ^~~~~~
         |                                                              node
   drivers/i2c/busses/i2c-mpc.c:250:62: note: each undeclared identifier is reported only once for each function it appears in

vim +242 drivers/i2c/busses/i2c-mpc.c

   238	
   239	static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
   240						  u32 *real_clk)
   241	{
 > 242		struct fwnode_handle = of_fwnode_handle(node);
   243		const struct mpc_i2c_divider *div = NULL;
   244		unsigned int pvr = mfspr(SPRN_PVR);
   245		u32 divider;
   246		int i;
   247	
   248		if (clock == MPC_I2C_CLOCK_LEGACY) {
   249			/* see below - default fdr = 0x3f -> div = 2048 */
 > 250			*real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / 2048;
   251			return -EINVAL;
   252		}
   253	
   254		/* Determine divider value */
   255		divider = mpc5xxx_fwnode_get_bus_frequency(fwnode) / clock;
   256	
   257		/*
   258		 * We want to choose an FDR/DFSR that generates an I2C bus speed that
   259		 * is equal to or lower than the requested speed.
   260		 */
   261		for (i = 0; i < ARRAY_SIZE(mpc_i2c_dividers_52xx); i++) {
   262			div = &mpc_i2c_dividers_52xx[i];
   263			/* Old MPC5200 rev A CPUs do not support the high bits */
   264			if (div->fdr & 0xc0 && pvr == 0x80822011)
   265				continue;
   266			if (div->divider >= divider)
   267				break;
   268		}
   269	
   270		*real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / div->divider;
   271		return (int)div->fdr;
   272	}
   273	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp