Re: patch for kernel >= 2.6.37
Ville Skyttä <ville.skytta <at> iki.fi>
2011-06-19 19:05:42 GMT
On 06/11/2011 05:31 PM, YUP wrote:
> OK, finally I found a way to fix lock_kernel issue. Please see patch
> attached
I think CONFIG_KERNEL_LOCK should be CONFIG_LOCK_KERNEL.
Have you tried the patched modules with a recent kernel? If yes, what
have you tried them with (vdr? something else?), and with which kernel?
Anyway, attached is the complete patch over em8300-cgmeiner r727 I'm
applying to get the modules to build against Fedora 15's
2.6.38.8-32.fc15.x86_64 kernel. Something's still not right, vdr-dxr3
crashes right at vdr startup, and I haven't dug deeper what might be the
cause - maybe the unlocked_ioctl calls in em8300_ioctl32.c need some
kind of locking, maybe it's something else, dunno.
On the same system as the above, using the Fedora 14
2.6.35.13-92.fc14.x86_64 kernel and the same patched em8300-cgmeiner
modules compiled for this kernel (same vdr, vdr-dxr3 etc) things seem to
work just fine so I suppose this is related to the newer kernel. The
box is otherwise Fedora 15 except for the Fedora 14 kernel, and my
"DXR3" is an ADV7170 based HW+.
diff -r 016dd9c28b1a modules/adv717x.c
--- a/modules/adv717x.c Wed Oct 13 18:57:24 2010 +0200
+++ b/modules/adv717x.c Sun Jun 19 21:52:31 2011 +0300
<at> <at> -39,7 +39,6 <at> <at>
#include <linux/sched.h>
#include <linux/types.h>
-#include <linux/videodev.h>
#include <asm/uaccess.h>
#include <linux/i2c.h>
diff -r 016dd9c28b1a modules/bt865.c
--- a/modules/bt865.c Wed Oct 13 18:57:24 2010 +0200
+++ b/modules/bt865.c Sun Jun 19 21:52:31 2011 +0300
<at> <at> -43,7 +43,6 <at> <at>
#include <linux/sched.h>
#include <linux/types.h>
-#include <linux/videodev.h>
#include <asm/uaccess.h>
#include <linux/i2c.h>
diff -r 016dd9c28b1a modules/em8300_alsa.c
--- a/modules/em8300_alsa.c Wed Oct 13 18:57:24 2010 +0200
+++ b/modules/em8300_alsa.c Sun Jun 19 21:52:31 2011 +0300
<at> <at> -487,7 +487,7 <at> <at>
memset(em8300_alsa, 0, sizeof(em8300_alsa_t));
- init_MUTEX(&em8300_alsa->lock);
+ sema_init(&em8300_alsa->lock, 1);
em8300_alsa->em = em;
em8300_alsa->card = card;
diff -r 016dd9c28b1a modules/em8300_fifo.c
--- a/modules/em8300_fifo.c Wed Oct 13 18:57:24 2010 +0200
+++ b/modules/em8300_fifo.c Sun Jun 19 21:52:31 2011 +0300
<at> <at> -116,7 +116,7 <at> <at>
}
}
- init_MUTEX(&f->lock);
+ sema_init(&f->lock, 1);
f->valid = 1;
return 0;
diff -r 016dd9c28b1a modules/em8300_ioctl32.c
--- a/modules/em8300_ioctl32.c Wed Oct 13 18:57:24 2010 +0200
+++ b/modules/em8300_ioctl32.c Sun Jun 19 21:52:31 2011 +0300
<at> <at> -76,8 +76,13 <at> <at>
if (!err) {
set_fs(KERNEL_DS);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+ err = filp->f_op->unlocked_ioctl(filp,
+ EM8300_IOCTL_INIT, (unsigned long)&karg);
+#else
err = filp->f_op->ioctl(filp->f_dentry->d_inode, filp,
EM8300_IOCTL_INIT, (unsigned long)&karg);
+#endif
set_fs(old_fs);
kfree(karg.ucode);
<at> <at> -94,7 +99,11 <at> <at>
case EM8300_IOCTL32_INIT:
return em8300_do_ioctl32_init(arg, filp);
default:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+ return filp->f_op->unlocked_ioctl(filp, cmd, arg);
+#else
return filp->f_op->ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
+#endif
}
}
<at> <at> -108,7 +117,11 <at> <at>
if (cmd==EM8300_IOCTL32_INIT) {
return em8300_do_ioctl32_init(arg, filp);
} else {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+ return filp->f_op->unlocked_ioctl(filp, cmd, arg);
+#else
return filp->f_op->ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
+#endif
}
}
diff -r 016dd9c28b1a modules/em8300_main.c
--- a/modules/em8300_main.c Wed Oct 13 18:57:24 2010 +0200
+++ b/modules/em8300_main.c Sun Jun 19 21:52:31 2011 +0300
<at> <at> -52,8 +52,10 <at> <at>
#include <linux/i2c-algo-bit.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)
#include <linux/smp_lock.h>
#endif
+#endif
#include "em8300_compat24.h"
#include "encoder.h"
<at> <at> -204,9 +206,11 <at> <at>
struct inode *inode = filp->f_path.dentry->d_inode;
int subdevice = EM8300_IMINOR(inode) % 4;
- long ret;
+ long ret = -EINVAL;
+#ifdef CONFIG_LOCK_KERNEL
lock_kernel();
+#endif
switch (subdevice) {
case EM8300_SUBDEVICE_AUDIO:
ret = em8300_audio_ioctl(em, cmd, arg);
<at> <at> -217,7 +221,9 <at> <at>
case EM8300_SUBDEVICE_CONTROL:
ret = em8300_control_ioctl(em, cmd, arg);
}
+#ifdef CONFIG_LOCK_KERNEL
unlock_kernel();
+#endif
return ret;
<at> <at> -534,9 +540,13 <at> <at>
struct em8300_s *em = filp->private_data;
long ret;
+#ifdef CONFIG_LOCK_KERNEL
lock_kernel();
+#endif
ret = em8300_audio_ioctl(em, cmd, arg);
+#ifdef CONFIG_LOCK_KERNEL
unlock_kernel();
+#endif
return ret;
}
<at> <at> -877,7 +887,7 <at> <at>
init_waitqueue_head(&em->sp_ptsfifo_wait);
em->audio_driver_style = NONE;
- init_MUTEX(&em->audio_driver_style_lock);
+ sema_init(&em->audio_driver_style_lock, 1);
result = request_irq(dev->irq, em8300_irq, IRQF_SHARED | IRQF_DISABLED, "em8300", (void *) em);
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Dxr3-devel mailing list
Dxr3-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dxr3-devel