Closed mayureshw closed 8 months ago
Seems that vm_flags_set has been included elsewhere thus causing your error.
Remove the vm_flags_set() definition you added and simply call existing vm_flags_set(vma, VMEM_FLAGS);
(do not forget the ';')
Works on my setup (Ubuntu22.04 kernel 6.5.0-1018-oem)
Right. Thanks.
cdev_write_iter
andcdev_read_iter
, need to changeio->iov
toio->__iov
;class_create(THIS_MODULE, XDMA_NODE_NAME)
toclass_create(XDMA_NODE_NAME)
;vma->vm_flags
tovm_area_struct *
. For example, you could write a function to write a flag intovm_flags
field of vma (now is const):Usage:
With this changes, driver completly builds, again :)
_Originally posted by @MADMechaniculus in https://github.com/Xilinx/dma_ip_drivers/issues/253#issuecomment-1897509289_
For the 3rd point I get the following errors:
Makefile:17: XVC_FLAGS: . make -C /lib/modules/6.6.21_1/build M=/home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma modules make[1]: Entering directory '/usr/src/kernel-headers-6.6.21_1' /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/Makefile:17: XVC_FLAGS: . CC [M] /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_ctrl.o /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_ctrl.c:191:6: error: redefinition of 'vm_flags_set' 191 | void vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags) { | ^~~~~~~~~~~~ In file included from ./include/linux/scatterlist.h:8, from ./include/linux/dma-mapping.h:11, from /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma_mod.h:26, from /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/xdma_cdev.h:27, from /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_ctrl.c:24: ./include/linux/mm.h:840:20: note: previous definition of 'vm_flags_set' with type 'void(struct vm_area_struct *, vm_flags_t)' {aka 'void(struct vm_area_struct *, long unsigned int)'} 840 | static inline void vm_flags_set(struct vm_area_struct *vma, | ^~~~~~~~~~~~ /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_ctrl.c: In function 'vm_flags_set': /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_ctrl.c:192:27: error: assignment of read-only member 'vm_flags' 192 | vma->vm_flags |= flags; | ^~ make[3]: *** [scripts/Makefile.build:243: /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma/cdev_ctrl.o] Error 1 make[2]: *** [/usr/src/kernel-headers-6.6.21_1/Makefile:1913: /home/guest/programs/xilinx/dma_ip_drivers/XDMA/linux-kernel/xdma] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/kernel-headers-6.6.21_1' make: *** [Makefile:39: all] Error 2