From 02fbad060e00117a9732b6da3415a4d11f44c6ef Mon Sep 17 00:00:00 2001 From: glevand Date: Sun, 29 Mar 2015 14:31:08 +0200 Subject: [PATCH] support Linux kernel 3.19 --- spuisofs.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/spuisofs.c b/spuisofs.c index f656862..8fdcb48 100644 --- a/spuisofs.c +++ b/spuisofs.c @@ -131,7 +131,11 @@ module_param(spuisofs_spe_buf_addr_32bit, int, 0); static ssize_t spuisofs_spe_regs_read(struct file *file, char __user *buffer, size_t size, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); if (*pos >= inode->i_size) @@ -147,7 +151,11 @@ static ssize_t spuisofs_spe_regs_read(struct file *file, char __user *buffer, static ssize_t spuisofs_spe_regs_write(struct file *file, const char __user *buffer, size_t size, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); if (*pos >= inode->i_size) @@ -162,7 +170,11 @@ static ssize_t spuisofs_spe_regs_write(struct file *file, const char __user *buf */ static int spuisofs_spe_regs_mmap(struct file *file, struct vm_area_struct *vma) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); unsigned long size, pfn; @@ -191,7 +203,11 @@ static const struct file_operations spuisofs_spe_regs_fops = { static ssize_t spuisofs_spe_mem_read(struct file *file, char __user *buffer, size_t size, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); if (*pos >= inode->i_size) @@ -207,7 +223,11 @@ static ssize_t spuisofs_spe_mem_read(struct file *file, char __user *buffer, static ssize_t spuisofs_spe_mem_write(struct file *file, const char __user *buffer, size_t size, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); if (*pos >= inode->i_size) @@ -222,7 +242,11 @@ static ssize_t spuisofs_spe_mem_write(struct file *file, const char __user *buff */ static int spuisofs_spe_mem_mmap(struct file *file, struct vm_area_struct *vma) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); unsigned long size, pfn; @@ -251,7 +275,11 @@ static const struct file_operations spuisofs_spe_mem_fops = { static ssize_t spuisofs_mem_read(struct file *file, char __user *buffer, size_t size, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); if (*pos >= inode->i_size) @@ -267,7 +295,11 @@ static ssize_t spuisofs_mem_read(struct file *file, char __user *buffer, static ssize_t spuisofs_mem_write(struct file *file, const char __user *buffer, size_t size, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); if (*pos >= inode->i_size) @@ -282,7 +314,11 @@ static ssize_t spuisofs_mem_write(struct file *file, const char __user *buffer, */ static int spuisofs_mem_mmap(struct file *file, struct vm_area_struct *vma) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_inode_info *si = SPUISOFS_I(inode); return remap_vmalloc_range(vma, si->virt_addr, 0); @@ -326,7 +362,11 @@ static const struct file_operations spuisofs_info_fops = { static ssize_t spuisofs_run_write(struct file *file, const char __user *buffer, size_t size, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) struct inode *inode = file->f_dentry->d_inode; +#else + struct inode *inode = file->f_path.dentry->d_inode; +#endif struct spuisofs_run_args args; int err; @@ -688,7 +728,11 @@ static irqreturn_t spuisofs_spe_interrupt(int irq, void *data) printk(KERN_INFO"spuisofs: data storage fault at %llx (%llx)\n", ea, kernel_ea); if (dsisr & MFC_DSISR_PTE_NOT_FOUND) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) err = hash_page(kernel_ea, _PAGE_PRESENT, 0x300); +#else + err = hash_page(kernel_ea, _PAGE_PRESENT, 0x300, dsisr); +#endif if (err) { printk(KERN_INFO"spuisofs: hash_page failed with %d\n", err); goto out; -- 2.11.4.GIT