Re: [PATCH 14/33] spmi: add hisi-spmi-controller to the building system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mauro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on regulator/for-next robh/for-next linus/master v5.8 next-20200811]
[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/Mauro-Carvalho-Chehab/Add-driver-for-HiSilicon-SPMI-PMIC-for-Hikey-970/20200811-234737
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: arc-allyesconfig (attached as .config)
compiler: arc-elf-gcc (GCC) 9.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/spmi/hisi-spmi-controller.c:7:
   drivers/spmi/hisi-spmi-controller.c: In function 'spmi_read_cmd':
>> drivers/spmi/hisi-spmi-controller.c:149:5: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     149 |   , "spmi_controller supports 1..%d bytes per trans, but:%ld requested"
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/spmi/hisi-spmi-controller.c:148:3: note: in expansion of macro 'dev_err'
     148 |   dev_err(spmi_controller->dev
         |   ^~~~~~~
   drivers/spmi/hisi-spmi-controller.c:149:60: note: format string is defined here
     149 |   , "spmi_controller supports 1..%d bytes per trans, but:%ld requested"
         |                                                          ~~^
         |                                                            |
         |                                                            long int
         |                                                          %d
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/spmi/hisi-spmi-controller.c:7:
   drivers/spmi/hisi-spmi-controller.c:198:33: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     198 |   dev_err(spmi_controller->dev, "spmi read wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/spmi/hisi-spmi-controller.c:198:3: note: in expansion of macro 'dev_err'
     198 |   dev_err(spmi_controller->dev, "spmi read wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |   ^~~~~~~
   drivers/spmi/hisi-spmi-controller.c:198:87: note: format string is defined here
     198 |   dev_err(spmi_controller->dev, "spmi read wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |                                                                                     ~~^
         |                                                                                       |
         |                                                                                       long int
         |                                                                                     %d
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/spmi/hisi-spmi-controller.c:7:
   drivers/spmi/hisi-spmi-controller.c: In function 'spmi_write_cmd':
   drivers/spmi/hisi-spmi-controller.c:220:5: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     220 |   , "spmi_controller supports 1..%d bytes per trans, but:%ld requested"
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/spmi/hisi-spmi-controller.c:219:3: note: in expansion of macro 'dev_err'
     219 |   dev_err(spmi_controller->dev
         |   ^~~~~~~
   drivers/spmi/hisi-spmi-controller.c:220:60: note: format string is defined here
     220 |   , "spmi_controller supports 1..%d bytes per trans, but:%ld requested"
         |                                                          ~~^
         |                                                            |
         |                                                            long int
         |                                                          %d
   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/spmi/hisi-spmi-controller.c:7:
   drivers/spmi/hisi-spmi-controller.c:269:33: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     269 |   dev_err(spmi_controller->dev, "spmi write wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/spmi/hisi-spmi-controller.c:269:3: note: in expansion of macro 'dev_err'
     269 |   dev_err(spmi_controller->dev, "spmi write wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |   ^~~~~~~
   drivers/spmi/hisi-spmi-controller.c:269:88: note: format string is defined here
     269 |   dev_err(spmi_controller->dev, "spmi write wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
         |                                                                                      ~~^
         |                                                                                        |
         |                                                                                        long int
         |                                                                                      %d

vim +149 drivers/spmi/hisi-spmi-controller.c

3f5f1801bf6c4a3 Mayulong              2020-08-11  135  
3f5f1801bf6c4a3 Mayulong              2020-08-11  136  static int spmi_read_cmd(struct spmi_controller *ctrl,
a93f9ffda101599 Mauro Carvalho Chehab 2020-08-11  137  			 u8 opc, u8 sid, u16 addr, u8 *__buf, size_t bc)
3f5f1801bf6c4a3 Mayulong              2020-08-11  138  {
3f5f1801bf6c4a3 Mayulong              2020-08-11  139  	struct spmi_controller_dev *spmi_controller = dev_get_drvdata(&ctrl->dev);
3f5f1801bf6c4a3 Mayulong              2020-08-11  140  	unsigned long flags;
a93f9ffda101599 Mauro Carvalho Chehab 2020-08-11  141  	u8 *buf = __buf;
3f5f1801bf6c4a3 Mayulong              2020-08-11  142  	u32 cmd, data;
3f5f1801bf6c4a3 Mayulong              2020-08-11  143  	int rc;
3f5f1801bf6c4a3 Mayulong              2020-08-11  144  	u32 chnl_ofst = SPMI_CHANNEL_OFFSET * spmi_controller->channel;
3f5f1801bf6c4a3 Mayulong              2020-08-11  145  	u8 op_code, i;
3f5f1801bf6c4a3 Mayulong              2020-08-11  146  
3f5f1801bf6c4a3 Mayulong              2020-08-11  147  	if (bc > SPMI_CONTROLLER_MAX_TRANS_BYTES) {
3f5f1801bf6c4a3 Mayulong              2020-08-11  148  		dev_err(spmi_controller->dev
3f5f1801bf6c4a3 Mayulong              2020-08-11 @149  		, "spmi_controller supports 1..%d bytes per trans, but:%ld requested"
3f5f1801bf6c4a3 Mayulong              2020-08-11  150  					, SPMI_CONTROLLER_MAX_TRANS_BYTES, bc);
3f5f1801bf6c4a3 Mayulong              2020-08-11  151  		return  -EINVAL;
3f5f1801bf6c4a3 Mayulong              2020-08-11  152  	}
3f5f1801bf6c4a3 Mayulong              2020-08-11  153  
3f5f1801bf6c4a3 Mayulong              2020-08-11  154  	/* Check the opcode */
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  155  	if (opc == SPMI_CMD_READ) {
3f5f1801bf6c4a3 Mayulong              2020-08-11  156  		op_code = SPMI_CMD_REG_READ;
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  157  	} else if (opc == SPMI_CMD_EXT_READ) {
3f5f1801bf6c4a3 Mayulong              2020-08-11  158  		op_code = SPMI_CMD_EXT_REG_READ;
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  159  	} else if (opc == SPMI_CMD_EXT_READL) {
3f5f1801bf6c4a3 Mayulong              2020-08-11  160  		op_code = SPMI_CMD_EXT_REG_READ_L;
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  161  	} else {
3f5f1801bf6c4a3 Mayulong              2020-08-11  162  		dev_err(spmi_controller->dev, "invalid read cmd 0x%x", opc);
3f5f1801bf6c4a3 Mayulong              2020-08-11  163  		return -EINVAL;
3f5f1801bf6c4a3 Mayulong              2020-08-11  164  	}
3f5f1801bf6c4a3 Mayulong              2020-08-11  165  
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  166  	cmd = SPMI_APB_SPMI_CMD_EN |
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  167  	     (op_code << SPMI_APB_SPMI_CMD_TYPE_OFFSET) |
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  168  	     ((bc - 1) << SPMI_APB_SPMI_CMD_LENGTH_OFFSET) |
3f5f1801bf6c4a3 Mayulong              2020-08-11  169  	     ((sid & 0xf) << SPMI_APB_SPMI_CMD_SLAVEID_OFFSET) |  /* slvid */
3f5f1801bf6c4a3 Mayulong              2020-08-11  170  	     ((addr & 0xffff)  << SPMI_APB_SPMI_CMD_ADDR_OFFSET); /* slave_addr */
3f5f1801bf6c4a3 Mayulong              2020-08-11  171  
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  172  	spin_lock_irqsave(&spmi_controller->lock, flags);
3f5f1801bf6c4a3 Mayulong              2020-08-11  173  
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  174  	writel(cmd, spmi_controller->base + chnl_ofst + SPMI_APB_SPMI_CMD_BASE_ADDR);
3f5f1801bf6c4a3 Mayulong              2020-08-11  175  
afd5339d05a6fd2 Mauro Carvalho Chehab 2020-08-11  176  	rc = spmi_controller_wait_for_done(spmi_controller,
afd5339d05a6fd2 Mauro Carvalho Chehab 2020-08-11  177  					   spmi_controller->base, sid, addr);
3f5f1801bf6c4a3 Mayulong              2020-08-11  178  	if (rc)
3f5f1801bf6c4a3 Mayulong              2020-08-11  179  		goto done;
3f5f1801bf6c4a3 Mayulong              2020-08-11  180  
3f5f1801bf6c4a3 Mayulong              2020-08-11  181  	i = 0;
3f5f1801bf6c4a3 Mayulong              2020-08-11  182  	do {
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  183  		data = readl(spmi_controller->base + chnl_ofst + SPMI_SLAVE_OFFSET * sid + SPMI_APB_SPMI_RDATA0_BASE_ADDR + i * SPMI_PER_DATAREG_BYTE);
afd5339d05a6fd2 Mauro Carvalho Chehab 2020-08-11  184  		data = be32_to_cpu((__be32)data);
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  185  		if ((bc - i * SPMI_PER_DATAREG_BYTE) >> 2) {
3f5f1801bf6c4a3 Mayulong              2020-08-11  186  			memcpy(buf, &data, sizeof(data));
3f5f1801bf6c4a3 Mayulong              2020-08-11  187  			buf += sizeof(data);
3f5f1801bf6c4a3 Mayulong              2020-08-11  188  		} else {
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  189  			memcpy(buf, &data, bc % SPMI_PER_DATAREG_BYTE);
3f5f1801bf6c4a3 Mayulong              2020-08-11  190  			buf += (bc % SPMI_PER_DATAREG_BYTE);
3f5f1801bf6c4a3 Mayulong              2020-08-11  191  		}
3f5f1801bf6c4a3 Mayulong              2020-08-11  192  		i++;
3f5f1801bf6c4a3 Mayulong              2020-08-11  193  	} while (bc > i * SPMI_PER_DATAREG_BYTE);
3f5f1801bf6c4a3 Mayulong              2020-08-11  194  
3f5f1801bf6c4a3 Mayulong              2020-08-11  195  done:
3f5f1801bf6c4a3 Mayulong              2020-08-11  196  	spin_unlock_irqrestore(&spmi_controller->lock, flags);
3f5f1801bf6c4a3 Mayulong              2020-08-11  197  	if (rc)
3f5f1801bf6c4a3 Mayulong              2020-08-11  198  		dev_err(spmi_controller->dev, "spmi read wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
3f5f1801bf6c4a3 Mayulong              2020-08-11  199  			opc, sid, addr, bc + 1);
a93f9ffda101599 Mauro Carvalho Chehab 2020-08-11  200  	else
a93f9ffda101599 Mauro Carvalho Chehab 2020-08-11  201  		dev_dbg(spmi_controller->dev, "%s: id:%d addr:0x%x, read value: %*ph\n",
a93f9ffda101599 Mauro Carvalho Chehab 2020-08-11  202  			__func__, sid, addr, (int)bc, __buf);
a93f9ffda101599 Mauro Carvalho Chehab 2020-08-11  203  
3f5f1801bf6c4a3 Mayulong              2020-08-11  204  	return rc;
43091a1c2b8d45e Mauro Carvalho Chehab 2020-08-11  205  }
3f5f1801bf6c4a3 Mayulong              2020-08-11  206  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux