ikwzm / udmabuf

User space mappable dma buffer device driver for Linux.
BSD 2-Clause "Simplified" License
545 stars 165 forks source link

[fix] build on Linux >= 5.1 #43

Closed stefano-garzarella closed 4 years ago

stefano-garzarella commented 4 years ago

Build failed with this error: udmabuf.c:527:16: error: initialization of ‘vm_fault_t ()(struct vm_fault )’ {aka ‘unsigned int ()(struct vm_fault )’} from incompatible pointer type ‘int ()(struct vm_fault )’ [-Werror=incompatible-pointer-types] 527 | .fault = udmabuf_device_vma_fault, | ^~~~~~~~

Starting from Linux 5.1 'vm_fault_t' switches from int to unsigned int.

vm_fault_t was defined from Linux 4.17, so this commit adds its definition for Linux < 4.17, and it uses vm_fault_t return value for .fault callback.

ikwzm commented 4 years ago

Thank you for your precious pull request.

This is just a side note, but udmabuf changed to u-dma-buf. If possible, I would like u-dma-buf to be used instead of udmabuf since Linux Kernel 5.0. u-dma-buf has the same changes as your pull request. Anyway, pull request Thank you.

stefano-garzarella commented 4 years ago

@ikwzm thanks! I didn't see it, please move the note at the begging of Readme.md in the master branch.