Re: [PATCH v4 3/6] iio: triggered-buffer: extend support to configure output buffers

From: kernel test robot
Date: Fri Aug 20 2021 - 23:29:58 EST


Hi Mihail,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on 94a853eca720ac9e385e59f27e859b4a01123f58]

url: https://github.com/0day-ci/linux/commits/Mihail-Chindris/iio-Add-output-buffer-support-and-DAC-example/20210821-010349
base: 94a853eca720ac9e385e59f27e859b4a01123f58
config: i386-randconfig-a002-20210821 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d9c5613e856cf2addfbf892fc4c1ce9ef9feceaa)
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/864c7d5f5d135f37baf9b65d13d186744535a8e4
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Mihail-Chindris/iio-Add-output-buffer-support-and-DAC-example/20210821-010349
git checkout 864c7d5f5d135f37baf9b65d13d186744535a8e4
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=i386 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

clang-14: warning: optimization flag '-falign-jumps=0' is not supported [-Wignored-optimization-argument]
In file included from drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c:9:
In file included from include/linux/device.h:15:
In file included from include/linux/dev_printk.h:16:
In file included from include/linux/ratelimit.h:6:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:27:
In file included from include/linux/preempt.h:78:
In file included from arch/x86/include/asm/preempt.h:7:
In file included from include/linux/thread_info.h:60:
arch/x86/include/asm/thread_info.h:172:13: warning: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Wframe-address]
oldframe = __builtin_frame_address(1);
^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/thread_info.h:174:11: warning: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Wframe-address]
frame = __builtin_frame_address(2);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c:57:41: warning: taking address of packed member 'msg' of class or structure '' may result in an unaligned pointer value [-Waddress-of-packed-member]
ret = cros_ec_cmd_xfer_status(ec_dev, &buf.msg);
^~~~~~~
>> drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c:365:35: error: too few arguments to function call, expected 7, have 6
IIO_BUFFER_DIRECTION_IN, NULL);
^
include/linux/iio/triggered_buffer.h:25:5: note: 'devm_iio_triggered_buffer_setup_ext' declared here
int devm_iio_triggered_buffer_setup_ext(struct device *dev,
^
3 warnings and 1 error generated.


vim +365 drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c

234
235 /**
236 * cros_ec_sensors_core_init() - basic initialization of the core structure
237 * @pdev: platform device created for the sensors
238 * @indio_dev: iio device structure of the device
239 * @physical_device: true if the device refers to a physical device
240 * @trigger_capture: function pointer to call buffer is triggered,
241 * for backward compatibility.
242 * @push_data: function to call when cros_ec_sensorhub receives
243 * a sample for that sensor.
244 *
245 * Return: 0 on success, -errno on failure.
246 */
247 int cros_ec_sensors_core_init(struct platform_device *pdev,
248 struct iio_dev *indio_dev,
249 bool physical_device,
250 cros_ec_sensors_capture_t trigger_capture,
251 cros_ec_sensorhub_push_data_cb_t push_data)
252 {
253 struct device *dev = &pdev->dev;
254 struct cros_ec_sensors_core_state *state = iio_priv(indio_dev);
255 struct cros_ec_sensorhub *sensor_hub = dev_get_drvdata(dev->parent);
256 struct cros_ec_dev *ec = sensor_hub->ec;
257 struct cros_ec_sensor_platform *sensor_platform = dev_get_platdata(dev);
258 u32 ver_mask, temp;
259 int frequencies[ARRAY_SIZE(state->frequencies) / 2] = { 0 };
260 int ret, i;
261
262 platform_set_drvdata(pdev, indio_dev);
263
264 state->ec = ec->ec_dev;
265 state->msg = devm_kzalloc(&pdev->dev,
266 max((u16)sizeof(struct ec_params_motion_sense),
267 state->ec->max_response), GFP_KERNEL);
268 if (!state->msg)
269 return -ENOMEM;
270
271 state->resp = (struct ec_response_motion_sense *)state->msg->data;
272
273 mutex_init(&state->cmd_lock);
274
275 ret = cros_ec_get_host_cmd_version_mask(state->ec,
276 ec->cmd_offset,
277 EC_CMD_MOTION_SENSE_CMD,
278 &ver_mask);
279 if (ret < 0)
280 return ret;
281
282 /* Set up the host command structure. */
283 state->msg->version = fls(ver_mask) - 1;
284 state->msg->command = EC_CMD_MOTION_SENSE_CMD + ec->cmd_offset;
285 state->msg->outsize = sizeof(struct ec_params_motion_sense);
286
287 indio_dev->name = pdev->name;
288
289 if (physical_device) {
290 state->param.cmd = MOTIONSENSE_CMD_INFO;
291 state->param.info.sensor_num = sensor_platform->sensor_num;
292 ret = cros_ec_motion_send_host_cmd(state, 0);
293 if (ret) {
294 dev_warn(dev, "Can not access sensor info\n");
295 return ret;
296 }
297 state->type = state->resp->info.type;
298 state->loc = state->resp->info.location;
299
300 /* Set sign vector, only used for backward compatibility. */
301 memset(state->sign, 1, CROS_EC_SENSOR_MAX_AXIS);
302
303 for (i = CROS_EC_SENSOR_X; i < CROS_EC_SENSOR_MAX_AXIS; i++)
304 state->calib[i].scale = MOTION_SENSE_DEFAULT_SCALE;
305
306 /* 0 is a correct value used to stop the device */
307 if (state->msg->version < 3) {
308 get_default_min_max_freq(state->resp->info.type,
309 &frequencies[1],
310 &frequencies[2],
311 &state->fifo_max_event_count);
312 } else {
313 if (state->resp->info_3.max_frequency == 0) {
314 get_default_min_max_freq(state->resp->info.type,
315 &frequencies[1],
316 &frequencies[2],
317 &temp);
318 } else {
319 frequencies[1] = state->resp->info_3.min_frequency;
320 frequencies[2] = state->resp->info_3.max_frequency;
321 }
322 state->fifo_max_event_count = state->resp->info_3.fifo_max_event_count;
323 }
324 for (i = 0; i < ARRAY_SIZE(frequencies); i++) {
325 state->frequencies[2 * i] = frequencies[i] / 1000;
326 state->frequencies[2 * i + 1] =
327 (frequencies[i] % 1000) * 1000;
328 }
329
330 if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) {
331 /*
332 * Create a software buffer, feed by the EC FIFO.
333 * We can not use trigger here, as events are generated
334 * as soon as sample_frequency is set.
335 */
336 ret = devm_iio_kfifo_buffer_setup_ext(dev, indio_dev,
337 INDIO_BUFFER_SOFTWARE, NULL,
338 cros_ec_sensor_fifo_attributes);
339 if (ret)
340 return ret;
341
342 ret = cros_ec_sensorhub_register_push_data(
343 sensor_hub, sensor_platform->sensor_num,
344 indio_dev, push_data);
345 if (ret)
346 return ret;
347
348 ret = devm_add_action_or_reset(
349 dev, cros_ec_sensors_core_clean, pdev);
350 if (ret)
351 return ret;
352
353 /* Timestamp coming from FIFO are in ns since boot. */
354 ret = iio_device_set_clock(indio_dev, CLOCK_BOOTTIME);
355 if (ret)
356 return ret;
357
358 } else {
359 /*
360 * The only way to get samples in buffer is to set a
361 * software trigger (systrig, hrtimer).
362 */
363 ret = devm_iio_triggered_buffer_setup_ext(dev,
364 indio_dev, NULL, trigger_capture,
> 365 IIO_BUFFER_DIRECTION_IN, NULL);
366 if (ret)
367 return ret;
368 }
369 }
370
371 return 0;
372 }
373 EXPORT_SYMBOL_GPL(cros_ec_sensors_core_init);
374

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

Attachment: .config.gz
Description: application/gzip