if ((retval = omnibook_acpi_execute(GET_WIRELESS_METHOD,0,&raw_state)))
                return retval;
 
+       dprintk("get_wireless raw_state: %x\n", raw_state);
 
        *state = ( raw_state & WLEX_MASK ) ? WIFI_EX : 0;
        *state |= ( raw_state & WLAT_MASK ) ? WIFI_STA : 0;
 
 #include <linux/pci.h>
 #include <linux/kref.h>
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-#include <asm/semaphore.h>
-#define DEFINE_MUTEX(lock)             DECLARE_MUTEX(lock)
-#define mutex_lock(lock)               down(lock)
-#define mutex_lock_interruptible(lock) down_interruptible(lock)
-#define mutex_unlock(lock)             up(lock)
-#else
-#include <linux/mutex.h>
-#endif
-
 #include <asm/io.h>
 #include "ec.h"
+#include "compat.h"
 
 /*
  * ATI's IXP PCI-LPC bridge
 
 /*
- * compat.h -- Older kernel (=> 2.6.8) support 
+ * compat.h -- Older kernel (=> 2.6.9) support 
  * 
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
  * Written by Mathieu Bérard <mathieu.berard@crans.org>, 2006
  */
 
-/*
- * For compatibility with kernel older than 2.6.11
- */
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11))
-typedef u32 pm_message_t;
-#endif
-
-static int __init omnibook_probe(struct platform_device *dev);
-static int __exit omnibook_remove(struct platform_device *dev);
-static int omnibook_suspend(struct platform_device *dev, pm_message_t state);
-static int omnibook_resume(struct platform_device *dev);
+#include <linux/version.h>
 
 /*
- * For compatibility with kernel older than 2.6.15
+ * For compatibility with kernel older than 2.6.16
+ * Mutex to Semaphore fallback
  */
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
-
-#define to_platform_device(x) container_of((x), struct platform_device, dev)
-
-static int __init compat_omnibook_probe(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       return omnibook_probe(pdev);
-}
-
-static int __exit compat_omnibook_remove(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       return omnibook_remove(pdev);
-}
-
-static int compat_omnibook_suspend(struct device *dev, pm_message_t state, u32 level)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       return omnibook_suspend(pdev, state);
-}
-
-static int compat_omnibook_resume(struct device *dev, u32 level)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       return omnibook_resume(pdev);
-}
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
+#include <asm/semaphore.h>
+#define DEFINE_MUTEX(lock)             DECLARE_MUTEX(lock)
+#define mutex_lock(lock)               down(lock)
+#define mutex_lock_interruptible(lock) down_interruptible(lock)
+#define mutex_unlock(lock)             up(lock)
+#else
+#include <linux/mutex.h>
 #endif
 
-
 /*
  * For compatibility with kernel older than 2.6.14
  */
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14))
-void inline *kzalloc(size_t size, int flags)
+static void inline *kzalloc(size_t size, int flags)
 {
        void *ret = kmalloc(size, flags);
        if (ret)
 }
 #endif
 
+/*
+ * For compatibility with kernel older than 2.6.11
+ */
+
+#ifndef DEFINE_SPINLOCK
+#define DEFINE_SPINLOCK(s)              spinlock_t s = SPIN_LOCK_UNLOCKED
+#endif
+
+/*
+ * Those kernel don't have ICH7 southbridge pcids
+ */
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11))
+#define PCI_DEVICE_ID_INTEL_ICH7_0      0x27b8
+#define PCI_DEVICE_ID_INTEL_ICH7_1      0x27b9
+#define PCI_DEVICE_ID_INTEL_ICH7_31     0x27bd
+#endif
 
 
 
 
 
 #include <asm/io.h>
 #include "ec.h"
-
-/*
- * For compatibility with kernel older than 2.6.11
- */
-
-#ifndef DEFINE_SPINLOCK
-#define DEFINE_SPINLOCK(s)              spinlock_t s = SPIN_LOCK_UNLOCKED
-#endif
-
+#include "compat.h"
 
 /*
  * Interrupt control
 
 #include <linux/version.h>
 #include <asm/uaccess.h>
 
+#include "ec.h"
+#include "laptop.h"
+#include "compat.h"
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
 #include <linux/platform_device.h>
 #else
 #include <linux/device.h>
 #endif
 
-#include "ec.h"
-#include "laptop.h"
-#include "compat.h"
+/*
+ * For compatibility with kernel older than 2.6.11
+ */
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11))
+typedef u32 pm_message_t;
+#endif
+
+static int __init omnibook_probe(struct platform_device *dev);
+static int __exit omnibook_remove(struct platform_device *dev);
+static int omnibook_suspend(struct platform_device *dev, pm_message_t state);
+static int omnibook_resume(struct platform_device *dev);
+
+/*
+ * For compatibility with kernel older than 2.6.15
+ */
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
+
+#define to_platform_device(x) container_of((x), struct platform_device, dev)
+
+static int __init compat_omnibook_probe(struct device *dev)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+       return omnibook_probe(pdev);
+}
+
+static int __exit compat_omnibook_remove(struct device *dev)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+       return omnibook_remove(pdev);
+}
+
+static int compat_omnibook_suspend(struct device *dev, pm_message_t state, u32 level)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+       return omnibook_suspend(pdev, state);
+}
+
+static int compat_omnibook_resume(struct device *dev, u32 level)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+       return omnibook_resume(pdev);
+}
+
+#endif
+
 
 static struct proc_dir_entry *omnibook_proc_root = NULL;
 
 /*
  * The platform_driver interface was added in linux 2.6.15
  */
-
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
 
 static struct platform_device *omnibook_device;
 
  
 #include "omnibook.h"
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-#include <asm/semaphore.h>
-#define DEFINE_MUTEX(lock)             DECLARE_MUTEX(lock)
-#define mutex_lock(lock)               down(lock)
-#define mutex_lock_interruptible(lock) down_interruptible(lock)
-#define mutex_unlock(lock)             up(lock)
-#else
-#include <linux/mutex.h>
-#endif
-
 #include <linux/preempt.h>
 #include <linux/pci.h>
 #include <linux/kref.h>
 #include <asm/io.h>
 #include <asm/mc146818rtc.h>
 #include "ec.h"
+#include "compat.h"
 
 /*
  * ATI's IXP PCI-LPC bridge
 
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/autoconf.h>
 #include <linux/version.h>
 
 /*