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:
Frodo Looijaard committed 1999-09-13 20:55:49 +00:00
1 parent d529d90336
commit 399608b208
4 files changed
+58 -8

No files matched your search

+16 -2
View File
@@ -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
}
}
}