[MPlayer-dev-eng] [PATCH] mga_vid for linux kernel 2.5

Sytse Wielinga s.b.wielinga at student.utwente.nl
Tue Jun 25 11:23:21 CEST 2002


Hi,

I've just tried to compile mga_vid for the linux kernel version 2.5.24, and I
found three incompatibilities:
 - simple_strtol isn't exported anymore since 2.5.5 (probably due to all the
   changes to its arguments.) Now mga_vid.c includes it itself for kernel
   versions >= 2.5.5. Compiling will emit a warning (it is still defined in the
   kernel headers) but it should be ok.
 - remap_page_range of kernel >= 2.5.3 wants the entire vma struct as the first
   argument
 - kdev_t is a struct in kernel >= 2.5.2.

This patch should make mga_vid compatible with all released 2.5 kernel
versions:

Index: mga_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/drivers/mga_vid.c,v
retrieving revision 1.46
diff -u -r1.46 mga_vid.c
--- mga_vid.c   13 May 2002 22:10:11 -0000      1.46
+++ mga_vid.c   25 Jun 2002 09:10:26 -0000
@@ -133,7 +133,9 @@
                 *endp = (char *)cp;
         return result;
 }
+#endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,5)
 static long simple_strtol(const char *cp,char **endp,unsigned int base)
 {
         if(*cp=='-')
@@ -1472,8 +1474,13 @@
 #ifdef MP_DEBUG
        printk(KERN_DEBUG "mga_vid: mapping video memory into userspace\n");
 #endif 
+#if LINUX_VERSION_CODE >= 132355
+       if(remap_page_range(vma, vma->vm_start, mga_mem_base + mga_src_base,
+                vma->vm_end - vma->vm_start, vma->vm_page_prot)) 
+#else                          
        if(remap_page_range(vma->vm_start, mga_mem_base + mga_src_base,
                 vma->vm_end - vma->vm_start, vma->vm_page_prot)) 
+#endif                         
        {
                printk(KERN_ERR "mga_vid: error mapping video memory\n");
                return(-EAGAIN);
@@ -1507,7 +1514,11 @@
 
 static int mga_vid_open(struct inode *inode, struct file *file)
 {
+#if LINUX_VERSION_CODE >= 132354
+       int minor = MINOR(inode->i_rdev.value);
+#else
        int minor = MINOR(inode->i_rdev);
+#endif
 
        if(minor != 0)
         return(-ENXIO);

I have tested it and it works for me. Could somebody add this to CVS?

Thanks
Sytse Wielinga



More information about the MPlayer-dev-eng mailing list