lkml.org 
[lkml]   [2017]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mfd: Add driver for RAVE Supervisory Processor
Hi Andrey,

[auto build test WARNING on ljones-mfd/for-mfd-next]
[also build test WARNING on v4.12-rc4 next-20170608]
[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/Andrey-Smirnov/mfd-Add-driver-for-RAVE-Supervisory-Processor/20170607-194515
base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile

All warnings (new ones prefixed by >>):

drivers//mfd/rave-sp.c: In function 'csum_ccitt':
drivers//mfd/rave-sp.c:395:2: error: implicit declaration of function 'crc_ccitt_false'
drivers//mfd/rave-sp.c: In function 'rave_sp_receive_reply':
>> drivers//mfd/rave-sp.c:542:3: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'size_t'
drivers//mfd/rave-sp.c:542:3: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'size_t'
cc1: some warnings being treated as errors

vim +542 drivers//mfd/rave-sp.c

389 *crc = 1 + ~(*crc);
390 }
391
392 static void csum_ccitt(const u8 *buf, size_t size, u8 *crc)
393 {
394
> 395 const u16 calculated = crc_ccitt_false(0xffff, buf, size);
396
397 *(__le16 *)crc = cpu_to_be16(calculated);
398 }
399
400 static void *stuff(unsigned char *dest, const unsigned char *src, size_t n)
401 {
402 size_t i;
403
404 for (i = 0; i < n; i++) {
405 const unsigned char byte = *src++;
406
407 switch (byte) {
408 case STX:
409 case ETX:
410 case DLE:
411 *dest++ = DLE;
412 default:
413 *dest++ = byte;
414 }
415 }
416
417 return dest;
418 }
419
420 static int rave_sp_write(struct rave_sp *sp, const u8 *data, u8 data_size)
421 {
422 size_t length;
423 const size_t checksum_length = sp->variant->checksum->length;
424 unsigned char crc[checksum_length];
425 unsigned char frame[RAVE_SP_TX_BUFFER_SIZE];
426 unsigned char *dest = frame;
427
428 if (WARN_ON(data_size > sizeof(frame)))
429 return -ENOMEM;
430
431 sp->variant->checksum->subroutine(data, data_size, crc);
432
433 *dest++ = STX;
434 dest = stuff(dest, data, data_size);
435 dest = stuff(dest, crc, checksum_length);
436 *dest++ = ETX;
437
438 length = dest - frame;
439
440 print_hex_dump(KERN_DEBUG, "rave-sp tx: ", DUMP_PREFIX_NONE,
441 16, 1, frame, length, false);
442
443 return serdev_device_write(sp->serdev, frame, length, HZ);
444 }
445
446 static u8 rave_sp_reply_code(u8 command)
447 {
448 switch (command) {
449 case 0xA0 ... 0xBE:
450 return command + 0x20;
451 case 0xE0 ... 0xEF:
452 return command | 0x01;
453 default:
454 return command + 0x40;
455 }
456 }
457
458 int rave_sp_exec(struct rave_sp *sp,
459 void *__data, size_t data_size,
460 void *reply_data, size_t reply_data_size)
461 {
462 int ret = 0;
463 unsigned char *data = __data;
464 const u8 ackid = (u8)atomic_inc_return(&sp->ackid);
465 const int command = sp->variant->cmd.translate(data[0]);
466 struct rave_sp_reply reply = {
467 .code = rave_sp_reply_code((u8)command),
468 .ackid = ackid,
469 .data = reply_data,
470 .length = reply_data_size,
471 .received = COMPLETION_INITIALIZER_ONSTACK(reply.received),
472 };
473
474 if (command < 0)
475 return command;
476
477 mutex_lock(&sp->bus_lock);
478
479 mutex_lock(&sp->reply_lock);
480 sp->reply = &reply;
481 mutex_unlock(&sp->reply_lock);
482
483 data[0] = (u8)command;
484 data[1] = ackid;
485
486 rave_sp_write(sp, data, data_size);
487
488 if (!wait_for_completion_timeout(&reply.received, HZ)) {
489 dev_err(&sp->serdev->dev, "Command timeout\n");
490 ret = -ETIMEDOUT;
491
492 mutex_lock(&sp->reply_lock);
493 sp->reply = NULL;
494 mutex_unlock(&sp->reply_lock);
495 }
496
497 mutex_unlock(&sp->bus_lock);
498 return ret;
499 }
500 EXPORT_SYMBOL(rave_sp_exec);
501
502 static void rave_sp_receive_event(struct rave_sp *sp,
503 const unsigned char *data, size_t length)
504 {
505 u8 cmd[] = {
506 [0] = rave_sp_reply_code(data[0]),
507 [1] = data[1],
508 };
509
510 rave_sp_write(sp, cmd, sizeof(cmd));
511
512 blocking_notifier_call_chain(&sp->event_notifier_list,
513 rave_sp_action(data[0], data[2]),
514 NULL);
515 }
516
517 static void rave_sp_receive_reply(struct rave_sp *sp,
518 const unsigned char *data, size_t length)
519 {
520 struct device *dev = &sp->serdev->dev;
521 struct rave_sp_reply *reply;
522 const size_t payload_length = length - 2;
523
524 mutex_lock(&sp->reply_lock);
525 reply = sp->reply;
526
527 if (reply && reply->code == data[0] && reply->ackid == data[1] &&
528 payload_length >= reply->length) {
529 /*
530 * We are relying on memcpy(dst, src, 0) to be a no-op
531 * when handling commands that have a no-payload reply
532 */
533 memcpy(reply->data, &data[2], reply->length);
534 complete(&reply->received);
535 sp->reply = NULL;
536 } else {
537 dev_err(dev, "Ignoring incorrect reply\n");
538 dev_dbg(dev, "Code: expected = 0x%08x received = 0x%08x\n",
539 reply->code, data[0]);
540 dev_dbg(dev, "ACK ID: expected = 0x%08x received = 0x%08x\n",
541 reply->ackid, data[1]);
> 542 dev_dbg(dev, "Length: expected = %u received = %u\n",
543 reply->length, payload_length);
544 }
545

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2017-06-12 01:29    [W:0.109 / U:0.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site