Re: [PATCH 1/2] spi: Add Renesas R-Car RPC SPI controller driver

kbuild test robot
2018-11-20T02:04:40Z

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

Hi Mason,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on spi/for-next]
[also build test ERROR on v4.20-rc3 next-20181119]
[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/Mason-Yang/spi-Add-Renesas-R-Car-RPC-SPI-controller-driver/20181120-020310
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All error/warnings (new ones prefixed by >>):

>> drivers/spi/spi-renesas-rpc.c:366:47: warning: 'struct spi_mem_dirmap_desc' declared inside parameter list will not be visible outside of this definition or declaration
static ssize_t rpc_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc,
^~~~~~~~~~~~~~~~~~~
In file included from drivers/spi/spi-renesas-rpc.c:18:0:
drivers/spi/spi-renesas-rpc.c: In function 'rpc_spi_mem_dirmap_read':
>> drivers/spi/spi-renesas-rpc.c:369:51: error: dereferencing pointer to incomplete type 'struct spi_mem_dirmap_desc'
struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
^
include/linux/spi/spi.h:1333:66: note: in definition of macro 'spi_master_get_devdata'
#define spi_master_get_devdata(_ctlr) spi_controller_get_devdata(_ctlr)
^~~~~
drivers/spi/spi-renesas-rpc.c: At top level:
drivers/spi/spi-renesas-rpc.c:397:48: warning: 'struct spi_mem_dirmap_desc' declared inside parameter list will not be visible outside of this definition or declaration
static ssize_t rpc_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,
^~~~~~~~~~~~~~~~~~~
In file included from drivers/spi/spi-renesas-rpc.c:18:0:
drivers/spi/spi-renesas-rpc.c: In function 'rpc_spi_mem_dirmap_write':
drivers/spi/spi-renesas-rpc.c:400:51: error: dereferencing pointer to incomplete type 'struct spi_mem_dirmap_desc'
struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
^
include/linux/spi/spi.h:1333:66: note: in definition of macro 'spi_master_get_devdata'
#define spi_master_get_devdata(_ctlr) spi_controller_get_devdata(_ctlr)
^~~~~
drivers/spi/spi-renesas-rpc.c: At top level:
drivers/spi/spi-renesas-rpc.c:443:45: warning: 'struct spi_mem_dirmap_desc' declared inside parameter list will not be visible outside of this definition or declaration
static int rpc_spi_mem_dirmap_create(struct spi_mem_dirmap_desc *desc)
^~~~~~~~~~~~~~~~~~~
In file included from drivers/spi/spi-renesas-rpc.c:18:0:
drivers/spi/spi-renesas-rpc.c: In function 'rpc_spi_mem_dirmap_create':
drivers/spi/spi-renesas-rpc.c:445:51: error: dereferencing pointer to incomplete type 'struct spi_mem_dirmap_desc'
struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
^
include/linux/spi/spi.h:1333:66: note: in definition of macro 'spi_master_get_devdata'
#define spi_master_get_devdata(_ctlr) spi_controller_get_devdata(_ctlr)
^~~~~
drivers/spi/spi-renesas-rpc.c: At top level:
>> drivers/spi/spi-renesas-rpc.c:484:3: error: 'const struct spi_controller_mem_ops' has no member named 'dirmap_create'
.dirmap_create = rpc_spi_mem_dirmap_create,
^~~~~~~~~~~~~
>> drivers/spi/spi-renesas-rpc.c:484:19: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
.dirmap_create = rpc_spi_mem_dirmap_create,
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-renesas-rpc.c:484:19: note: (near initialization for 'rpc_spi_mem_ops')
>> drivers/spi/spi-renesas-rpc.c:484:19: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
drivers/spi/spi-renesas-rpc.c:484:19: note: (near initialization for 'rpc_spi_mem_ops.supports_op')
>> drivers/spi/spi-renesas-rpc.c:485:3: error: 'const struct spi_controller_mem_ops' has no member named 'dirmap_read'
.dirmap_read = rpc_spi_mem_dirmap_read,
^~~~~~~~~~~
drivers/spi/spi-renesas-rpc.c:485:17: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
.dirmap_read = rpc_spi_mem_dirmap_read,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-renesas-rpc.c:485:17: note: (near initialization for 'rpc_spi_mem_ops')
drivers/spi/spi-renesas-rpc.c:485:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
drivers/spi/spi-renesas-rpc.c:485:17: note: (near initialization for 'rpc_spi_mem_ops.adjust_op_size')
>> drivers/spi/spi-renesas-rpc.c:486:3: error: 'const struct spi_controller_mem_ops' has no member named 'dirmap_write'
.dirmap_write = rpc_spi_mem_dirmap_write,
^~~~~~~~~~~~
drivers/spi/spi-renesas-rpc.c:486:18: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
.dirmap_write = rpc_spi_mem_dirmap_write,
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-renesas-rpc.c:486:18: note: (near initialization for 'rpc_spi_mem_ops')
drivers/spi/spi-renesas-rpc.c:486:18: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
drivers/spi/spi-renesas-rpc.c:486:18: note: (near initialization for 'rpc_spi_mem_ops.get_name')
cc1: some warnings being treated as errors

vim +369 drivers/spi/spi-renesas-rpc.c

365
> 366 static ssize_t rpc_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc,
367 u64 offs, size_t len, void *buf)
368 {
> 369 struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
370 int ret;
371
372 if (WARN_ON(offs + desc->info.offset + len > U32_MAX))
373 return -EINVAL;
374
375 ret = rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
376 if (ret)
377 return ret;
378
379 rpc_spi_mem_set_prep_op_cfg(desc->mem->spi,
380 &desc->info.op_tmpl, &offs, &len);
381
382 writel(RPC_CMNCR_SFDE | RPC_CMNCR_MOIIO_HIZ |
383 RPC_CMNCR_IOFV_HIZ | RPC_CMNCR_BSZ(0), rpc->regs + RPC_CMNCR);
384
385 writel(RPC_DRCR_RBURST(0x1f) | RPC_DRCR_RBE, rpc->regs + RPC_DRCR);
386 writel(rpc->cmd, rpc->regs + RPC_DRCMR);
387 writel(RPC_DREAR_EAC, rpc->regs + RPC_DREAR);
388 writel(0, rpc->regs + RPC_DROPR);
389 writel(rpc->smenr, rpc->regs + RPC_DRENR);
390 writel(rpc->dummy, rpc->regs + RPC_DRDMCR);
391 writel(0x0, rpc->regs + RPC_DRDRENR);
392 memcpy_fromio(buf, rpc->linear.map + desc->info.offset + offs, len);
393
394 return len;
395 }
396
397 static ssize_t rpc_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,
398 u64 offs, size_t len, const void *buf)
399 {
400 struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
401 int tx_offs, ret;
402
403 if (WARN_ON(offs + desc->info.offset + len > U32_MAX))
404 return -EINVAL;
405
406 if (WARN_ON(len > RPC_WBUF_SIZE))
407 return -EIO;
408
409 ret = rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
410 if (ret)
411 return ret;
412
413 rpc_spi_mem_set_prep_op_cfg(desc->mem->spi,
414 &desc->info.op_tmpl, &offs, &len);
415
416 writel(RPC_CMNCR_MD | RPC_CMNCR_SFDE | RPC_CMNCR_MOIIO_HIZ |
417 RPC_CMNCR_IOFV_HIZ | RPC_CMNCR_BSZ(0), rpc->regs + RPC_CMNCR);
418 writel(0x0, rpc->regs + RPC_SMDRENR);
419
420 writel(RPC_PHYCNT_CAL | 0x260 | RPC_PHYCNT_WBUF2 | RPC_PHYCNT_WBUF,
421 rpc->regs + RPC_PHYCNT);
422
423 for (tx_offs = 0; tx_offs < RPC_WBUF_SIZE; tx_offs += 4)
424 writel(*(u32 *)(buf + tx_offs), rpc->regs + RPC_WBUF + tx_offs);
425
426 writel(rpc->cmd, rpc->regs + RPC_SMCMR);
427 writel(offs, rpc->regs + RPC_SMADR);
428 writel(rpc->smenr, rpc->regs + RPC_SMENR);
429 writel(rpc->smcr | RPC_SMCR_SPIE, rpc->regs + RPC_SMCR);
430 ret = wait_msg_xfer_end(rpc);
431 if (ret)
432 goto out;
433
434 writel(RPC_DRCR_RCF, rpc->regs + RPC_DRCR);
435 writel(RPC_PHYCNT_CAL | RPC_PHYCNT_STRTIM(0) | 0x260,
436 rpc->regs + RPC_PHYCNT);
437
438 return len;
439 out:
440 return ret;
441 }
442
443 static int rpc_spi_mem_dirmap_create(struct spi_mem_dirmap_desc *desc)
444 {
445 struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
446
447 if (desc->info.offset + desc->info.length > U32_MAX)
448 return -ENOTSUPP;
449
450 if (!rpc_spi_mem_supports_op(desc->mem, &desc->info.op_tmpl))
451 return -ENOTSUPP;
452
453 if (!rpc->linear.map &&
454 desc->info.op_tmpl.data.dir == SPI_MEM_DATA_IN)
455 return -ENOTSUPP;
456
457 return 0;
458 }
459
460 static int rpc_spi_mem_exec_op(struct spi_mem *mem,
461 const struct spi_mem_op *op)
462 {
463 struct rpc_spi *rpc = spi_master_get_devdata(mem->spi->master);
464 int ret;
465
466 ret = rpc_spi_set_freq(rpc, mem->spi->max_speed_hz);
467 if (ret)
468 return ret;
469
470 rpc_spi_mem_set_prep_op_cfg(mem->spi, op, NULL, NULL);
471
472 ret = rpc_spi_io_xfer(rpc,
473 op->data.dir == SPI_MEM_DATA_OUT ?
474 op->data.buf.out : NULL,
475 op->data.dir == SPI_MEM_DATA_IN ?
476 op->data.buf.in : NULL);
477
478 return ret;
479 }
480
481 static const struct spi_controller_mem_ops rpc_spi_mem_ops = {
482 .supports_op = rpc_spi_mem_supports_op,
483 .exec_op = rpc_spi_mem_exec_op,
> 484 .dirmap_create = rpc_spi_mem_dirmap_create,
> 485 .dirmap_read = rpc_spi_mem_dirmap_read,
> 486 .dirmap_write = rpc_spi_mem_dirmap_write,
487 };
488

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

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