Re: [PATCH] staging: comedi: remove warnings of comedi_lrange
From: kernel test robot
Date: Mon Dec 28 2020 - 23:00:06 EST
Hi chensong,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/0day-ci/linux/commits/chensong/staging-comedi-remove-warnings-of-comedi_lrange/20201223-104542
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 5e60366d56c630e32befce7ef05c569e04391ca3
config: x86_64-randconfig-a011-20201223 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/fec78f1f56c0e63e9240b5b30c3b98d29ecc9a49
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review chensong/staging-comedi-remove-warnings-of-comedi_lrange/20201223-104542
git checkout fec78f1f56c0e63e9240b5b30c3b98d29ecc9a49
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
>> drivers/staging/comedi/drivers/jr3_pci.c:527:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[0].l.range[0].min = -get_s16(&fs->fx) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:528:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[0].l.range[0].max = get_s16(&fs->fx) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:529:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[1].l.range[0].min = -get_s16(&fs->fy) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:530:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[1].l.range[0].max = get_s16(&fs->fy) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:531:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[2].l.range[0].min = -get_s16(&fs->fz) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:532:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[2].l.range[0].max = get_s16(&fs->fz) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:533:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[3].l.range[0].min = -get_s16(&fs->mx) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:534:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[3].l.range[0].max = get_s16(&fs->mx) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:535:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[4].l.range[0].min = -get_s16(&fs->my) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:536:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[4].l.range[0].max = get_s16(&fs->my) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:537:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[5].l.range[0].min = -get_s16(&fs->mz) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:539:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[5].l.range[0].max = get_s16(&fs->mz) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:540:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[6].l.range[0].min = -get_s16(&fs->v1) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:541:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[6].l.range[0].max = get_s16(&fs->v1) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:542:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[7].l.range[0].min = -get_s16(&fs->v2) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:543:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[7].l.range[0].max = get_s16(&fs->v2) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:544:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[8].l.range[0].min = 0;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
vim +527 drivers/staging/comedi/drivers/jr3_pci.c
07b509e6584a552 Anders Blomdell 2009-02-12 437
d5e59c967830f99 Anson Jacob 2016-08-26 438 static struct jr3_pci_poll_delay
d5e59c967830f99 Anson Jacob 2016-08-26 439 jr3_pci_poll_subdevice(struct comedi_subdevice *s)
07b509e6584a552 Anders Blomdell 2009-02-12 440 {
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 441 struct jr3_pci_subdev_private *spriv = s->private;
da1331a50315a0a H Hartley Sweeten 2014-03-07 442 struct jr3_pci_poll_delay result = poll_delay_min_max(1000, 2000);
713eab88c66de4e Ian Abbott 2017-03-08 443 struct jr3_sensor __iomem *sensor;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 444 u16 model_no;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 445 u16 serial_no;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 446 int errors;
b1f68dc1d610159 Ian Abbott 2009-09-21 447 int i;
07b509e6584a552 Anders Blomdell 2009-02-12 448
713eab88c66de4e Ian Abbott 2017-03-08 449 sensor = spriv->sensor;
713eab88c66de4e Ian Abbott 2017-03-08 450 errors = get_u16(&sensor->errors);
7803d8e05d63d74 Kumar Amit Mehta 2012-11-07 451
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 452 if (errors != spriv->errors)
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 453 spriv->errors = errors;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 454
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 455 /* Sensor communication lost? force poll mode */
7803d8e05d63d74 Kumar Amit Mehta 2012-11-07 456 if (errors & (watch_dog | watch_dog2 | sensor_change))
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 457 spriv->state = state_jr3_poll;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 458
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 459 switch (spriv->state) {
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 460 case state_jr3_poll:
713eab88c66de4e Ian Abbott 2017-03-08 461 model_no = get_u16(&sensor->model_no);
713eab88c66de4e Ian Abbott 2017-03-08 462 serial_no = get_u16(&sensor->serial_no);
07b509e6584a552 Anders Blomdell 2009-02-12 463
07b509e6584a552 Anders Blomdell 2009-02-12 464 if ((errors & (watch_dog | watch_dog2)) ||
07b509e6584a552 Anders Blomdell 2009-02-12 465 model_no == 0 || serial_no == 0) {
2696fb57e6af653 Bill Pemberton 2009-03-27 466 /*
abcdc99f7cb387f Ian Abbott 2012-11-01 467 * Still no sensor, keep on polling.
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 468 * Since it takes up to 10 seconds for offsets to
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 469 * stabilize, polling each second should suffice.
2696fb57e6af653 Bill Pemberton 2009-03-27 470 */
07b509e6584a552 Anders Blomdell 2009-02-12 471 } else {
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 472 spriv->retries = 0;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 473 spriv->state = state_jr3_init_wait_for_offset;
07b509e6584a552 Anders Blomdell 2009-02-12 474 }
07b509e6584a552 Anders Blomdell 2009-02-12 475 break;
abcdc99f7cb387f Ian Abbott 2012-11-01 476 case state_jr3_init_wait_for_offset:
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 477 spriv->retries++;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 478 if (spriv->retries < 10) {
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 479 /*
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 480 * Wait for offeset to stabilize
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 481 * (< 10 s according to manual)
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 482 */
07b509e6584a552 Anders Blomdell 2009-02-12 483 } else {
0a44493fb18738c H Hartley Sweeten 2014-03-07 484 struct jr3_pci_transform transf;
07b509e6584a552 Anders Blomdell 2009-02-12 485
713eab88c66de4e Ian Abbott 2017-03-08 486 spriv->model_no = get_u16(&sensor->model_no);
713eab88c66de4e Ian Abbott 2017-03-08 487 spriv->serial_no = get_u16(&sensor->serial_no);
07b509e6584a552 Anders Blomdell 2009-02-12 488
2696fb57e6af653 Bill Pemberton 2009-03-27 489 /* Transformation all zeros */
b1f68dc1d610159 Ian Abbott 2009-09-21 490 for (i = 0; i < ARRAY_SIZE(transf.link); i++) {
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 491 transf.link[i].link_type = (enum link_types)0;
b1f68dc1d610159 Ian Abbott 2009-09-21 492 transf.link[i].link_amount = 0;
b1f68dc1d610159 Ian Abbott 2009-09-21 493 }
07b509e6584a552 Anders Blomdell 2009-02-12 494
713eab88c66de4e Ian Abbott 2017-03-08 495 set_transforms(sensor, &transf, 0);
713eab88c66de4e Ian Abbott 2017-03-08 496 use_transform(sensor, 0);
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 497 spriv->state = state_jr3_init_transform_complete;
abcdc99f7cb387f Ian Abbott 2012-11-01 498 /* Allow 20 ms for completion */
abcdc99f7cb387f Ian Abbott 2012-11-01 499 result = poll_delay_min_max(20, 100);
07b509e6584a552 Anders Blomdell 2009-02-12 500 }
abcdc99f7cb387f Ian Abbott 2012-11-01 501 break;
abcdc99f7cb387f Ian Abbott 2012-11-01 502 case state_jr3_init_transform_complete:
713eab88c66de4e Ian Abbott 2017-03-08 503 if (!is_complete(sensor)) {
07b509e6584a552 Anders Blomdell 2009-02-12 504 result = poll_delay_min_max(20, 100);
07b509e6584a552 Anders Blomdell 2009-02-12 505 } else {
2696fb57e6af653 Bill Pemberton 2009-03-27 506 /* Set full scale */
050509fa5583063 Bill Pemberton 2009-03-16 507 struct six_axis_t min_full_scale;
050509fa5583063 Bill Pemberton 2009-03-16 508 struct six_axis_t max_full_scale;
07b509e6584a552 Anders Blomdell 2009-02-12 509
713eab88c66de4e Ian Abbott 2017-03-08 510 min_full_scale = get_min_full_scales(sensor);
713eab88c66de4e Ian Abbott 2017-03-08 511 max_full_scale = get_max_full_scales(sensor);
713eab88c66de4e Ian Abbott 2017-03-08 512 set_full_scales(sensor, max_full_scale);
07b509e6584a552 Anders Blomdell 2009-02-12 513
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 514 spriv->state = state_jr3_init_set_full_scale_complete;
abcdc99f7cb387f Ian Abbott 2012-11-01 515 /* Allow 20 ms for completion */
abcdc99f7cb387f Ian Abbott 2012-11-01 516 result = poll_delay_min_max(20, 100);
07b509e6584a552 Anders Blomdell 2009-02-12 517 }
07b509e6584a552 Anders Blomdell 2009-02-12 518 break;
abcdc99f7cb387f Ian Abbott 2012-11-01 519 case state_jr3_init_set_full_scale_complete:
713eab88c66de4e Ian Abbott 2017-03-08 520 if (!is_complete(sensor)) {
07b509e6584a552 Anders Blomdell 2009-02-12 521 result = poll_delay_min_max(20, 100);
07b509e6584a552 Anders Blomdell 2009-02-12 522 } else {
713eab88c66de4e Ian Abbott 2017-03-08 523 struct force_array __iomem *fs = &sensor->full_scale;
4af8c8195188b5d Ian Abbott 2017-02-17 524 union jr3_pci_single_range *r = spriv->range;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 525
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 526 /* Use ranges in kN or we will overflow around 2000N! */
4af8c8195188b5d Ian Abbott 2017-02-17 @527 r[0].l.range[0].min = -get_s16(&fs->fx) * 1000;
4af8c8195188b5d Ian Abbott 2017-02-17 528 r[0].l.range[0].max = get_s16(&fs->fx) * 1000;
4af8c8195188b5d Ian Abbott 2017-02-17 529 r[1].l.range[0].min = -get_s16(&fs->fy) * 1000;
4af8c8195188b5d Ian Abbott 2017-02-17 530 r[1].l.range[0].max = get_s16(&fs->fy) * 1000;
4af8c8195188b5d Ian Abbott 2017-02-17 531 r[2].l.range[0].min = -get_s16(&fs->fz) * 1000;
4af8c8195188b5d Ian Abbott 2017-02-17 532 r[2].l.range[0].max = get_s16(&fs->fz) * 1000;
4af8c8195188b5d Ian Abbott 2017-02-17 533 r[3].l.range[0].min = -get_s16(&fs->mx) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 534 r[3].l.range[0].max = get_s16(&fs->mx) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 535 r[4].l.range[0].min = -get_s16(&fs->my) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 536 r[4].l.range[0].max = get_s16(&fs->my) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 537 r[5].l.range[0].min = -get_s16(&fs->mz) * 100;
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 538 /* the next five are questionable */
4af8c8195188b5d Ian Abbott 2017-02-17 539 r[5].l.range[0].max = get_s16(&fs->mz) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 540 r[6].l.range[0].min = -get_s16(&fs->v1) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 541 r[6].l.range[0].max = get_s16(&fs->v1) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 542 r[7].l.range[0].min = -get_s16(&fs->v2) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 543 r[7].l.range[0].max = get_s16(&fs->v2) * 100;
4af8c8195188b5d Ian Abbott 2017-02-17 544 r[8].l.range[0].min = 0;
4af8c8195188b5d Ian Abbott 2017-02-17 545 r[8].l.range[0].max = 65535;
07b509e6584a552 Anders Blomdell 2009-02-12 546
713eab88c66de4e Ian Abbott 2017-03-08 547 use_offset(sensor, 0);
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 548 spriv->state = state_jr3_init_use_offset_complete;
abcdc99f7cb387f Ian Abbott 2012-11-01 549 /* Allow 40 ms for completion */
abcdc99f7cb387f Ian Abbott 2012-11-01 550 result = poll_delay_min_max(40, 100);
07b509e6584a552 Anders Blomdell 2009-02-12 551 }
07b509e6584a552 Anders Blomdell 2009-02-12 552 break;
abcdc99f7cb387f Ian Abbott 2012-11-01 553 case state_jr3_init_use_offset_complete:
713eab88c66de4e Ian Abbott 2017-03-08 554 if (!is_complete(sensor)) {
07b509e6584a552 Anders Blomdell 2009-02-12 555 result = poll_delay_min_max(20, 100);
07b509e6584a552 Anders Blomdell 2009-02-12 556 } else {
713eab88c66de4e Ian Abbott 2017-03-08 557 set_s16(&sensor->offsets.fx, 0);
713eab88c66de4e Ian Abbott 2017-03-08 558 set_s16(&sensor->offsets.fy, 0);
713eab88c66de4e Ian Abbott 2017-03-08 559 set_s16(&sensor->offsets.fz, 0);
713eab88c66de4e Ian Abbott 2017-03-08 560 set_s16(&sensor->offsets.mx, 0);
713eab88c66de4e Ian Abbott 2017-03-08 561 set_s16(&sensor->offsets.my, 0);
713eab88c66de4e Ian Abbott 2017-03-08 562 set_s16(&sensor->offsets.mz, 0);
07b509e6584a552 Anders Blomdell 2009-02-12 563
713eab88c66de4e Ian Abbott 2017-03-08 564 set_offset(sensor);
07b509e6584a552 Anders Blomdell 2009-02-12 565
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 566 spriv->state = state_jr3_done;
07b509e6584a552 Anders Blomdell 2009-02-12 567 }
07b509e6584a552 Anders Blomdell 2009-02-12 568 break;
abcdc99f7cb387f Ian Abbott 2012-11-01 569 case state_jr3_done:
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 570 result = poll_delay_min_max(10000, 20000);
07b509e6584a552 Anders Blomdell 2009-02-12 571 break;
abcdc99f7cb387f Ian Abbott 2012-11-01 572 default:
07b509e6584a552 Anders Blomdell 2009-02-12 573 break;
07b509e6584a552 Anders Blomdell 2009-02-12 574 }
01fca4732b98ab5 H Hartley Sweeten 2014-03-07 575
07b509e6584a552 Anders Blomdell 2009-02-12 576 return result;
07b509e6584a552 Anders Blomdell 2009-02-12 577 }
07b509e6584a552 Anders Blomdell 2009-02-12 578
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip