All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: marius.cristea@microchip.com, jic23@kernel.org, lars@metafoo.de,
	robh+dt@kernel.org, jdelvare@suse.com, linux@roeck-us.net,
	linux-hwmon@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, marius.cristea@microchip.com
Subject: Re: [PATCH v3 2/2] iio: adc: adding support for PAC193x
Date: Tue, 21 Nov 2023 23:56:54 +0800	[thread overview]
Message-ID: <202311212310.QEKkmOfh-lkp@intel.com> (raw)
In-Reply-To: <20231115134453.6656-3-marius.cristea@microchip.com>

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 5e99f692d4e32e3250ab18d511894ca797407aec]

url:    https://github.com/intel-lab-lkp/linux/commits/marius-cristea-microchip-com/dt-bindings-iio-adc-adding-support-for-PAC193X/20231115-214733
base:   5e99f692d4e32e3250ab18d511894ca797407aec
patch link:    https://lore.kernel.org/r/20231115134453.6656-3-marius.cristea%40microchip.com
patch subject: [PATCH v3 2/2] iio: adc: adding support for PAC193x
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20231121/202311212310.QEKkmOfh-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231121/202311212310.QEKkmOfh-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311212310.QEKkmOfh-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iio/adc/pac1934.c:1239:3: warning: variable 'cnt' is incremented both in the loop header and in the loop body [-Wfor-loop-analysis]
    1239 |                 cnt++;
         |                 ^
   drivers/iio/adc/pac1934.c:1236:44: note: incremented here
    1236 |         for (cnt = 0;  cnt < info->phys_channels; cnt++) {
         |                                                   ^
   1 warning generated.


vim +/cnt +1239 drivers/iio/adc/pac1934.c

  1226	
  1227	static int pac1934_chip_configure(struct pac1934_chip_info *info)
  1228	{
  1229		int cnt, ret;
  1230		struct i2c_client *client = info->client;
  1231		u8 regs[PAC1934_CTRL_STATUS_INFO_LEN], idx, ctrl_reg;
  1232		u32 wait_time;
  1233	
  1234		cnt = 0;
  1235		info->chip_reg_data.num_enabled_channels = 0;
  1236		for (cnt = 0;  cnt < info->phys_channels; cnt++) {
  1237			if (info->active_channels[cnt])
  1238				info->chip_reg_data.num_enabled_channels++;
> 1239			cnt++;
  1240		}
  1241	
  1242		/*
  1243		 * read whatever information was gathered before the driver was loaded
  1244		 * establish which channels are enabled/disabled and then establish the
  1245		 * information retrieval mode (using SKIP or no).
  1246		 * Read the chip ID values
  1247		 */
  1248		ret = i2c_smbus_read_i2c_block_data(client, PAC1934_CTRL_STAT_REGS_ADDR,
  1249						    sizeof(regs),
  1250						    (u8 *)regs);
  1251		if (ret < 0) {
  1252			dev_err_probe(&client->dev, ret,
  1253				      "%s - cannot read regs from 0x%02X\n",
  1254				      __func__, PAC1934_CTRL_STAT_REGS_ADDR);
  1255			return ret;
  1256		}
  1257	
  1258		/* write the CHANNEL_DIS and the NEG_PWR registers */
  1259		regs[PAC1934_CHANNEL_DIS_REG_OFF] =
  1260			FIELD_PREP(PAC1934_CHAN_DIS_CH1_OFF_MASK, !(info->active_channels[PAC1934_CH_1])) |
  1261			FIELD_PREP(PAC1934_CHAN_DIS_CH2_OFF_MASK, !(info->active_channels[PAC1934_CH_2])) |
  1262			FIELD_PREP(PAC1934_CHAN_DIS_CH3_OFF_MASK, !(info->active_channels[PAC1934_CH_3])) |
  1263			FIELD_PREP(PAC1934_CHAN_DIS_CH4_OFF_MASK, !(info->active_channels[PAC1934_CH_4])) |
  1264			FIELD_PREP(PAC1934_SMBUS_TIMEOUT_MASK, 0) |
  1265			FIELD_PREP(PAC1934_SMBUS_BYTECOUNT_MASK, 0) |
  1266			FIELD_PREP(PAC1934_SMBUS_NO_SKIP_MASK, 0);
  1267	
  1268		regs[PAC1934_NEG_PWR_REG_OFF] =
  1269			FIELD_PREP(PAC1934_NEG_PWR_CH1_BIDI_MASK, info->bi_dir[PAC1934_CH_1]) |
  1270			FIELD_PREP(PAC1934_NEG_PWR_CH2_BIDI_MASK, info->bi_dir[PAC1934_CH_2]) |
  1271			FIELD_PREP(PAC1934_NEG_PWR_CH3_BIDI_MASK, info->bi_dir[PAC1934_CH_3]) |
  1272			FIELD_PREP(PAC1934_NEG_PWR_CH4_BIDI_MASK, info->bi_dir[PAC1934_CH_4]) |
  1273			FIELD_PREP(PAC1934_NEG_PWR_CH1_BIDV_MASK, info->bi_dir[PAC1934_CH_1]) |
  1274			FIELD_PREP(PAC1934_NEG_PWR_CH2_BIDV_MASK, info->bi_dir[PAC1934_CH_2]) |
  1275			FIELD_PREP(PAC1934_NEG_PWR_CH3_BIDV_MASK, info->bi_dir[PAC1934_CH_3]) |
  1276			FIELD_PREP(PAC1934_NEG_PWR_CH4_BIDV_MASK, info->bi_dir[PAC1934_CH_4]);
  1277	
  1278		/* no SLOW triggered REFRESH, clear POR */
  1279		regs[PAC1934_SLOW_REG_OFF] = 0;
  1280	
  1281		ret =  i2c_smbus_write_block_data(client, PAC1934_CTRL_STAT_REGS_ADDR, 3, (u8 *)regs);
  1282		if (ret)
  1283			return ret;
  1284	
  1285		ctrl_reg = FIELD_PREP(PAC1934_CRTL_SAMPLE_RATE_MASK, info->crt_samp_spd_bitfield);
  1286	
  1287		ret = i2c_smbus_write_byte_data(client, PAC1934_CTRL_REG_ADDR, ctrl_reg);
  1288		if (ret)
  1289			return ret;
  1290	
  1291		/*
  1292		 * send a REFRESH to the chip, so the new settings take place
  1293		 * as well as resetting the accumulators
  1294		 */
  1295		ret = i2c_smbus_write_byte(client, PAC1934_REFRESH_REG_ADDR);
  1296		if (ret) {
  1297			dev_err(&client->dev,
  1298				"%s - cannot send 0x%02X\n",
  1299				__func__, PAC1934_REFRESH_REG_ADDR);
  1300			return ret;
  1301		}
  1302	
  1303		/*
  1304		 * get the current(in the chip) sampling speed and compute the
  1305		 * required timeout based on its value
  1306		 * the timeout is 1/sampling_speed
  1307		 */
  1308		idx = regs[PAC1934_CTRL_ACT_REG_OFF] >> PAC1934_SAMPLE_RATE_SHIFT;
  1309		wait_time = (1024 / samp_rate_map_tbl[idx]) * 1000;
  1310	
  1311		/*
  1312		 * wait the maximum amount of time to be on the safe side
  1313		 * the maximum wait time is for 8sps
  1314		 */
  1315		usleep_range(wait_time, wait_time + 100);
  1316	
  1317		INIT_DELAYED_WORK(&info->work_chip_rfsh, pac1934_work_periodic_rfsh);
  1318		/* Setup the latest moment for reading the regs before saturation */
  1319		schedule_delayed_work(&info->work_chip_rfsh,
  1320				      msecs_to_jiffies(PAC1934_MAX_RFSH_LIMIT_MS));
  1321	
  1322		devm_add_action_or_reset(&client->dev, pac1934_cancel_delayed_work,
  1323					 &info->work_chip_rfsh);
  1324	
  1325		return 0;
  1326	}
  1327	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2023-11-21 15:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 13:44 [PATCH v3 0/2] adding support for Microchip PAC193X Power Monitor marius.cristea
2023-11-15 13:44 ` [PATCH v3 1/2] dt-bindings: iio: adc: adding support for PAC193X marius.cristea
2023-11-16 15:01   ` Krzysztof Kozlowski
2023-11-16 18:21     ` Conor Dooley
2023-11-16 20:00       ` Krzysztof Kozlowski
2023-11-16 21:31         ` Conor Dooley
2023-11-25 19:47       ` Jonathan Cameron
2023-11-26 11:24         ` Conor Dooley
2023-11-26 16:04           ` Jonathan Cameron
2023-11-30 15:53             ` Conor Dooley
2023-11-15 13:44 ` [PATCH v3 2/2] iio: adc: adding support for PAC193x marius.cristea
2023-11-21 15:56   ` kernel test robot [this message]
2023-11-25 20:37   ` Jonathan Cameron
2023-11-15 19:38 ` [PATCH v3 0/2] adding support for Microchip PAC193X Power Monitor Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202311212310.QEKkmOfh-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=llvm@lists.linux.dev \
    --cc=marius.cristea@microchip.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.