include/linux/vfio.h:294:35: error: weak declaration of 'vfio_file_iommu_group' being applied to a already existing, static definition

From: kernel test robot
Date: Sun Sep 10 2023 - 21:34:32 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
commit: c1cce6d079b875396c9a7c6838fc5b024758e540 vfio: Compile vfio_group infrastructure optionally
date: 7 weeks ago
config: powerpc64-randconfig-r025-20210929 (https://download.01.org/0day-ci/archive/20230911/202309110914.QLH0LU6L-lkp@xxxxxxxxx/config)
compiler: powerpc64-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230911/202309110914.QLH0LU6L-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309110914.QLH0LU6L-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from arch/powerpc/kvm/../../../virt/kvm/vfio.c:17:
include/linux/vfio.h: In function 'kvm_vfio_file_iommu_group':
>> include/linux/vfio.h:294:35: error: weak declaration of 'vfio_file_iommu_group' being applied to a already existing, static definition
294 | static inline struct iommu_group *vfio_file_iommu_group(struct file *file)
| ^~~~~~~~~~~~~~~~~~~~~


vim +/vfio_file_iommu_group +294 include/linux/vfio.h

274
275 int vfio_assign_device_set(struct vfio_device *device, void *set_id);
276 unsigned int vfio_device_set_open_count(struct vfio_device_set *dev_set);
277 struct vfio_device *
278 vfio_find_device_in_devset(struct vfio_device_set *dev_set,
279 struct device *dev);
280
281 int vfio_mig_get_next_state(struct vfio_device *device,
282 enum vfio_device_mig_state cur_fsm,
283 enum vfio_device_mig_state new_fsm,
284 enum vfio_device_mig_state *next_fsm);
285
286 /*
287 * External user API
288 */
289 #if IS_ENABLED(CONFIG_VFIO_GROUP)
290 struct iommu_group *vfio_file_iommu_group(struct file *file);
291 bool vfio_file_is_group(struct file *file);
292 bool vfio_file_has_dev(struct file *file, struct vfio_device *device);
293 #else
> 294 static inline struct iommu_group *vfio_file_iommu_group(struct file *file)
295 {
296 return NULL;
297 }
298

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki