Re: [PATCH v7 7/7] input: joystick: Add ADC attached joystick driver.

kbuild test robot
2020-05-17T23:26:32Z

[-- Attachment #1: Type: text/plain, Size: 3001 bytes --]

Hi Artur,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on input/next robh/for-next v5.7-rc5 next-20200515]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Artur-Rojek/dt-bindings-iio-adc-Convert-ingenic-adc-docs-to-YAML/20200518-035120
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: i386-allyesconfig (attached as .config)
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-193-gb8fad4bc-dirty
# save the attached .config to linux build tree
make C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)

>> drivers/input/joystick/adc-joystick.c:49:39: sparse: sparse: cast to restricted __be16
>> drivers/input/joystick/adc-joystick.c:49:39: sparse: sparse: cast to restricted __be16
>> drivers/input/joystick/adc-joystick.c:49:39: sparse: sparse: cast to restricted __be16
>> drivers/input/joystick/adc-joystick.c:49:39: sparse: sparse: cast to restricted __be16
>> drivers/input/joystick/adc-joystick.c:51:39: sparse: sparse: cast to restricted __le16

vim +49 drivers/input/joystick/adc-joystick.c

28
29 static int adc_joystick_handle(const void *data, void *private)
30 {
31 struct adc_joystick *joy = private;
32 enum iio_endian endianness;
33 int bytes, msb, val, i;
34 bool sign;
35
36 bytes = joy->chans[0].channel->scan_type.storagebits >> 3;
37
38 for (i = 0; i < joy->num_chans; ++i) {
39 endianness = joy->chans[i].channel->scan_type.endianness;
40 msb = joy->chans[i].channel->scan_type.realbits - 1;
41 sign = (tolower(joy->chans[i].channel->scan_type.sign) == 's');
42
43 switch (bytes) {
44 case 1:
45 val = ((const u8 *)data)[i];
46 break;
47 case 2:
48 if (endianness == IIO_BE)
> 49 val = be16_to_cpu(((const u16 *)data)[i]);
50 else if (endianness == IIO_LE)
> 51 val = le16_to_cpu(((const u16 *)data)[i]);
52 else /* IIO_CPU */
53 val = ((const u16 *)data)[i];
54 break;
55 default:
56 return -EINVAL;
57 }
58
59 val >>= joy->chans[i].channel->scan_type.shift;
60 if (sign)
61 val = sign_extend32(val, msb);
62 else
63 val &= GENMASK(msb, 0);
64 input_report_abs(joy->input, joy->axes[i].code, val);
65 }
66
67 input_sync(joy->input);
68
69 return 0;
70 }
71

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 72481 bytes --]