]> Devoid-pointer.net GitWeb - omnibook.git/commitdiff
* Remove autoconf.h include uneeded
authorMathieu Bérard <mathieu.berard@crans.org>
Sat, 9 Sep 2006 22:50:59 +0000 (22:50 +0000)
committerMathieu Bérard <mathieu.berard@crans.org>
Sat, 9 Sep 2006 22:50:59 +0000 (22:50 +0000)
* Fix code for compilation with old kernel
  Module now compile cleanly against a 2.6.9

acpi.c
compal.c
compat.h
ec.c
init.c
nbsmi.c
omnibook.h

diff --git a/acpi.c b/acpi.c
index c1b3ce3abef9f2db38a7d43705db7b936067cb66..f8caf23d13856578b679e7548eb268f53959ec60 100644 (file)
--- a/acpi.c
+++ b/acpi.c
@@ -130,6 +130,7 @@ static int omnibook_acpi_get_wireless(const struct omnibook_operation *io_op, un
        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;
index 985feaf6d4a30eb979ae500e3a8df08234251780..6ca36fc3400014daba38376a1060ac51b7d4e0ca 100644 (file)
--- a/compal.c
+++ b/compal.c
 #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
index 29ba6282b3be0bb7f10b5661726c0ebb52265a39..ea06159cc607e0fe607c8d3c9597b1ef157c6685 100644 (file)
--- a/compat.h
+++ b/compat.h
@@ -1,5 +1,5 @@
 /*
- * 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)
@@ -76,6 +46,23 @@ void inline *kzalloc(size_t size, int flags)
 }
 #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
 
 
 
diff --git a/ec.c b/ec.c
index 74023987c2dcaf7db4120d00ce1f639d8fd007a7..2f10ff10d06810e50c1230033bafecd8a7c3ac8d 100644 (file)
--- a/ec.c
+++ b/ec.c
 
 #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
diff --git a/init.c b/init.c
index 0e761100c9b4b3b9c9120683eed7c7bfa1188627..ba08eb1b09c6e07f5937b78ee289e1e4c9273e0a 100644 (file)
--- a/init.c
+++ b/init.c
 #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;
 
@@ -43,7 +91,6 @@ static int omnibook_userset = 0;
 /*
  * 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;
diff --git a/nbsmi.c b/nbsmi.c
index e6f1c562e555c0e06747b52f021f6a9184c39873..aabc2511b18b90857a8c7662c1f0793bafea6016 100644 (file)
--- a/nbsmi.c
+++ b/nbsmi.c
  
 #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
index da1b4c4634b7edd69c59792629c6d898ad62f942..7a91e8d69c4346ac0ecf5262d1f41954486f40d4 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/autoconf.h>
 #include <linux/version.h>
 
 /*