Subject: [xlnx:release-2020.2.2_k26 9559/10480] drivers/fpga/fpga-mgr.c:828:2: error: implicit declaration of function 'set_dma_ops'

From: kernel test robot <[email-masked]>
Date: Tue, 20 Apr 2021 03:50:35 +0800

Hi Nava,

FYI, the error/warning still remains.

tree:   https://github.com/Xilinx/linux-xlnx release-2020.2.2_k26
head:   4731ff5042ce76fc145bc2797faa2d91b090675e
commit: ed71785e2c3c3495e89c7b6c3a38699b59bf83d8 [9559/10480] fpga: support loading from a pre-allocated buffer
config: um-randconfig-r002-20210419 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/Xilinx/linux-xlnx/commit/ed71785e2c3c3495e89c7b6c3a38699b59bf83d8
        git remote add xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xlnx release-2020.2.2_k26
        git checkout ed71785e2c3c3495e89c7b6c3a38699b59bf83d8
        # save the attached .config to linux build tree
        make W=1 W=1 ARCH=um 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All errors (new ones prefixed by >>):

   cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
   In file included from include/linux/file.h:9,
                    from include/linux/dma-buf.h:16,
                    from drivers/fpga/fpga-mgr.c:11:
   include/asm-generic/fixmap.h: In function 'fix_to_virt':
   include/asm-generic/fixmap.h:32:19: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
      32 |  BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
         |                   ^~
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
     330 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |  ^~~~~~~~~~~~~~~~
   include/asm-generic/fixmap.h:32:2: note: in expansion of macro 'BUILD_BUG_ON'
      32 |  BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
         |  ^~~~~~~~~~~~
   drivers/fpga/fpga-mgr.c: In function 'fpga_mgr_create':
>> drivers/fpga/fpga-mgr.c:828:2: error: implicit declaration of function 'set_dma_ops' [-Werror=implicit-function-declaration]
     828 |  set_dma_ops(&mgr->dev, get_dma_ops(dev));
         |  ^~~~~~~~~~~
>> drivers/fpga/fpga-mgr.c:828:25: error: implicit declaration of function 'get_dma_ops'; did you mean 'get_dma_buf'? [-Werror=implicit-function-declaration]
     828 |  set_dma_ops(&mgr->dev, get_dma_ops(dev));
         |                         ^~~~~~~~~~~
         |                         get_dma_buf
   cc1: some warnings being treated as errors

vim +/set_dma_ops +828 drivers/fpga/fpga-mgr.c

   773	
   774	/**
   775	 * fpga_mgr_create - create and initialize a FPGA manager struct
   776	 * @dev:	fpga manager device from pdev
   777	 * @name:	fpga manager name
   778	 * @mops:	pointer to structure of fpga manager ops
   779	 * @priv:	fpga manager private data
   780	 *
   781	 * The caller of this function is responsible for freeing the struct with
   782	 * fpga_mgr_free().  Using devm_fpga_mgr_create() instead is recommended.
   783	 *
   784	 * Return: pointer to struct fpga_manager or NULL
   785	 */
   786	struct fpga_manager *fpga_mgr_create(struct device *dev, const char *name,
   787					     const struct fpga_manager_ops *mops,
   788					     void *priv)
   789	{
   790		struct fpga_manager *mgr;
   791		int id, ret;
   792	
   793		if (!mops || !mops->write_complete || !mops->state ||
   794		    !mops->write_init || (!mops->write && !mops->write_sg)) {
   795			dev_err(dev, "Attempt to register without fpga_manager_ops\n");
   796			return NULL;
   797		}
   798	
   799		if (!name || !strlen(name)) {
   800			dev_err(dev, "Attempt to register with no name!\n");
   801			return NULL;
   802		}
   803	
   804		mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
   805		if (!mgr)
   806			return NULL;
   807	
   808		id = ida_simple_get(&fpga_mgr_ida, 0, 0, GFP_KERNEL);
   809		if (id < 0) {
   810			ret = id;
   811			goto error_kfree;
   812		}
   813	
   814		mutex_init(&mgr->ref_mutex);
   815	
   816		mgr->name = name;
   817		mgr->mops = mops;
   818		mgr->priv = priv;
   819	
   820		device_initialize(&mgr->dev);
   821		mgr->dev.class = fpga_mgr_class;
   822		mgr->dev.groups = mops->groups;
   823		mgr->dev.parent = dev;
   824		mgr->dev.of_node = dev->of_node;
   825		mgr->dev.id = id;
   826	
   827		/* Make device dma capable by inheriting from parent's */
 > 828		set_dma_ops(&mgr->dev, get_dma_ops(dev));
   829		ret = dma_coerce_mask_and_coherent(&mgr->dev, dma_get_mask(dev));
   830		if (ret) {
   831			dev_warn(dev,
   832			"Failed to set DMA mask %llx. Trying to continue... %x\n",
   833			dma_get_mask(dev), ret);
   834		}
   835	
   836		ret = dev_set_name(&mgr->dev, "fpga%d", id);
   837		if (ret)
   838			goto error_device;
   839	
   840		mgr->miscdev.minor = MISC_DYNAMIC_MINOR;
   841		mgr->miscdev.name = kobject_name(&mgr->dev.kobj);
   842		mgr->miscdev.fops = &fpga_fops;
   843		ret = misc_register(&mgr->miscdev);
   844		if (ret) {
   845			pr_err("fpga: failed to register misc device.\n");
   846			goto error_device;
   847		}
   848	
   849		return mgr;
   850	
   851	error_device:
   852		ida_simple_remove(&fpga_mgr_ida, id);
   853	error_kfree:
   854		kfree(mgr);
   855	
   856		return NULL;
   857	}
   858	EXPORT_SYMBOL_GPL(fpga_mgr_create);
   859	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]
_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel