Only a few months since MHDDK 2.0 released and Linux has already changed something! I guess thats not a big surprise.
Changes to Linux Kernel 2.6.39 include the removal of the big kernel lock completely. Since the ioctl of the MHDDK kernel component used the lock, things obviously broke. Moving forward, drivers are encouraged to use their own locks instead of relying on the big kernel lock. We made the changes and tested them without any weird side-effects. The following changes should be made to nirlpk.c.
1. Remove linux/smp_lock.h
// Base module includes
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
2. Declare a new driver lock
#ifndef nNIRLP_kDefineSemaphore
static DECLARE_MUTEX(nNIRLP_lock);
static DECLARE_MUTEX(nNIRLP_IOCTL_lock);
#else
static DEFINE_SEMAPHORE(nNIRLP_lock);
static DEFINE_SEMAPHORE(nNIRLP_IOCTL_lock);
#endif
3. Use the new lock instead of the big kernel lock, if the system kernel has an unlocked ioctl.
#ifndef HAVE_UNLOCKED_IOCTL
#define nNIRLP_LOCK()
#define nNIRLP_UNLOCK()
#else
#define nNIRLP_LOCK() down(&nNIRLP_IOCTL_lock);
#define nNIRLP_UNLOCK() up(&nNIRLP_IOCTL_lock);
#endif
This new lock gives us the same protection that we had from the big kernel lock in MHDDK 2.0.
Enjoy!