Message ID | 20210820165927.4524-4-mihail.chindris@analog.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | iio: Add output buffer support and DAC example | expand |
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@intel.com> 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@lists.01.org
diff --git a/drivers/iio/accel/adxl372.c b/drivers/iio/accel/adxl372.c index fc9592407717..758952584f8c 100644 --- a/drivers/iio/accel/adxl372.c +++ b/drivers/iio/accel/adxl372.c @@ -1214,6 +1214,7 @@ int adxl372_probe(struct device *dev, struct regmap *regmap, ret = devm_iio_triggered_buffer_setup_ext(dev, indio_dev, NULL, adxl372_trigger_handler, + IIO_BUFFER_DIRECTION_IN, &adxl372_buffer_ops, adxl372_fifo_attributes); if (ret < 0) diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index e8693a42ad46..63216321cdb5 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c @@ -1734,6 +1734,7 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, ret = iio_triggered_buffer_setup_ext(indio_dev, &iio_pollfunc_store_time, bmc150_accel_trigger_handler, + IIO_BUFFER_DIRECTION_IN, &bmc150_accel_buffer_ops, fifo_attrs); if (ret < 0) { diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index ea5ca163d879..7093611e321e 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1681,8 +1681,8 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev, fifo_attrs = NULL; ret = devm_iio_triggered_buffer_setup_ext(&indio->dev, indio, - &iio_pollfunc_store_time, - &at91_adc_trigger_handler, &at91_buffer_setup_ops, fifo_attrs); + &iio_pollfunc_store_time, &at91_adc_trigger_handler, + IIO_BUFFER_DIRECTION_IN, &at91_buffer_setup_ops, fifo_attrs); if (ret < 0) { dev_err(dev, "couldn't initialize the buffer.\n"); return ret; diff --git a/drivers/iio/buffer/industrialio-triggered-buffer.c b/drivers/iio/buffer/industrialio-triggered-buffer.c index f77c4538141e..8d4fc97d1005 100644 --- a/drivers/iio/buffer/industrialio-triggered-buffer.c +++ b/drivers/iio/buffer/industrialio-triggered-buffer.c @@ -19,6 +19,7 @@ * @indio_dev: IIO device structure * @h: Function which will be used as pollfunc top half * @thread: Function which will be used as pollfunc bottom half + * @direction: Direction of the data stream (in/out). * @setup_ops: Buffer setup functions to use for this device. * If NULL the default setup functions for triggered * buffers will be used. @@ -38,6 +39,7 @@ int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, irqreturn_t (*h)(int irq, void *p), irqreturn_t (*thread)(int irq, void *p), + enum iio_buffer_direction direction, const struct iio_buffer_setup_ops *setup_ops, const struct attribute **buffer_attrs) { @@ -68,6 +70,7 @@ int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, /* Flag that polled ring buffering is possible */ indio_dev->modes |= INDIO_BUFFER_TRIGGERED; + buffer->direction = direction; buffer->attrs = buffer_attrs; ret = iio_device_attach_buffer(indio_dev, buffer); @@ -105,13 +108,14 @@ int devm_iio_triggered_buffer_setup_ext(struct device *dev, struct iio_dev *indio_dev, irqreturn_t (*h)(int irq, void *p), irqreturn_t (*thread)(int irq, void *p), + enum iio_buffer_direction direction, const struct iio_buffer_setup_ops *ops, const struct attribute **buffer_attrs) { int ret; - ret = iio_triggered_buffer_setup_ext(indio_dev, h, thread, ops, - buffer_attrs); + ret = iio_triggered_buffer_setup_ext(indio_dev, h, thread, direction, + ops, buffer_attrs); if (ret) return ret; diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index 28bde13003b7..e9f64da06f89 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -360,8 +360,9 @@ int cros_ec_sensors_core_init(struct platform_device *pdev, * The only way to get samples in buffer is to set a * software trigger (systrig, hrtimer). */ - ret = devm_iio_triggered_buffer_setup(dev, indio_dev, - NULL, trigger_capture, NULL); + ret = devm_iio_triggered_buffer_setup_ext(dev, + indio_dev, NULL, trigger_capture, + IIO_BUFFER_DIRECTION_IN, NULL); if (ret) return ret; } diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index a4ec11a3b68a..1151434038d4 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c @@ -241,8 +241,9 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, fifo_attrs = NULL; ret = iio_triggered_buffer_setup_ext(indio_dev, - &iio_pollfunc_store_time, - NULL, NULL, fifo_attrs); + &iio_pollfunc_store_time, NULL, + IIO_BUFFER_DIRECTION_IN, + NULL, fifo_attrs); if (ret) { dev_err(&indio_dev->dev, "Triggered Buffer Setup Failed\n"); return ret; diff --git a/include/linux/iio/triggered_buffer.h b/include/linux/iio/triggered_buffer.h index 7f154d1f8739..7490b05fc5b2 100644 --- a/include/linux/iio/triggered_buffer.h +++ b/include/linux/iio/triggered_buffer.h @@ -2,6 +2,7 @@ #ifndef _LINUX_IIO_TRIGGERED_BUFFER_H_ #define _LINUX_IIO_TRIGGERED_BUFFER_H_ +#include <linux/iio/buffer.h> #include <linux/interrupt.h> struct attribute; @@ -11,21 +12,27 @@ struct iio_buffer_setup_ops; int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, irqreturn_t (*h)(int irq, void *p), irqreturn_t (*thread)(int irq, void *p), + enum iio_buffer_direction direction, const struct iio_buffer_setup_ops *setup_ops, const struct attribute **buffer_attrs); void iio_triggered_buffer_cleanup(struct iio_dev *indio_dev); #define iio_triggered_buffer_setup(indio_dev, h, thread, setup_ops) \ - iio_triggered_buffer_setup_ext((indio_dev), (h), (thread), (setup_ops), NULL) + iio_triggered_buffer_setup_ext((indio_dev), (h), (thread), \ + IIO_BUFFER_DIRECTION_IN, (setup_ops), \ + NULL) int devm_iio_triggered_buffer_setup_ext(struct device *dev, struct iio_dev *indio_dev, irqreturn_t (*h)(int irq, void *p), irqreturn_t (*thread)(int irq, void *p), + enum iio_buffer_direction direction, const struct iio_buffer_setup_ops *ops, const struct attribute **buffer_attrs); #define devm_iio_triggered_buffer_setup(dev, indio_dev, h, thread, setup_ops) \ - devm_iio_triggered_buffer_setup_ext((dev), (indio_dev), (h), (thread), (setup_ops), NULL) + devm_iio_triggered_buffer_setup_ext((dev), (indio_dev), (h), (thread), \ + IIO_BUFFER_DIRECTION_IN, \ + (setup_ops), NULL) #endif