Skip to content

Commit

Permalink
Merge pull request #1 from marzoul/master
Browse files Browse the repository at this point in the history
Fix compilation on modern kernels
  • Loading branch information
hmaarrfk authored Jan 18, 2019
2 parents 4e9d3c8 + 77b91a3 commit 30a7e91
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions driver/linux/riffa_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@
#include <linux/fs.h>
#include <linux/pci.h>
#include <linux/interrupt.h>

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
#include <linux/sched.h>
#else
#include <linux/sched/signal.h>
#endif

#include <linux/rwsem.h>
#include <linux/dma-mapping.h>
#include <linux/pagemap.h>
Expand Down Expand Up @@ -443,8 +449,10 @@ static inline struct sg_mapping * fill_sg_buf(struct fpga_state * sc, int chnl,
down_read(&current->mm->mmap_sem);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
num_pages = get_user_pages(current, current->mm, udata, num_pages_reqd, 1, 0, pages, NULL);
#else
#elsif LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)
num_pages = get_user_pages(udata, num_pages_reqd, 1, 0, pages, NULL);
#else
num_pages = get_user_pages(udata, num_pages_reqd, FOLL_WRITE, pages, NULL);
#endif
up_read(&current->mm->mmap_sem);
if (num_pages <= 0) {
Expand Down Expand Up @@ -1530,7 +1538,12 @@ static void __devexit fpga_remove(struct pci_dev *dev)
// MODULE INIT/EXIT FUNCTIONS
///////////////////////////////////////////////////////

static DEFINE_PCI_DEVICE_TABLE(fpga_ids) = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
static DEFINE_PCI_DEVICE_TABLE(fpga_ids) =
#else
static const struct pci_device_id fpga_ids[] =
#endif
{
{PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID)},
{PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID)},
{0},
Expand Down

0 comments on commit 30a7e91

Please sign in to comment.