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

kernel test robot lkp at intel.com
Thu May 5 08:27:02 AEST 2022


Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING 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/202205050659.ppSbPqfb-lkp@intel.com/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 drivers/i2c/busses/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (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 +243 drivers/i2c/busses/i2c-mpc.c

f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  238  
0b255e927d47b55 Bill Pemberton      2012-11-27  239  static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
38a99bd7730efdd Arseny Solokha      2018-01-10  240  					  u32 *real_clk)
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  241  {
7bff10cee4f4411 Andy Shevchenko     2022-05-04  242  	struct fwnode_handle = of_fwnode_handle(node);
1904b03430ade1c Wolfgang Grandegger 2009-04-09 @243  	const struct mpc_i2c_divider *div = NULL;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  244  	unsigned int pvr = mfspr(SPRN_PVR);
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  245  	u32 divider;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  246  	int i;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  247  
0c2daaafcdec726 Albrecht Dreß       2010-02-17  248  	if (clock == MPC_I2C_CLOCK_LEGACY) {
0c2daaafcdec726 Albrecht Dreß       2010-02-17  249  		/* see below - default fdr = 0x3f -> div = 2048 */
7bff10cee4f4411 Andy Shevchenko     2022-05-04  250  		*real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / 2048;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  251  		return -EINVAL;
0c2daaafcdec726 Albrecht Dreß       2010-02-17  252  	}
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  253  
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  254  	/* Determine divider value */
7bff10cee4f4411 Andy Shevchenko     2022-05-04  255  	divider = mpc5xxx_fwnode_get_bus_frequency(fwnode) / clock;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  256  
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  257  	/*
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  258  	 * We want to choose an FDR/DFSR that generates an I2C bus speed that
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  259  	 * is equal to or lower than the requested speed.
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  260  	 */
1904b03430ade1c Wolfgang Grandegger 2009-04-09  261  	for (i = 0; i < ARRAY_SIZE(mpc_i2c_dividers_52xx); i++) {
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  262  		div = &mpc_i2c_dividers_52xx[i];
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  263  		/* Old MPC5200 rev A CPUs do not support the high bits */
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  264  		if (div->fdr & 0xc0 && pvr == 0x80822011)
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  265  			continue;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  266  		if (div->divider >= divider)
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  267  			break;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  268  	}
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  269  
7bff10cee4f4411 Andy Shevchenko     2022-05-04  270  	*real_clk = mpc5xxx_fwnode_get_bus_frequency(fwnode) / div->divider;
0c2daaafcdec726 Albrecht Dreß       2010-02-17  271  	return (int)div->fdr;
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  272  }
f2bd5efe7238149 Wolfgang Grandegger 2009-04-07  273  

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


More information about the Linuxppc-dev mailing list