Re: [PATCH v3] Input: add bu21029 touch driver

From: kbuild test robot
Date: Sun Jun 17 2018 - 15:19:42 EST


Hi Zhu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v4.17-rc4]
[also build test WARNING on next-20180615]
[cannot apply to input/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Mark-Jonas/Input-add-bu21029-touch-driver/20180512-091305
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/input/touchscreen/bu21029_ts.c:293:13: sparse: restricted __be16 degrades to integer

vim +293 drivers/input/touchscreen/bu21029_ts.c

262
263 static int bu21029_start_chip(struct input_dev *dev)
264 {
265 struct bu21029_ts_data *bu21029 = input_get_drvdata(dev);
266 struct i2c_client *i2c = bu21029->client;
267 struct {
268 u8 reg;
269 u8 value;
270 } init_table[] = {
271 {BU21029_CFR0_REG, CFR0_VALUE},
272 {BU21029_CFR1_REG, CFR1_VALUE},
273 {BU21029_CFR2_REG, CFR2_VALUE},
274 {BU21029_CFR3_REG, CFR3_VALUE},
275 {BU21029_LDO_REG, LDO_VALUE}
276 };
277 int error, i;
278 u16 hwid;
279
280 /* take chip out of reset */
281 gpiod_set_value_cansleep(bu21029->reset_gpios, 0);
282 mdelay(START_DELAY_MS);
283
284 error = i2c_smbus_read_i2c_block_data(i2c,
285 BU21029_HWID_REG,
286 2,
287 (u8 *)&hwid);
288 if (error < 0) {
289 dev_err(&i2c->dev, "failed to read HW ID\n");
290 goto out;
291 }
292
> 293 if (cpu_to_be16(hwid) != SUPPORTED_HWID) {
294 dev_err(&i2c->dev, "unsupported HW ID 0x%x\n", hwid);
295 error = -ENODEV;
296 goto out;
297 }
298
299 for (i = 0; i < ARRAY_SIZE(init_table); ++i) {
300 error = i2c_smbus_write_byte_data(i2c,
301 init_table[i].reg,
302 init_table[i].value);
303 if (error < 0) {
304 dev_err(&i2c->dev,
305 "failed to write 0x%x to register 0x%x\n",
306 init_table[i].value,
307 init_table[i].reg);
308 goto out;
309 }
310 }
311
312 error = i2c_smbus_write_byte(i2c, BU21029_AUTOSCAN);
313 if (error < 0) {
314 dev_err(&i2c->dev, "failed to start autoscan\n");
315 goto out;
316 }
317
318 enable_irq(bu21029->client->irq);
319 return 0;
320
321 out:
322 bu21029_stop_chip(dev);
323 return error;
324 }
325

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation