mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-31 13:10:30 +00:00
Updates for 2.0.x kernel compilation
Most important change: GL518SM-rev00 can't use kernel threads on 2.0 and early 2.1 kernels git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@563 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
d529d90336
commit
399608b208
4 files changed
+58
-8
No files matched your search
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <linux/i2c.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53)
|
||||
#include <linux/init.h>
|
||||
#else
|
||||
|
||||
+16
-2
@@ -150,8 +150,11 @@ struct gl518_data {
|
||||
|
||||
struct semaphore update_lock;
|
||||
|
||||
int iterate_lock, quit_thread;
|
||||
int iterate_lock;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
|
||||
int quit_thread;
|
||||
struct task_struct *thread;
|
||||
#endif
|
||||
struct wait_queue *wq;
|
||||
|
||||
char valid; /* !=0 if following fields are valid */
|
||||
@@ -201,7 +204,9 @@ static int gl518_write_value(struct i2c_client *client, u8 reg, u16 value);
|
||||
static void gl518_update_client(struct i2c_client *client);
|
||||
|
||||
static void gl518_update_client_rev00(struct i2c_client *client);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
|
||||
static int gl518_update_thread(void *data);
|
||||
#endif
|
||||
static void gl518_update_iterate(struct i2c_client *client);
|
||||
|
||||
static void gl518_vin(struct i2c_client *client, int operation,
|
||||
@@ -389,8 +394,10 @@ static int gl518_detect(struct i2c_adapter *adapter, int address, int kind)
|
||||
/* Initialize the GL518SM chip */
|
||||
data->iterate = 0;
|
||||
data->iterate_lock = 0;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
|
||||
data->quit_thread = 0;
|
||||
data->thread = NULL;
|
||||
#endif
|
||||
data->alarm_mask = 0xff;
|
||||
gl518_init_client((struct i2c_client *) new_client);
|
||||
return 0;
|
||||
@@ -473,10 +480,12 @@ int gl518_detach_client(struct i2c_client *client)
|
||||
}
|
||||
gl518_list[i] = NULL;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
|
||||
if (data->thread) {
|
||||
data->quit_thread = 1;
|
||||
wake_up_interruptible(&data->wq);
|
||||
}
|
||||
#endif
|
||||
|
||||
kfree(client);
|
||||
|
||||
@@ -631,7 +640,7 @@ void gl518_update_client_rev00(struct i2c_client *client)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
|
||||
int gl518_update_thread(void *c)
|
||||
{
|
||||
struct i2c_client *client = c;
|
||||
@@ -670,6 +679,7 @@ int gl518_update_thread(void *c)
|
||||
data->quit_thread = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This updates vdd, vin1, vin2 values by doing slow and multiple
|
||||
comparisons for the GL518SM rev 00 that lacks support for direct
|
||||
@@ -709,9 +719,11 @@ void gl518_update_iterate(struct i2c_client *client)
|
||||
for (i=0; i<3; i++)
|
||||
gl518_write_value(client, VIN_REG(i), max[i] << 8 | min[i]);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
|
||||
if ((data->thread) &&
|
||||
((data->quit_thread) || signal_pending(current)))
|
||||
goto finish;
|
||||
#endif
|
||||
|
||||
/* we wait now 1.5 seconds before comparing */
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
@@ -980,6 +992,7 @@ void gl518_iterate(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
data->valid=0;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
|
||||
if ((data->iterate != 2) && (data->thread)) {
|
||||
data->quit_thread = 1;
|
||||
wake_up_interruptible(&data->wq);
|
||||
@@ -987,6 +1000,7 @@ void gl518_iterate(struct i2c_client *client, int operation, int ctl_name,
|
||||
data->wq = NULL;
|
||||
kernel_thread(gl518_update_thread, (void*) client, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-2
@@ -31,13 +31,24 @@
|
||||
#ifdef MODULE
|
||||
#include <linux/module.h>
|
||||
#ifndef MODULE_AUTHOR
|
||||
#define MODULE_AUTHOR(whatever)
|
||||
#define MODULE_AUTHOR(noone)
|
||||
#endif
|
||||
#ifndef MODULE_DESCRIPTION
|
||||
#define MODULE_DESCRIPTION(whatever)
|
||||
#define MODULE_DESCRIPTION(none)
|
||||
#endif
|
||||
#ifndef MODULE_PARM
|
||||
#define MODULE_PARM(no,param)
|
||||
#endif
|
||||
#ifndef MODULE_PARM_DESC
|
||||
#define MODULE_PARM_DES(no,description)
|
||||
#endif
|
||||
#endif /* def MODULE */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
|
||||
#define EXPORT_SYMBOL(noexport)
|
||||
#define EXPORT_NO_SYMBOLS
|
||||
#endif
|
||||
|
||||
/* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels
|
||||
get_user was redefined in 2.1 kernels to use two arguments, and returns
|
||||
an error code */
|
||||
|
||||
+27
-4
@@ -699,15 +699,22 @@ sub main
|
||||
|
||||
#ifdef MODULE
|
||||
#include <linux/module.h>
|
||||
#endif /* def MODULE */
|
||||
#ifndef MODULE_AUTHOR
|
||||
#define MODULE_AUTHOR(whatever)
|
||||
#define MODULE_AUTHOR(noone)
|
||||
#endif
|
||||
#ifndef MODULE_DESCRIPTION
|
||||
#define MODULE_DESCRIPTION(whatever)
|
||||
#define MODULE_DESCRIPTION(none)
|
||||
#endif
|
||||
#ifndef MODULE_PARM
|
||||
#define MODULE_PARM(no,param)
|
||||
#endif
|
||||
#ifndef MODULE_PARM_DESC
|
||||
#define MODULE_PARM_DESC(no,description)
|
||||
#endif /* def MODULE */
|
||||
|
||||
EOF
|
||||
|
||||
if (`grep KERNEL_VERSION "$package_root/$package_file"`) {
|
||||
print OUTPUT << 'EOF';
|
||||
#include <linux/version.h>
|
||||
@@ -715,6 +722,22 @@ EOF
|
||||
#define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c))
|
||||
#endif
|
||||
|
||||
EOF
|
||||
}
|
||||
if (`grep EXPORT_NO_SYMBOLS "$package_root/$package_file"`) {
|
||||
print OUTPUT << 'EOF';
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
|
||||
#define EXPORT_NO_SYMBOLS
|
||||
#endif
|
||||
|
||||
EOF
|
||||
}
|
||||
if (`grep EXPORT_SYMBOL "$package_root/$package_file"`) {
|
||||
print OUTPUT << 'EOF';
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
|
||||
#define EXPORT_SYMBOL(noexport)
|
||||
#endif
|
||||
|
||||
EOF
|
||||
}
|
||||
if (`grep 'copy_from_user\\|copy_to_user\\|get_user_data' "$package_root/$package_file"`) {
|
||||
@@ -772,7 +795,7 @@ EOF
|
||||
|
||||
EOF
|
||||
}
|
||||
if (`grep 'ioremap\|iounmap' "$package_root/$package_file"`) {
|
||||
if (`grep 'ioremap\\|iounmap' "$package_root/$package_file"`) {
|
||||
print OUTPUT << 'EOF';
|
||||
/* I hope this is always correct, even for the PPC, but I really think so.
|
||||
And yes, the kernel version is exactly correct */
|
||||
@@ -837,7 +860,7 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
}
|
||||
if (`grep 'PCI_DEVICE_ID_INTEL_82801AA_3\|PCI_DEVICE_ID_INTEL_82801AB_3' "$package_root/$package_file"`) {
|
||||
if (`grep 'PCI_DEVICE_ID_INTEL_82801AA_3\\|PCI_DEVICE_ID_INTEL_82801AB_3' "$package_root/$package_file"`) {
|
||||
print OUTPUT << 'EOF';
|
||||
#ifndef PCI_DEVICE_ID_INTEL_82801AA_3
|
||||
#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
|
||||
|
||||
Reference in new issue
Block a user