From c2e5b280b4c4c3f29f3763522db8bd39a19d5a4b Mon Sep 17 00:00:00 2001 From: Adrien Prost-Boucle Date: Thu, 21 Sep 2023 22:46:11 +0200 Subject: [PATCH] Fix driver for linux >= 6.5 --- driver/linux/riffa_driver.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/driver/linux/riffa_driver.c b/driver/linux/riffa_driver.c index 13bb848..f9e34c9 100644 --- a/driver/linux/riffa_driver.c +++ b/driver/linux/riffa_driver.c @@ -463,8 +463,10 @@ static inline struct sg_mapping * fill_sg_buf(struct fpga_state * sc, int chnl, num_pages = get_user_pages(current, current->mm, udata, num_pages_reqd, 1, 0, pages, NULL); #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0) num_pages = get_user_pages(udata, num_pages_reqd, 1, 0, pages, NULL); - #else + #elsif LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0) num_pages = get_user_pages(udata, num_pages_reqd, FOLL_WRITE, pages, NULL); + #else + num_pages = get_user_pages(udata, num_pages_reqd, FOLL_WRITE, pages); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) @@ -1603,7 +1605,12 @@ static int __init fpga_init(void) return (error); } - mymodule_class = class_create(THIS_MODULE, DEVICE_NAME); + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) + mymodule_class = class_create(THIS_MODULE, DEVICE_NAME); + #else + mymodule_class = class_create(DEVICE_NAME); + #endif + if (IS_ERR(mymodule_class)) { error = PTR_ERR(mymodule_class); printk(KERN_ERR "riffa: class_create() returned %d\n", error);