[kbusch:dma-prereg-v3-wip 6/6] drivers/nvme/host/pci.c:565:17: error: implicit declaration of function 'nvme_free_sgls'; did you mean 'nvme_pci_use_sgls'?

From: kernel test robot
Date: Thu Jul 21 2022 - 22:34:18 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/kbusch/linux.git dma-prereg-v3-wip
head: 7b981a9cb1de32a6e73fe14d2665e0a2fb5dcd3c
commit: 7b981a9cb1de32a6e73fe14d2665e0a2fb5dcd3c [6/6] nvme-pci: implement dma_map support
config: x86_64-rhel-8.3-syz (https://download.01.org/0day-ci/archive/20220722/202207221004.Th4xLMWP-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/kbusch/linux.git/commit/?id=7b981a9cb1de32a6e73fe14d2665e0a2fb5dcd3c
git remote add kbusch https://git.kernel.org/pub/scm/linux/kernel/git/kbusch/linux.git
git fetch --no-tags kbusch dma-prereg-v3-wip
git checkout 7b981a9cb1de32a6e73fe14d2665e0a2fb5dcd3c
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/nvme/host/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/nvme/host/pci.c: In function 'nvme_free_prp_chain':
>> drivers/nvme/host/pci.c:565:17: error: implicit declaration of function 'nvme_free_sgls'; did you mean 'nvme_pci_use_sgls'? [-Werror=implicit-function-declaration]
565 | nvme_free_sgls(dev, req);
| ^~~~~~~~~~~~~~
| nvme_pci_use_sgls
>> drivers/nvme/host/pci.c:567:17: error: implicit declaration of function 'nvme_free_prps'; did you mean 'nvme_req_op'? [-Werror=implicit-function-declaration]
567 | nvme_free_prps(dev, req);
| ^~~~~~~~~~~~~~
| nvme_req_op
drivers/nvme/host/pci.c: At top level:
drivers/nvme/host/pci.c:599:13: warning: conflicting types for 'nvme_free_prps'; have 'void(struct nvme_dev *, struct request *)'
599 | static void nvme_free_prps(struct nvme_dev *dev, struct request *req)
| ^~~~~~~~~~~~~~
>> drivers/nvme/host/pci.c:599:13: error: static declaration of 'nvme_free_prps' follows non-static declaration
drivers/nvme/host/pci.c:567:17: note: previous implicit declaration of 'nvme_free_prps' with type 'void(struct nvme_dev *, struct request *)'
567 | nvme_free_prps(dev, req);
| ^~~~~~~~~~~~~~
drivers/nvme/host/pci.c:615:13: warning: conflicting types for 'nvme_free_sgls'; have 'void(struct nvme_dev *, struct request *)'
615 | static void nvme_free_sgls(struct nvme_dev *dev, struct request *req)
| ^~~~~~~~~~~~~~
>> drivers/nvme/host/pci.c:615:13: error: static declaration of 'nvme_free_sgls' follows non-static declaration
drivers/nvme/host/pci.c:565:17: note: previous implicit declaration of 'nvme_free_sgls' with type 'void(struct nvme_dev *, struct request *)'
565 | nvme_free_sgls(dev, req);
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +565 drivers/nvme/host/pci.c

554
555 static void nvme_free_prp_chain(struct nvme_dev *dev, struct request *req,
556 struct nvme_iod *iod)
557 {
558 if (iod->npages < 0)
559 return;
560
561 if (iod->npages == 0)
562 dma_pool_free(dev->prp_small_pool, nvme_pci_iod_list(req)[0],
563 iod->first_dma);
564 else if (iod->use_sgl)
> 565 nvme_free_sgls(dev, req);
566 else
> 567 nvme_free_prps(dev, req);
568 }
569
570 static void nvme_sync_dma(struct nvme_dev *dev, struct request *req)
571 {
572 int index, offset, i, length, nprps;
573 struct nvme_dma_mapping *mapping;
574 bool needs_sync;
575
576 mapping = blk_rq_dma_tag(req);
577 offset = blk_rq_dma_offset(req) + mapping->offset;
578 index = offset >> NVME_CTRL_PAGE_SHIFT;
579 needs_sync = rq_data_dir(req) == READ &&
580 dma_need_sync(dev->dev, le64_to_cpu(mapping->prps[index]));
581
582 if (!needs_sync)
583 return;
584
585 offset = offset & (NVME_CTRL_PAGE_SIZE - 1);
586 length = blk_rq_payload_bytes(req) - (NVME_CTRL_PAGE_SIZE - offset);
587 nprps = DIV_ROUND_UP(length, NVME_CTRL_PAGE_SIZE);
588
589 dma_sync_single_for_cpu(dev->dev,
590 le64_to_cpu(mapping->prps[index++]),
591 NVME_CTRL_PAGE_SIZE - offset, DMA_FROM_DEVICE);
592 for (i = 1; i < nprps; i++) {
593 dma_sync_single_for_cpu(dev->dev,
594 le64_to_cpu(mapping->prps[index++]),
595 NVME_CTRL_PAGE_SIZE, DMA_FROM_DEVICE);
596 }
597 }
598
> 599 static void nvme_free_prps(struct nvme_dev *dev, struct request *req)
600 {
601 const int last_prp = NVME_CTRL_PAGE_SIZE / sizeof(__le64) - 1;
602 struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
603 dma_addr_t dma_addr = iod->first_dma;
604 int i;
605
606 for (i = 0; i < iod->npages; i++) {
607 __le64 *prp_list = nvme_pci_iod_list(req)[i];
608 dma_addr_t next_dma_addr = le64_to_cpu(prp_list[last_prp]);
609
610 dma_pool_free(dev->prp_page_pool, prp_list, dma_addr);
611 dma_addr = next_dma_addr;
612 }
613 }
614
> 615 static void nvme_free_sgls(struct nvme_dev *dev, struct request *req)
616 {
617 const int last_sg = SGES_PER_PAGE - 1;
618 struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
619 dma_addr_t dma_addr = iod->first_dma;
620 int i;
621
622 for (i = 0; i < iod->npages; i++) {
623 struct nvme_sgl_desc *sg_list = nvme_pci_iod_list(req)[i];
624 dma_addr_t next_dma_addr = le64_to_cpu((sg_list[last_sg]).addr);
625
626 dma_pool_free(dev->prp_page_pool, sg_list, dma_addr);
627 dma_addr = next_dma_addr;
628 }
629 }
630

--
0-DAY CI Kernel Test Service
https://01.org/lkp