1
0
mirror of https://github.com/KastnerRG/riffa.git synced 2025-01-30 23:02:54 +08:00

Fix driver for linux >= 6.5

This commit is contained in:
Adrien Prost-Boucle 2023-09-21 22:46:11 +02:00 committed by Adrien Prost-Boucle
parent 7f5cd2db2d
commit c2e5b280b4

View File

@ -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); 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) #elif LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)
num_pages = get_user_pages(udata, num_pages_reqd, 1, 0, pages, NULL); 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); 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 #endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)
@ -1603,7 +1605,12 @@ static int __init fpga_init(void)
return (error); 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)) { if (IS_ERR(mymodule_class)) {
error = PTR_ERR(mymodule_class); error = PTR_ERR(mymodule_class);
printk(KERN_ERR "riffa: class_create() returned %d\n", error); printk(KERN_ERR "riffa: class_create() returned %d\n", error);