Re: [PATCH 2/2] iio: chemical: Add driver support for sgp40

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

 



Hi Andreas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on robh/for-next linus/master v5.14-rc3 next-20210727]
[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/Andreas-Klinger/iio-chemical-Add-support-for-sgp40-gas-sensor/20210728-003718
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 10.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/0day-ci/linux/commit/6e2c78f8b661002ac418f2782ddc79352b6f04a3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andreas-Klinger/iio-chemical-Add-support-for-sgp40-gas-sensor/20210728-003718
        git checkout 6e2c78f8b661002ac418f2782ddc79352b6f04a3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=sparc 

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

All warnings (new ones prefixed by >>):

   drivers/iio/chemical/sgp40.c:67:5: warning: no previous prototype for 'sqp40_exp100' [-Wmissing-prototypes]
      67 | int sqp40_exp100(int n)
         |     ^~~~~~~~~~~~
   In file included from include/linux/device.h:15,
                    from include/linux/iio/iio.h:10,
                    from drivers/iio/chemical/sgp40.c:26:
   drivers/iio/chemical/sgp40.c: In function 'sgp40_measure_raw':
>> drivers/iio/chemical/sgp40.c:143:23: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
     143 |   dev_warn(data->dev, "i2c_master_send ret: %d sizeof: %d\n", ret, sizeof(tg));
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/iio/chemical/sgp40.c:143:3: note: in expansion of macro 'dev_warn'
     143 |   dev_warn(data->dev, "i2c_master_send ret: %d sizeof: %d\n", ret, sizeof(tg));
         |   ^~~~~~~~
   drivers/iio/chemical/sgp40.c:143:57: note: format string is defined here
     143 |   dev_warn(data->dev, "i2c_master_send ret: %d sizeof: %d\n", ret, sizeof(tg));
         |                                                        ~^
         |                                                         |
         |                                                         int
         |                                                        %ld
   In file included from include/linux/device.h:15,
                    from include/linux/iio/iio.h:10,
                    from drivers/iio/chemical/sgp40.c:26:
   drivers/iio/chemical/sgp40.c:152:23: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
     152 |   dev_warn(data->dev, "i2c_master_recv ret: %d sizeof: %d\n", ret, sizeof(buf));
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/iio/chemical/sgp40.c:152:3: note: in expansion of macro 'dev_warn'
     152 |   dev_warn(data->dev, "i2c_master_recv ret: %d sizeof: %d\n", ret, sizeof(buf));
         |   ^~~~~~~~
   drivers/iio/chemical/sgp40.c:152:57: note: format string is defined here
     152 |   dev_warn(data->dev, "i2c_master_recv ret: %d sizeof: %d\n", ret, sizeof(buf));
         |                                                        ~^
         |                                                         |
         |                                                         int
         |                                                        %ld


vim +143 drivers/iio/chemical/sgp40.c

   118	
   119	static int sgp40_measure_raw(struct sgp40_data *data, u16 *raw)
   120	{
   121		int ret;
   122		struct i2c_client *client = data->client;
   123		u16 buf_be16;
   124		u8 buf[3];
   125		u8 tg[8];
   126		u32 ticks;
   127		u8 crc;
   128	
   129		memcpy(tg, sgp40_measure_raw_tg, 2);
   130	
   131		ticks = (data->rel_humidity / 10) * 65535 / 10000;
   132		buf_be16 = cpu_to_be16((u16)ticks);
   133		memcpy(&tg[2], &buf_be16, 2);
   134		tg[4] = crc8(sgp40_crc8_table, &tg[2], 2, SGP40_CRC8_INIT);
   135	
   136		ticks = ((data->temperature + 45000) / 10) * 65535 / 17500;
   137		buf_be16 = cpu_to_be16((u16)ticks);
   138		memcpy(&tg[5], &buf_be16, 2);
   139		tg[7] = crc8(sgp40_crc8_table, &tg[5], 2, SGP40_CRC8_INIT);
   140	
   141		ret = i2c_master_send(client, (const char *)tg, sizeof(tg));
   142		if (ret != sizeof(tg)) {
 > 143			dev_warn(data->dev, "i2c_master_send ret: %d sizeof: %d\n", ret, sizeof(tg));
   144			return -EIO;
   145		}
   146		msleep(30);
   147	
   148		ret = i2c_master_recv(client, buf, sizeof(buf));
   149		if (ret < 0)
   150			return ret;
   151		if (ret != sizeof(buf)) {
   152			dev_warn(data->dev, "i2c_master_recv ret: %d sizeof: %d\n", ret, sizeof(buf));
   153			return -EIO;
   154		}
   155	
   156		crc = crc8(sgp40_crc8_table, buf, 2, SGP40_CRC8_INIT);
   157		if (crc != buf[2]) {
   158			dev_err(data->dev, "CRC error while measure-raw\n");
   159			return -EIO;
   160		}
   161	
   162		memcpy(&buf_be16, buf, sizeof(buf_be16));
   163		*raw = be16_to_cpu(buf_be16);
   164	
   165		return 0;
   166	}
   167	

---
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]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux