aboutsummaryrefslogtreecommitdiffstats
path: root/i2c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-01-18 16:44:06 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-18 16:44:06 -0800
commit891f234de23e7cb3d37acbb2f0f058cd8719300f (patch)
tree228d0e4aa0c4f8c3bb38c62a817b233ababac992 /i2c
parent1a3570ed2d19741e14ca747557bd25a80519ec54 (diff)
downloadpatches-891f234de23e7cb3d37acbb2f0f058cd8719300f.tar.gz
bunch of i2c and hwmon patches and 1 usb patch
Diffstat (limited to 'i2c')
-rw-r--r--i2c/hwmon-convert-semaphores-to-mutexes.patch5044
-rw-r--r--i2c/hwmon-f71805f-convert-semaphore-to-mutex.patch216
-rw-r--r--i2c/hwmon-it87-probe-i2c-0x2d-only.patch79
-rw-r--r--i2c/hwmon-sensor-attr-array-2.patch44
-rw-r--r--i2c/hwmon-w83627hf-add-w83687thf-support.patch252
-rw-r--r--i2c/hwmon-w83792d-drop-useless-macros.patch76
-rw-r--r--i2c/hwmon-w83792d-use-attr-arrays.patch748
-rw-r--r--i2c/i2c-convert-semaphores-to-mutexes-2.patch596
-rw-r--r--i2c/i2c-convert-semaphores-to-mutexes-3.patch87
-rw-r--r--i2c/i2c-device-id-lm75.patch2
-rw-r--r--i2c/i2c-scx200_acb-01-whitespace.patch259
-rw-r--r--i2c/i2c-scx200_acb-02-debug.patch145
-rw-r--r--i2c/i2c-scx200_acb-03-refactor.patch175
-rw-r--r--i2c/i2c-scx200_acb-04-lock_kernel.patch65
-rw-r--r--i2c/i2c-scx200_acb-05-cs5535.patch128
-rw-r--r--i2c/i2c-scx200_acb-06-poll.patch72
-rw-r--r--i2c/i2c-scx200_acb-07-docs.patch52
-rw-r--r--i2c/i2c-speedup-block-transfers.patch55
18 files changed, 8094 insertions, 1 deletions
diff --git a/i2c/hwmon-convert-semaphores-to-mutexes.patch b/i2c/hwmon-convert-semaphores-to-mutexes.patch
new file mode 100644
index 00000000000000..a25e1b76af2774
--- /dev/null
+++ b/i2c/hwmon-convert-semaphores-to-mutexes.patch
@@ -0,0 +1,5044 @@
+From khali@linux-fr.org Wed Jan 18 14:18:46 2006
+Date: Wed, 18 Jan 2006 23:19:26 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ingo Molnar <mingo@elte.hu>
+Subject: [PATCH 15/17] hwmon: Semaphore to mutex conversions
+Message-Id: <20060118231926.542a7b93.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-convert-semaphores-to-mutexes.patch
+
+From: Ingo Molnar <mingo@elte.hu>
+
+convert drivers/hwmon/*.c semaphore use to mutexes.
+
+the conversion was generated via scripts, and the result was validated
+automatically via a script as well.
+
+all affected hwmon drivers were build-tested.
+
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+----
+ drivers/hwmon/adm1021.c | 13 +++---
+ drivers/hwmon/adm1025.c | 25 ++++++------
+ drivers/hwmon/adm1026.c | 87 ++++++++++++++++++++++-----------------------
+ drivers/hwmon/adm1031.c | 49 ++++++++++++-------------
+ drivers/hwmon/adm9240.c | 29 +++++++--------
+ drivers/hwmon/asb100.c | 45 +++++++++++------------
+ drivers/hwmon/atxp1.c | 9 ++--
+ drivers/hwmon/ds1621.c | 13 +++---
+ drivers/hwmon/fscher.c | 41 ++++++++++-----------
+ drivers/hwmon/fscpos.c | 29 +++++++--------
+ drivers/hwmon/gl518sm.c | 25 ++++++------
+ drivers/hwmon/gl520sm.c | 45 +++++++++++------------
+ drivers/hwmon/hdaps.c | 37 +++++++++----------
+ drivers/hwmon/it87.c | 61 ++++++++++++++++---------------
+ drivers/hwmon/lm63.c | 29 +++++++--------
+ drivers/hwmon/lm75.c | 13 +++---
+ drivers/hwmon/lm77.c | 21 +++++-----
+ drivers/hwmon/lm78.c | 47 ++++++++++++------------
+ drivers/hwmon/lm80.c | 27 +++++++------
+ drivers/hwmon/lm83.c | 13 +++---
+ drivers/hwmon/lm85.c | 67 +++++++++++++++++-----------------
+ drivers/hwmon/lm87.c | 39 ++++++++++----------
+ drivers/hwmon/lm90.c | 21 +++++-----
+ drivers/hwmon/lm92.c | 17 ++++----
+ drivers/hwmon/max1619.c | 13 +++---
+ drivers/hwmon/pc87360.c | 61 ++++++++++++++++---------------
+ drivers/hwmon/sis5595.c | 47 ++++++++++++------------
+ drivers/hwmon/smsc47b397.c | 17 ++++----
+ drivers/hwmon/smsc47m1.c | 41 ++++++++++-----------
+ drivers/hwmon/via686a.c | 33 ++++++++---------
+ drivers/hwmon/vt8231.c | 51 +++++++++++++-------------
+ drivers/hwmon/w83627ehf.c | 33 ++++++++---------
+ drivers/hwmon/w83627hf.c | 57 +++++++++++++++--------------
+ drivers/hwmon/w83781d.c | 55 ++++++++++++++--------------
+ drivers/hwmon/w83792d.c | 9 ++--
+ drivers/hwmon/w83l785ts.c | 9 ++--
+ 36 files changed, 632 insertions(+), 596 deletions(-)
+
+---
+--- gregkh-2.6.orig/drivers/hwmon/adm1021.c
++++ gregkh-2.6/drivers/hwmon/adm1021.c
+@@ -26,6 +26,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+
+ /* Addresses to scan */
+@@ -92,7 +93,7 @@ struct adm1021_data {
+ struct class_device *class_dev;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -162,10 +163,10 @@ static ssize_t set_##value(struct device
+ struct adm1021_data *data = i2c_get_clientdata(client); \
+ int temp = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->value = TEMP_TO_REG(temp); \
+ adm1021_write_value(client, reg, data->value); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ set(temp_max, ADM1021_REG_TOS_W);
+@@ -275,7 +276,7 @@ static int adm1021_detect(struct i2c_ada
+ strlcpy(new_client->name, type_name, I2C_NAME_SIZE);
+ data->type = kind;
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -351,7 +352,7 @@ static struct adm1021_data *adm1021_upda
+ struct i2c_client *client = to_i2c_client(dev);
+ struct adm1021_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -375,7 +376,7 @@ static struct adm1021_data *adm1021_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/adm1025.c
++++ gregkh-2.6/drivers/hwmon/adm1025.c
+@@ -53,6 +53,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /*
+ * Addresses to scan
+@@ -133,7 +134,7 @@ static struct i2c_driver adm1025_driver
+ struct adm1025_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+@@ -207,11 +208,11 @@ static ssize_t set_in##offset##_min(stru
+ struct adm1025_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->in_min[offset] = IN_TO_REG(val, in_scale[offset]); \
+ i2c_smbus_write_byte_data(client, ADM1025_REG_IN_MIN(offset), \
+ data->in_min[offset]); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ } \
+ static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
+@@ -221,11 +222,11 @@ static ssize_t set_in##offset##_max(stru
+ struct adm1025_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->in_max[offset] = IN_TO_REG(val, in_scale[offset]); \
+ i2c_smbus_write_byte_data(client, ADM1025_REG_IN_MAX(offset), \
+ data->in_max[offset]); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ } \
+ static DEVICE_ATTR(in##offset##_min, S_IWUSR | S_IRUGO, \
+@@ -247,11 +248,11 @@ static ssize_t set_temp##offset##_min(st
+ struct adm1025_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->temp_min[offset-1] = TEMP_TO_REG(val); \
+ i2c_smbus_write_byte_data(client, ADM1025_REG_TEMP_LOW(offset-1), \
+ data->temp_min[offset-1]); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ } \
+ static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
+@@ -261,11 +262,11 @@ static ssize_t set_temp##offset##_max(st
+ struct adm1025_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->temp_max[offset-1] = TEMP_TO_REG(val); \
+ i2c_smbus_write_byte_data(client, ADM1025_REG_TEMP_HIGH(offset-1), \
+ data->temp_max[offset-1]); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ } \
+ static DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \
+@@ -404,7 +405,7 @@ static int adm1025_detect(struct i2c_ada
+ /* We can fill in the remaining client fields */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -523,7 +524,7 @@ static struct adm1025_data *adm1025_upda
+ struct i2c_client *client = to_i2c_client(dev);
+ struct adm1025_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
+ int i;
+@@ -558,7 +559,7 @@ static struct adm1025_data *adm1025_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/adm1026.c
++++ gregkh-2.6/drivers/hwmon/adm1026.c
+@@ -32,6 +32,7 @@
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
+@@ -260,10 +261,10 @@ struct pwm_data {
+ struct adm1026_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ int valid; /* !=0 if following fields are valid */
+ unsigned long last_reading; /* In jiffies */
+ unsigned long last_config; /* In jiffies */
+@@ -575,7 +576,7 @@ static struct adm1026_data *adm1026_upda
+ int i;
+ long value, alarms, gpio;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ if (!data->valid
+ || time_after(jiffies, data->last_reading + ADM1026_DATA_INTERVAL)) {
+ /* Things that change quickly */
+@@ -710,7 +711,7 @@ static struct adm1026_data *adm1026_upda
+ dev_dbg(&client->dev, "Setting VID from GPIO11-15.\n");
+ data->vid = (data->gpio >> 11) & 0x1f;
+ data->valid = 1;
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return data;
+ }
+
+@@ -739,10 +740,10 @@ static ssize_t set_in_min(struct device
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[nr] = INS_TO_REG(nr, val);
+ adm1026_write_value(client, ADM1026_REG_IN_MIN[nr], data->in_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
+@@ -762,10 +763,10 @@ static ssize_t set_in_max(struct device
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[nr] = INS_TO_REG(nr, val);
+ adm1026_write_value(client, ADM1026_REG_IN_MAX[nr], data->in_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -813,10 +814,10 @@ static ssize_t set_in16_min(struct devic
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[16] = INS_TO_REG(16, val + NEG12_OFFSET);
+ adm1026_write_value(client, ADM1026_REG_IN_MIN[16], data->in_min[16]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_in16_max(struct device *dev, struct device_attribute *attr, char *buf)
+@@ -831,10 +832,10 @@ static ssize_t set_in16_max(struct devic
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[16] = INS_TO_REG(16, val+NEG12_OFFSET);
+ adm1026_write_value(client, ADM1026_REG_IN_MAX[16], data->in_max[16]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -874,11 +875,11 @@ static ssize_t set_fan_min(struct device
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr] = FAN_TO_REG(val, data->fan_div[nr]);
+ adm1026_write_value(client, ADM1026_REG_FAN_MIN(nr),
+ data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -939,7 +940,7 @@ static ssize_t set_fan_div(struct device
+ if (new_div == 0) {
+ return -EINVAL;
+ }
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ orig_div = data->fan_div[nr];
+ data->fan_div[nr] = DIV_FROM_REG(new_div);
+
+@@ -958,7 +959,7 @@ static ssize_t set_fan_div(struct device
+ if (data->fan_div[nr] != orig_div) {
+ fixup_fan_min(dev,nr,orig_div);
+ }
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1001,11 +1002,11 @@ static ssize_t set_temp_min(struct devic
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_min[nr] = TEMP_TO_REG(val);
+ adm1026_write_value(client, ADM1026_REG_TEMP_MIN[nr],
+ data->temp_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,
+@@ -1025,11 +1026,11 @@ static ssize_t set_temp_max(struct devic
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[nr] = TEMP_TO_REG(val);
+ adm1026_write_value(client, ADM1026_REG_TEMP_MAX[nr],
+ data->temp_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1064,11 +1065,11 @@ static ssize_t set_temp_offset(struct de
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_offset[nr] = TEMP_TO_REG(val);
+ adm1026_write_value(client, ADM1026_REG_TEMP_OFFSET[nr],
+ data->temp_offset[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1115,11 +1116,11 @@ static ssize_t set_temp_auto_point1_temp
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_tmin[nr] = TEMP_TO_REG(val);
+ adm1026_write_value(client, ADM1026_REG_TEMP_TMIN[nr],
+ data->temp_tmin[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1150,11 +1151,11 @@ static ssize_t set_temp_crit_enable(stru
+ int val = simple_strtol(buf, NULL, 10);
+
+ if ((val == 1) || (val==0)) {
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->config1 = (data->config1 & ~CFG1_THERM_HOT) | (val << 4);
+ adm1026_write_value(client, ADM1026_REG_CONFIG1,
+ data->config1);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+ return count;
+ }
+@@ -1184,11 +1185,11 @@ static ssize_t set_temp_crit(struct devi
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_crit[nr] = TEMP_TO_REG(val);
+ adm1026_write_value(client, ADM1026_REG_TEMP_THERM[nr],
+ data->temp_crit[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1212,10 +1213,10 @@ static ssize_t set_analog_out_reg(struct
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->analog_out = DAC_TO_REG(val);
+ adm1026_write_value(client, ADM1026_REG_DAC, data->analog_out);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1267,7 +1268,7 @@ static ssize_t set_alarm_mask(struct dev
+ int val = simple_strtol(buf, NULL, 10);
+ unsigned long mask;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->alarm_mask = val & 0x7fffffff;
+ mask = data->alarm_mask
+ | (data->gpio_mask & 0x10000 ? 0x80000000 : 0);
+@@ -1282,7 +1283,7 @@ static ssize_t set_alarm_mask(struct dev
+ mask >>= 8;
+ adm1026_write_value(client, ADM1026_REG_MASK4,
+ mask & 0xff);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1303,7 +1304,7 @@ static ssize_t set_gpio(struct device *d
+ int val = simple_strtol(buf, NULL, 10);
+ long gpio;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->gpio = val & 0x1ffff;
+ gpio = data->gpio;
+ adm1026_write_value(client, ADM1026_REG_GPIO_STATUS_0_7,gpio & 0xff);
+@@ -1311,7 +1312,7 @@ static ssize_t set_gpio(struct device *d
+ adm1026_write_value(client, ADM1026_REG_GPIO_STATUS_8_15,gpio & 0xff);
+ gpio = ((gpio >> 1) & 0x80) | (data->alarms >> 24 & 0x7f);
+ adm1026_write_value(client, ADM1026_REG_STATUS4,gpio & 0xff);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1331,7 +1332,7 @@ static ssize_t set_gpio_mask(struct devi
+ int val = simple_strtol(buf, NULL, 10);
+ long mask;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->gpio_mask = val & 0x1ffff;
+ mask = data->gpio_mask;
+ adm1026_write_value(client, ADM1026_REG_GPIO_MASK_0_7,mask & 0xff);
+@@ -1339,7 +1340,7 @@ static ssize_t set_gpio_mask(struct devi
+ adm1026_write_value(client, ADM1026_REG_GPIO_MASK_8_15,mask & 0xff);
+ mask = ((mask >> 1) & 0x80) | (data->alarm_mask >> 24 & 0x7f);
+ adm1026_write_value(client, ADM1026_REG_MASK1,mask & 0xff);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1359,10 +1360,10 @@ static ssize_t set_pwm_reg(struct device
+ if (data->pwm1.enable == 1) {
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm1.pwm = PWM_TO_REG(val);
+ adm1026_write_value(client, ADM1026_REG_PWM, data->pwm1.pwm);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+ return count;
+ }
+@@ -1378,14 +1379,14 @@ static ssize_t set_auto_pwm_min(struct d
+ struct adm1026_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm1.auto_pwm_min = SENSORS_LIMIT(val,0,255);
+ if (data->pwm1.enable == 2) { /* apply immediately */
+ data->pwm1.pwm = PWM_TO_REG((data->pwm1.pwm & 0x0f) |
+ PWM_MIN_TO_REG(data->pwm1.auto_pwm_min));
+ adm1026_write_value(client, ADM1026_REG_PWM, data->pwm1.pwm);
+ }
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_auto_pwm_max(struct device *dev, struct device_attribute *attr, char *buf)
+@@ -1406,7 +1407,7 @@ static ssize_t set_pwm_enable(struct dev
+ int old_enable;
+
+ if ((val >= 0) && (val < 3)) {
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ old_enable = data->pwm1.enable;
+ data->pwm1.enable = val;
+ data->config1 = (data->config1 & ~CFG1_PWM_AFC)
+@@ -1424,7 +1425,7 @@ static ssize_t set_pwm_enable(struct dev
+ adm1026_write_value(client, ADM1026_REG_PWM,
+ data->pwm1.pwm);
+ }
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+ return count;
+ }
+@@ -1541,7 +1542,7 @@ static int adm1026_detect(struct i2c_ada
+ /* Fill in the remaining client fields */
+ data->type = kind;
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+--- gregkh-2.6.orig/drivers/hwmon/adm1031.c
++++ gregkh-2.6/drivers/hwmon/adm1031.c
+@@ -28,6 +28,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Following macros takes channel parameter starting from 0 to 2 */
+ #define ADM1031_REG_FAN_SPEED(nr) (0x08 + (nr))
+@@ -70,7 +71,7 @@ typedef u8 auto_chan_table_t[8][2];
+ struct adm1031_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ int chip_type;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+@@ -262,10 +263,10 @@ set_fan_auto_channel(struct device *dev,
+
+ old_fan_mode = data->conf1;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if ((ret = get_fan_auto_nearest(data, nr, val, data->conf1, &reg))) {
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return ret;
+ }
+ if (((data->conf1 = FAN_CHAN_TO_REG(reg, data->conf1)) & ADM1031_CONF1_AUTO_MODE) ^
+@@ -288,7 +289,7 @@ set_fan_auto_channel(struct device *dev,
+ }
+ data->conf1 = FAN_CHAN_TO_REG(reg, data->conf1);
+ adm1031_write_value(client, ADM1031_REG_CONF1, data->conf1);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -329,11 +330,11 @@ set_auto_temp_min(struct device *dev, co
+ struct adm1031_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->auto_temp[nr] = AUTO_TEMP_MIN_TO_REG(val, data->auto_temp[nr]);
+ adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr),
+ data->auto_temp[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_auto_temp_max(struct device *dev, char *buf, int nr)
+@@ -349,11 +350,11 @@ set_auto_temp_max(struct device *dev, co
+ struct adm1031_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[nr] = AUTO_TEMP_MAX_TO_REG(val, data->auto_temp[nr], data->pwm[nr]);
+ adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr),
+ data->temp_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -405,11 +406,11 @@ set_pwm(struct device *dev, const char *
+ int val = simple_strtol(buf, NULL, 10);
+ int reg;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) &&
+ (((val>>4) & 0xf) != 5)) {
+ /* In automatic mode, the only PWM accepted is 33% */
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+ data->pwm[nr] = PWM_TO_REG(val);
+@@ -417,7 +418,7 @@ set_pwm(struct device *dev, const char *
+ adm1031_write_value(client, ADM1031_REG_PWM,
+ nr ? ((data->pwm[nr] << 4) & 0xf0) | (reg & 0xf)
+ : (data->pwm[nr] & 0xf) | (reg & 0xf0));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -511,7 +512,7 @@ set_fan_min(struct device *dev, const ch
+ struct adm1031_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ if (val) {
+ data->fan_min[nr] =
+ FAN_TO_REG(val, FAN_DIV_FROM_REG(data->fan_div[nr]));
+@@ -519,7 +520,7 @@ set_fan_min(struct device *dev, const ch
+ data->fan_min[nr] = 0xff;
+ }
+ adm1031_write_value(client, ADM1031_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t
+@@ -540,7 +541,7 @@ set_fan_div(struct device *dev, const ch
+ if (tmp == 0xff)
+ return -EINVAL;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ old_div = FAN_DIV_FROM_REG(data->fan_div[nr]);
+ data->fan_div[nr] = (tmp & 0xC0) | (0x3f & data->fan_div[nr]);
+ new_min = data->fan_min[nr] * old_div /
+@@ -553,7 +554,7 @@ set_fan_div(struct device *dev, const ch
+ data->fan_div[nr]);
+ adm1031_write_value(client, ADM1031_REG_FAN_MIN(nr),
+ data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -627,11 +628,11 @@ set_temp_min(struct device *dev, const c
+
+ val = simple_strtol(buf, NULL, 10);
+ val = SENSORS_LIMIT(val, -55000, nr == 0 ? 127750 : 127875);
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_min[nr] = TEMP_TO_REG(val);
+ adm1031_write_value(client, ADM1031_REG_TEMP_MIN(nr),
+ data->temp_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t
+@@ -643,11 +644,11 @@ set_temp_max(struct device *dev, const c
+
+ val = simple_strtol(buf, NULL, 10);
+ val = SENSORS_LIMIT(val, -55000, nr == 0 ? 127750 : 127875);
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[nr] = TEMP_TO_REG(val);
+ adm1031_write_value(client, ADM1031_REG_TEMP_MAX(nr),
+ data->temp_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t
+@@ -659,11 +660,11 @@ set_temp_crit(struct device *dev, const
+
+ val = simple_strtol(buf, NULL, 10);
+ val = SENSORS_LIMIT(val, -55000, nr == 0 ? 127750 : 127875);
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_crit[nr] = TEMP_TO_REG(val);
+ adm1031_write_value(client, ADM1031_REG_TEMP_CRIT(nr),
+ data->temp_crit[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -778,7 +779,7 @@ static int adm1031_detect(struct i2c_ada
+
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -891,7 +892,7 @@ static struct adm1031_data *adm1031_upda
+ struct adm1031_data *data = i2c_get_clientdata(client);
+ int chan;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -965,7 +966,7 @@ static struct adm1031_data *adm1031_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/adm9240.c
++++ gregkh-2.6/drivers/hwmon/adm9240.c
+@@ -49,6 +49,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
+@@ -150,7 +151,7 @@ struct adm9240_data {
+ enum chips type;
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid;
+ unsigned long last_updated_measure;
+ unsigned long last_updated_config;
+@@ -195,11 +196,11 @@ static ssize_t set_max(struct device *de
+ struct adm9240_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[attr->index] = TEMP_TO_REG(val);
+ i2c_smbus_write_byte_data(client, ADM9240_REG_TEMP_MAX(attr->index),
+ data->temp_max[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -246,11 +247,11 @@ static ssize_t set_in_min(struct device
+ struct adm9240_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[attr->index] = IN_TO_REG(val, attr->index);
+ i2c_smbus_write_byte_data(client, ADM9240_REG_IN_MIN(attr->index),
+ data->in_min[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -263,11 +264,11 @@ static ssize_t set_in_max(struct device
+ struct adm9240_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[attr->index] = IN_TO_REG(val, attr->index);
+ i2c_smbus_write_byte_data(client, ADM9240_REG_IN_MAX(attr->index),
+ data->in_max[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -350,7 +351,7 @@ static ssize_t set_fan_min(struct device
+ int nr = attr->index;
+ u8 new_div;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (!val) {
+ data->fan_min[nr] = 255;
+@@ -390,7 +391,7 @@ static ssize_t set_fan_min(struct device
+ i2c_smbus_write_byte_data(client, ADM9240_REG_FAN_MIN(nr),
+ data->fan_min[nr]);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -439,10 +440,10 @@ static ssize_t set_aout(struct device *d
+ struct adm9240_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->aout = AOUT_TO_REG(val);
+ i2c_smbus_write_byte_data(client, ADM9240_REG_ANALOG_OUT, data->aout);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
+@@ -539,7 +540,7 @@ static int adm9240_detect(struct i2c_ada
+ /* fill in the remaining client fields and attach */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->type = kind;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ if ((err = i2c_attach_client(new_client)))
+ goto exit_free;
+@@ -691,7 +692,7 @@ static struct adm9240_data *adm9240_upda
+ struct adm9240_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ /* minimum measurement cycle: 1.75 seconds */
+ if (time_after(jiffies, data->last_updated_measure + (HZ * 7 / 4))
+@@ -771,7 +772,7 @@ static struct adm9240_data *adm9240_upda
+ data->last_updated_config = jiffies;
+ data->valid = 1;
+ }
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return data;
+ }
+
+--- gregkh-2.6.orig/drivers/hwmon/asb100.c
++++ gregkh-2.6/drivers/hwmon/asb100.c
+@@ -44,6 +44,7 @@
+ #include <linux/err.h>
+ #include <linux/init.h>
+ #include <linux/jiffies.h>
++#include <linux/mutex.h>
+ #include "lm75.h"
+
+ /*
+@@ -182,10 +183,10 @@ static u8 DIV_TO_REG(long val)
+ struct asb100_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ unsigned long last_updated; /* In jiffies */
+
+ /* array of 2 pointers to subclients */
+@@ -245,11 +246,11 @@ static ssize_t set_in_##reg(struct devic
+ struct asb100_data *data = i2c_get_clientdata(client); \
+ unsigned long val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->in_##reg[nr] = IN_TO_REG(val); \
+ asb100_write_value(client, ASB100_REG_IN_##REG(nr), \
+ data->in_##reg[nr]); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+
+@@ -331,10 +332,10 @@ static ssize_t set_fan_min(struct device
+ struct asb100_data *data = i2c_get_clientdata(client);
+ u32 val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
+ asb100_write_value(client, ASB100_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -351,7 +352,7 @@ static ssize_t set_fan_div(struct device
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+ int reg;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ min = FAN_FROM_REG(data->fan_min[nr],
+ DIV_FROM_REG(data->fan_div[nr]));
+@@ -381,7 +382,7 @@ static ssize_t set_fan_div(struct device
+ FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
+ asb100_write_value(client, ASB100_REG_FAN_MIN(nr), data->fan_min[nr]);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -461,7 +462,7 @@ static ssize_t set_##reg(struct device *
+ struct asb100_data *data = i2c_get_clientdata(client); \
+ unsigned long val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ switch (nr) { \
+ case 1: case 2: \
+ data->reg[nr] = LM75_TEMP_TO_REG(val); \
+@@ -472,7 +473,7 @@ static ssize_t set_##reg(struct device *
+ } \
+ asb100_write_value(client, ASB100_REG_TEMP_##REG(nr+1), \
+ data->reg[nr]); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+
+@@ -574,11 +575,11 @@ static ssize_t set_pwm1(struct device *d
+ struct asb100_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm &= 0x80; /* keep the enable bit */
+ data->pwm |= (0x0f & ASB100_PWM_TO_REG(val));
+ asb100_write_value(client, ASB100_REG_PWM1, data->pwm);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -595,11 +596,11 @@ static ssize_t set_pwm_enable1(struct de
+ struct asb100_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm &= 0x0f; /* keep the duty cycle bits */
+ data->pwm |= (val ? 0x80 : 0x00);
+ asb100_write_value(client, ASB100_REG_PWM1, data->pwm);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -729,7 +730,7 @@ static int asb100_detect(struct i2c_adap
+ }
+
+ new_client = &data->client;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+ new_client->adapter = adapter;
+@@ -789,7 +790,7 @@ static int asb100_detect(struct i2c_adap
+ data->type = kind;
+
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -885,7 +886,7 @@ static int asb100_read_value(struct i2c_
+ struct i2c_client *cl;
+ int res, bank;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+
+ bank = (reg >> 8) & 0x0f;
+ if (bank > 2)
+@@ -919,7 +920,7 @@ static int asb100_read_value(struct i2c_
+ if (bank > 2)
+ i2c_smbus_write_byte_data(client, ASB100_REG_BANK, 0);
+
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+
+ return res;
+ }
+@@ -930,7 +931,7 @@ static void asb100_write_value(struct i2
+ struct i2c_client *cl;
+ int bank;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+
+ bank = (reg >> 8) & 0x0f;
+ if (bank > 2)
+@@ -960,7 +961,7 @@ static void asb100_write_value(struct i2
+ if (bank > 2)
+ i2c_smbus_write_byte_data(client, ASB100_REG_BANK, 0);
+
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ }
+
+ static void asb100_init_client(struct i2c_client *client)
+@@ -984,7 +985,7 @@ static struct asb100_data *asb100_update
+ struct asb100_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -1042,7 +1043,7 @@ static struct asb100_data *asb100_update
+ dev_dbg(&client->dev, "... device update complete\n");
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/atxp1.c
++++ gregkh-2.6/drivers/hwmon/atxp1.c
+@@ -26,6 +26,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ MODULE_LICENSE("GPL");
+ MODULE_DESCRIPTION("System voltages control via Attansic ATXP1");
+@@ -60,7 +61,7 @@ static struct i2c_driver atxp1_driver =
+ struct atxp1_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ unsigned long last_updated;
+ u8 valid;
+ struct {
+@@ -80,7 +81,7 @@ static struct atxp1_data * atxp1_update_
+ client = to_i2c_client(dev);
+ data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
+
+@@ -93,7 +94,7 @@ static struct atxp1_data * atxp1_update_
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return(data);
+ }
+@@ -309,7 +310,7 @@ static int atxp1_detect(struct i2c_adapt
+
+ data->valid = 0;
+
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ err = i2c_attach_client(new_client);
+
+--- gregkh-2.6.orig/drivers/hwmon/ds1621.c
++++ gregkh-2.6/drivers/hwmon/ds1621.c
+@@ -28,6 +28,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include "lm75.h"
+
+ /* Addresses to scan */
+@@ -72,7 +73,7 @@ MODULE_PARM_DESC(polarity, "Output's pol
+ struct ds1621_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -156,10 +157,10 @@ static ssize_t set_temp_##suffix(struct
+ struct ds1621_data *data = ds1621_update_client(dev); \
+ u16 val = LM75_TEMP_TO_REG(simple_strtoul(buf, NULL, 10)); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->value = val; \
+ ds1621_write_value(client, reg, data->value); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+
+@@ -242,7 +243,7 @@ static int ds1621_detect(struct i2c_adap
+ /* Fill in remaining client fields and put it into the global list */
+ strlcpy(new_client->name, "ds1621", I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -297,7 +298,7 @@ static struct ds1621_data *ds1621_update
+ struct ds1621_data *data = i2c_get_clientdata(client);
+ u8 new_conf;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -327,7 +328,7 @@ static struct ds1621_data *ds1621_update
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/fscher.c
++++ gregkh-2.6/drivers/hwmon/fscher.c
+@@ -33,6 +33,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /*
+ * Addresses to scan
+@@ -133,7 +134,7 @@ static struct i2c_driver fscher_driver =
+ struct fscher_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+@@ -332,7 +333,7 @@ static int fscher_detect(struct i2c_adap
+ * global list */
+ strlcpy(new_client->name, "fscher", I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -417,7 +418,7 @@ static struct fscher_data *fscher_update
+ struct i2c_client *client = to_i2c_client(dev);
+ struct fscher_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
+
+@@ -457,7 +458,7 @@ static struct fscher_data *fscher_update
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+@@ -472,10 +473,10 @@ static ssize_t set_fan_status(struct i2c
+ /* bits 0..1, 3..7 reserved => mask with 0x04 */
+ unsigned long v = simple_strtoul(buf, NULL, 10) & 0x04;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_status[FAN_INDEX_FROM_NUM(nr)] &= ~v;
+ fscher_write_value(client, reg, v);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -490,10 +491,10 @@ static ssize_t set_pwm(struct i2c_client
+ {
+ unsigned long v = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[FAN_INDEX_FROM_NUM(nr)] = v > 0xff ? 0xff : v;
+ fscher_write_value(client, reg, data->fan_min[FAN_INDEX_FROM_NUM(nr)]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -518,14 +519,14 @@ static ssize_t set_fan_div(struct i2c_cl
+ return -EINVAL;
+ }
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ /* bits 2..7 reserved => mask with 0x03 */
+ data->fan_ripple[FAN_INDEX_FROM_NUM(nr)] &= ~0x03;
+ data->fan_ripple[FAN_INDEX_FROM_NUM(nr)] |= v;
+
+ fscher_write_value(client, reg, data->fan_ripple[FAN_INDEX_FROM_NUM(nr)]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -552,10 +553,10 @@ static ssize_t set_temp_status(struct i2
+ /* bits 2..7 reserved, 0 read only => mask with 0x02 */
+ unsigned long v = simple_strtoul(buf, NULL, 10) & 0x02;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_status[TEMP_INDEX_FROM_NUM(nr)] &= ~v;
+ fscher_write_value(client, reg, v);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -609,10 +610,10 @@ static ssize_t set_control(struct i2c_cl
+ /* bits 1..7 reserved => mask with 0x01 */
+ unsigned long v = simple_strtoul(buf, NULL, 10) & 0x01;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->global_control &= ~v;
+ fscher_write_value(client, reg, v);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -631,11 +632,11 @@ static ssize_t set_watchdog_control(stru
+ /* bits 0..3 reserved => mask with 0xf0 */
+ unsigned long v = simple_strtoul(buf, NULL, 10) & 0xf0;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->watchdog[2] &= ~0xf0;
+ data->watchdog[2] |= v;
+ fscher_write_value(client, reg, data->watchdog[2]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -651,10 +652,10 @@ static ssize_t set_watchdog_status(struc
+ /* bits 0, 2..7 reserved => mask with 0x02 */
+ unsigned long v = simple_strtoul(buf, NULL, 10) & 0x02;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->watchdog[1] &= ~v;
+ fscher_write_value(client, reg, v);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -669,10 +670,10 @@ static ssize_t set_watchdog_preset(struc
+ {
+ unsigned long v = simple_strtoul(buf, NULL, 10) & 0xff;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->watchdog[0] = v;
+ fscher_write_value(client, reg, data->watchdog[0]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+--- gregkh-2.6.orig/drivers/hwmon/fscpos.c
++++ gregkh-2.6/drivers/hwmon/fscpos.c
+@@ -37,6 +37,7 @@
+ #include <linux/init.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /*
+ * Addresses to scan
+@@ -114,7 +115,7 @@ static struct i2c_driver fscpos_driver =
+ struct fscpos_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* 0 until following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -208,13 +209,13 @@ static ssize_t set_fan_ripple(struct i2c
+ return -EINVAL;
+ }
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ /* bits 2..7 reserved => mask with 0x03 */
+ data->fan_ripple[nr - 1] &= ~0x03;
+ data->fan_ripple[nr - 1] |= v;
+
+ fscpos_write_value(client, reg, data->fan_ripple[nr - 1]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -232,10 +233,10 @@ static ssize_t set_pwm(struct i2c_client
+ if (v < 0) v = 0;
+ if (v > 255) v = 255;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm[nr - 1] = v;
+ fscpos_write_value(client, reg, data->pwm[nr - 1]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -278,11 +279,11 @@ static ssize_t set_wdog_control(struct i
+ /* bits 0..3 reserved => mask with 0xf0 */
+ unsigned long v = simple_strtoul(buf, NULL, 10) & 0xf0;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->wdog_control &= ~0xf0;
+ data->wdog_control |= v;
+ fscpos_write_value(client, reg, data->wdog_control);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -304,10 +305,10 @@ static ssize_t set_wdog_state(struct i2c
+ return -EINVAL;
+ }
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->wdog_state &= ~v;
+ fscpos_write_value(client, reg, v);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -321,10 +322,10 @@ static ssize_t set_wdog_preset(struct i2
+ {
+ unsigned long v = simple_strtoul(buf, NULL, 10) & 0xff;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->wdog_preset = v;
+ fscpos_write_value(client, reg, data->wdog_preset);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -483,7 +484,7 @@ static int fscpos_detect(struct i2c_adap
+ strlcpy(new_client->name, "fscpos", I2C_NAME_SIZE);
+
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -579,7 +580,7 @@ static struct fscpos_data *fscpos_update
+ struct i2c_client *client = to_i2c_client(dev);
+ struct fscpos_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
+ int i;
+@@ -625,7 +626,7 @@ static struct fscpos_data *fscpos_update
+ data->last_updated = jiffies;
+ data->valid = 1;
+ }
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return data;
+ }
+
+--- gregkh-2.6.orig/drivers/hwmon/gl518sm.c
++++ gregkh-2.6/drivers/hwmon/gl518sm.c
+@@ -43,6 +43,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
+@@ -120,7 +121,7 @@ struct gl518_data {
+ struct class_device *class_dev;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -212,10 +213,10 @@ static ssize_t set_##suffix(struct devic
+ struct gl518_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->value = type##_TO_REG(val); \
+ gl518_write_value(client, reg, data->value); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+
+@@ -228,12 +229,12 @@ static ssize_t set_##suffix(struct devic
+ int regvalue; \
+ unsigned long val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ regvalue = gl518_read_value(client, reg); \
+ data->value = type##_TO_REG(val); \
+ regvalue = (regvalue & ~mask) | (data->value << shift); \
+ gl518_write_value(client, reg, regvalue); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+
+@@ -265,7 +266,7 @@ static ssize_t set_fan_min1(struct devic
+ int regvalue;
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ regvalue = gl518_read_value(client, GL518_REG_FAN_LIMIT);
+ data->fan_min[0] = FAN_TO_REG(val,
+ DIV_FROM_REG(data->fan_div[0]));
+@@ -280,7 +281,7 @@ static ssize_t set_fan_min1(struct devic
+ data->beep_mask &= data->alarm_mask;
+ gl518_write_value(client, GL518_REG_ALARM, data->beep_mask);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -291,7 +292,7 @@ static ssize_t set_fan_min2(struct devic
+ int regvalue;
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ regvalue = gl518_read_value(client, GL518_REG_FAN_LIMIT);
+ data->fan_min[1] = FAN_TO_REG(val,
+ DIV_FROM_REG(data->fan_div[1]));
+@@ -306,7 +307,7 @@ static ssize_t set_fan_min2(struct devic
+ data->beep_mask &= data->alarm_mask;
+ gl518_write_value(client, GL518_REG_ALARM, data->beep_mask);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -407,7 +408,7 @@ static int gl518_detect(struct i2c_adapt
+ strlcpy(new_client->name, "gl518sm", I2C_NAME_SIZE);
+ data->type = kind;
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -525,7 +526,7 @@ static struct gl518_data *gl518_update_d
+ struct gl518_data *data = i2c_get_clientdata(client);
+ int val;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -586,7 +587,7 @@ static struct gl518_data *gl518_update_d
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/gl520sm.c
++++ gregkh-2.6/drivers/hwmon/gl520sm.c
+@@ -29,6 +29,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Type of the extra sensor */
+ static unsigned short extra_sensor_type;
+@@ -121,7 +122,7 @@ static struct i2c_driver gl520_driver =
+ struct gl520_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until the following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+@@ -303,7 +304,7 @@ static ssize_t set_in_min(struct i2c_cli
+ long v = simple_strtol(buf, NULL, 10);
+ u8 r;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (n == 0)
+ r = VDD_TO_REG(v);
+@@ -317,7 +318,7 @@ static ssize_t set_in_min(struct i2c_cli
+ else
+ gl520_write_value(client, reg, r);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -331,7 +332,7 @@ static ssize_t set_in_max(struct i2c_cli
+ else
+ r = IN_TO_REG(v);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ data->in_max[n] = r;
+
+@@ -340,7 +341,7 @@ static ssize_t set_in_max(struct i2c_cli
+ else
+ gl520_write_value(client, reg, r);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -373,7 +374,7 @@ static ssize_t set_fan_min(struct i2c_cl
+ unsigned long v = simple_strtoul(buf, NULL, 10);
+ u8 r;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ r = FAN_TO_REG(v, data->fan_div[n - 1]);
+ data->fan_min[n - 1] = r;
+
+@@ -390,7 +391,7 @@ static ssize_t set_fan_min(struct i2c_cl
+ data->beep_mask &= data->alarm_mask;
+ gl520_write_value(client, GL520_REG_BEEP_MASK, data->beep_mask);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -409,7 +410,7 @@ static ssize_t set_fan_div(struct i2c_cl
+ return -EINVAL;
+ }
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_div[n - 1] = r;
+
+ if (n == 1)
+@@ -417,7 +418,7 @@ static ssize_t set_fan_div(struct i2c_cl
+ else
+ gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x30) | (r << 4));
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -425,10 +426,10 @@ static ssize_t set_fan_off(struct i2c_cl
+ {
+ u8 r = simple_strtoul(buf, NULL, 10)?1:0;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_off = r;
+ gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x0c) | (r << 2));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -454,10 +455,10 @@ static ssize_t set_temp_max(struct i2c_c
+ {
+ long v = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[n - 1] = TEMP_TO_REG(v);;
+ gl520_write_value(client, reg, data->temp_max[n - 1]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -465,10 +466,10 @@ static ssize_t set_temp_max_hyst(struct
+ {
+ long v = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max_hyst[n - 1] = TEMP_TO_REG(v);
+ gl520_write_value(client, reg, data->temp_max_hyst[n - 1]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -491,10 +492,10 @@ static ssize_t set_beep_enable(struct i2
+ {
+ u8 r = simple_strtoul(buf, NULL, 10)?0:1;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->beep_enable = !r;
+ gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x04) | (r << 2));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -502,11 +503,11 @@ static ssize_t set_beep_mask(struct i2c_
+ {
+ u8 r = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ r &= data->alarm_mask;
+ data->beep_mask = r;
+ gl520_write_value(client, reg, r);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -561,7 +562,7 @@ static int gl520_detect(struct i2c_adapt
+ /* Fill in the remaining client fields */
+ strlcpy(new_client->name, "gl520sm", I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -685,7 +686,7 @@ static struct gl520_data *gl520_update_d
+ struct gl520_data *data = i2c_get_clientdata(client);
+ int val;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
+
+@@ -750,7 +751,7 @@ static struct gl520_data *gl520_update_d
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/hdaps.c
++++ gregkh-2.6/drivers/hwmon/hdaps.c
+@@ -33,6 +33,7 @@
+ #include <linux/module.h>
+ #include <linux/timer.h>
+ #include <linux/dmi.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+ #define HDAPS_LOW_PORT 0x1600 /* first port used by hdaps */
+@@ -70,10 +71,10 @@ static u8 km_activity;
+ static int rest_x;
+ static int rest_y;
+
+-static DECLARE_MUTEX(hdaps_sem);
++static DEFINE_MUTEX(hdaps_mutex);
+
+ /*
+- * __get_latch - Get the value from a given port. Callers must hold hdaps_sem.
++ * __get_latch - Get the value from a given port. Callers must hold hdaps_mutex.
+ */
+ static inline u8 __get_latch(u16 port)
+ {
+@@ -82,7 +83,7 @@ static inline u8 __get_latch(u16 port)
+
+ /*
+ * __check_latch - Check a port latch for a given value. Returns zero if the
+- * port contains the given value. Callers must hold hdaps_sem.
++ * port contains the given value. Callers must hold hdaps_mutex.
+ */
+ static inline int __check_latch(u16 port, u8 val)
+ {
+@@ -93,7 +94,7 @@ static inline int __check_latch(u16 port
+
+ /*
+ * __wait_latch - Wait up to 100us for a port latch to get a certain value,
+- * returning zero if the value is obtained. Callers must hold hdaps_sem.
++ * returning zero if the value is obtained. Callers must hold hdaps_mutex.
+ */
+ static int __wait_latch(u16 port, u8 val)
+ {
+@@ -110,7 +111,7 @@ static int __wait_latch(u16 port, u8 val
+
+ /*
+ * __device_refresh - request a refresh from the accelerometer. Does not wait
+- * for refresh to complete. Callers must hold hdaps_sem.
++ * for refresh to complete. Callers must hold hdaps_mutex.
+ */
+ static void __device_refresh(void)
+ {
+@@ -124,7 +125,7 @@ static void __device_refresh(void)
+ /*
+ * __device_refresh_sync - request a synchronous refresh from the
+ * accelerometer. We wait for the refresh to complete. Returns zero if
+- * successful and nonzero on error. Callers must hold hdaps_sem.
++ * successful and nonzero on error. Callers must hold hdaps_mutex.
+ */
+ static int __device_refresh_sync(void)
+ {
+@@ -134,7 +135,7 @@ static int __device_refresh_sync(void)
+
+ /*
+ * __device_complete - indicate to the accelerometer that we are done reading
+- * data, and then initiate an async refresh. Callers must hold hdaps_sem.
++ * data, and then initiate an async refresh. Callers must hold hdaps_mutex.
+ */
+ static inline void __device_complete(void)
+ {
+@@ -152,7 +153,7 @@ static int hdaps_readb_one(unsigned int
+ {
+ int ret;
+
+- down(&hdaps_sem);
++ mutex_lock(&hdaps_mutex);
+
+ /* do a sync refresh -- we need to be sure that we read fresh data */
+ ret = __device_refresh_sync();
+@@ -163,7 +164,7 @@ static int hdaps_readb_one(unsigned int
+ __device_complete();
+
+ out:
+- up(&hdaps_sem);
++ mutex_unlock(&hdaps_mutex);
+ return ret;
+ }
+
+@@ -198,9 +199,9 @@ static int hdaps_read_pair(unsigned int
+ {
+ int ret;
+
+- down(&hdaps_sem);
++ mutex_lock(&hdaps_mutex);
+ ret = __hdaps_read_pair(port1, port2, val1, val2);
+- up(&hdaps_sem);
++ mutex_unlock(&hdaps_mutex);
+
+ return ret;
+ }
+@@ -213,7 +214,7 @@ static int hdaps_device_init(void)
+ {
+ int total, ret = -ENXIO;
+
+- down(&hdaps_sem);
++ mutex_lock(&hdaps_mutex);
+
+ outb(0x13, 0x1610);
+ outb(0x01, 0x161f);
+@@ -279,7 +280,7 @@ static int hdaps_device_init(void)
+ }
+
+ out:
+- up(&hdaps_sem);
++ mutex_unlock(&hdaps_mutex);
+ return ret;
+ }
+
+@@ -313,7 +314,7 @@ static struct platform_driver hdaps_driv
+ };
+
+ /*
+- * hdaps_calibrate - Set our "resting" values. Callers must hold hdaps_sem.
++ * hdaps_calibrate - Set our "resting" values. Callers must hold hdaps_mutex.
+ */
+ static void hdaps_calibrate(void)
+ {
+@@ -325,7 +326,7 @@ static void hdaps_mousedev_poll(unsigned
+ int x, y;
+
+ /* Cannot sleep. Try nonblockingly. If we fail, try again later. */
+- if (down_trylock(&hdaps_sem)) {
++ if (!mutex_trylock(&hdaps_mutex)) {
+ mod_timer(&hdaps_timer,jiffies + HDAPS_POLL_PERIOD);
+ return;
+ }
+@@ -340,7 +341,7 @@ static void hdaps_mousedev_poll(unsigned
+ mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD);
+
+ out:
+- up(&hdaps_sem);
++ mutex_unlock(&hdaps_mutex);
+ }
+
+
+@@ -420,9 +421,9 @@ static ssize_t hdaps_calibrate_store(str
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+ {
+- down(&hdaps_sem);
++ mutex_lock(&hdaps_mutex);
+ hdaps_calibrate();
+- up(&hdaps_sem);
++ mutex_unlock(&hdaps_mutex);
+
+ return count;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/it87.c
++++ gregkh-2.6/drivers/hwmon/it87.c
+@@ -41,6 +41,7 @@
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+
+@@ -194,10 +195,10 @@ static int DIV_TO_REG(int val)
+ struct it87_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -290,11 +291,11 @@ static ssize_t set_in_min(struct device
+ struct it87_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[nr] = IN_TO_REG(val);
+ it87_write_value(client, IT87_REG_VIN_MIN(nr),
+ data->in_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
+@@ -307,11 +308,11 @@ static ssize_t set_in_max(struct device
+ struct it87_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[nr] = IN_TO_REG(val);
+ it87_write_value(client, IT87_REG_VIN_MAX(nr),
+ data->in_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -381,10 +382,10 @@ static ssize_t set_temp_max(struct devic
+ struct it87_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_high[nr] = TEMP_TO_REG(val);
+ it87_write_value(client, IT87_REG_TEMP_HIGH(nr), data->temp_high[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
+@@ -397,10 +398,10 @@ static ssize_t set_temp_min(struct devic
+ struct it87_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_low[nr] = TEMP_TO_REG(val);
+ it87_write_value(client, IT87_REG_TEMP_LOW(nr), data->temp_low[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ #define show_temp_offset(offset) \
+@@ -440,7 +441,7 @@ static ssize_t set_sensor(struct device
+ struct it87_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ data->sensor &= ~(1 << nr);
+ data->sensor &= ~(8 << nr);
+@@ -450,11 +451,11 @@ static ssize_t set_sensor(struct device
+ else if (val == 2)
+ data->sensor |= 8 << nr;
+ else if (val != 0) {
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+ it87_write_value(client, IT87_REG_TEMP_ENABLE, data->sensor);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ #define show_sensor_offset(offset) \
+@@ -524,7 +525,7 @@ static ssize_t set_fan_min(struct device
+ int val = simple_strtol(buf, NULL, 10);
+ u8 reg = it87_read_value(client, IT87_REG_FAN_DIV);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ switch (nr) {
+ case 0: data->fan_div[nr] = reg & 0x07; break;
+ case 1: data->fan_div[nr] = (reg >> 3) & 0x07; break;
+@@ -533,7 +534,7 @@ static ssize_t set_fan_min(struct device
+
+ data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
+ it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
+@@ -548,7 +549,7 @@ static ssize_t set_fan_div(struct device
+ int i, min[3];
+ u8 old;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ old = it87_read_value(client, IT87_REG_FAN_DIV);
+
+ for (i = 0; i < 3; i++)
+@@ -576,7 +577,7 @@ static ssize_t set_fan_div(struct device
+ data->fan_min[i]=FAN_TO_REG(min[i], DIV_FROM_REG(data->fan_div[i]));
+ it87_write_value(client, IT87_REG_FAN_MIN(i), data->fan_min[i]);
+ }
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_pwm_enable(struct device *dev,
+@@ -589,7 +590,7 @@ static ssize_t set_pwm_enable(struct dev
+ struct it87_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (val == 0) {
+ int tmp;
+@@ -606,11 +607,11 @@ static ssize_t set_pwm_enable(struct dev
+ /* set saved pwm value, clear FAN_CTLX PWM mode bit */
+ it87_write_value(client, IT87_REG_PWM(nr), PWM_TO_REG(data->manual_pwm_ctl[nr]));
+ } else {
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
+@@ -626,11 +627,11 @@ static ssize_t set_pwm(struct device *de
+ if (val < 0 || val > 255)
+ return -EINVAL;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->manual_pwm_ctl[nr] = val;
+ if (data->fan_main_ctrl & (1 << nr))
+ it87_write_value(client, IT87_REG_PWM(nr), PWM_TO_REG(data->manual_pwm_ctl[nr]));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -776,7 +777,7 @@ static int it87_detect(struct i2c_adapte
+
+ new_client = &data->client;
+ if (is_isa)
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+ new_client->adapter = adapter;
+@@ -823,7 +824,7 @@ static int it87_detect(struct i2c_adapte
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->type = kind;
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -950,10 +951,10 @@ static int it87_read_value(struct i2c_cl
+
+ int res;
+ if (i2c_is_isa_client(client)) {
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb_p(reg, client->addr + IT87_ADDR_REG_OFFSET);
+ res = inb_p(client->addr + IT87_DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return res;
+ } else
+ return i2c_smbus_read_byte_data(client, reg);
+@@ -969,10 +970,10 @@ static int it87_write_value(struct i2c_c
+ struct it87_data *data = i2c_get_clientdata(client);
+
+ if (i2c_is_isa_client(client)) {
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb_p(reg, client->addr + IT87_ADDR_REG_OFFSET);
+ outb_p(value, client->addr + IT87_DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return 0;
+ } else
+ return i2c_smbus_write_byte_data(client, reg, value);
+@@ -1098,7 +1099,7 @@ static struct it87_data *it87_update_dev
+ struct it87_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -1160,7 +1161,7 @@ static struct it87_data *it87_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm63.c
++++ gregkh-2.6/drivers/hwmon/lm63.c
+@@ -45,6 +45,7 @@
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /*
+ * Addresses to scan
+@@ -153,7 +154,7 @@ static struct i2c_driver lm63_driver = {
+ struct lm63_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+@@ -192,13 +193,13 @@ static ssize_t set_fan(struct device *de
+ struct lm63_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan[1] = FAN_TO_REG(val);
+ i2c_smbus_write_byte_data(client, LM63_REG_TACH_LIMIT_LSB,
+ data->fan[1] & 0xFF);
+ i2c_smbus_write_byte_data(client, LM63_REG_TACH_LIMIT_MSB,
+ data->fan[1] >> 8);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -222,12 +223,12 @@ static ssize_t set_pwm1(struct device *d
+ return -EPERM;
+
+ val = simple_strtoul(buf, NULL, 10);
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm1_value = val <= 0 ? 0 :
+ val >= 255 ? 2 * data->pwm1_freq :
+ (val * data->pwm1_freq * 2 + 127) / 255;
+ i2c_smbus_write_byte_data(client, LM63_REG_PWM_VALUE, data->pwm1_value);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -253,10 +254,10 @@ static ssize_t set_temp8(struct device *
+ struct lm63_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp8[1] = TEMP8_TO_REG(val);
+ i2c_smbus_write_byte_data(client, LM63_REG_LOCAL_HIGH, data->temp8[1]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -284,13 +285,13 @@ static ssize_t set_temp11(struct device
+ long val = simple_strtol(buf, NULL, 10);
+ int nr = attr->index;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp11[nr] = TEMP11_TO_REG(val);
+ i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2],
+ data->temp11[nr] >> 8);
+ i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1],
+ data->temp11[nr] & 0xff);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -314,11 +315,11 @@ static ssize_t set_temp2_crit_hyst(struc
+ long val = simple_strtol(buf, NULL, 10);
+ long hyst;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ hyst = TEMP8_FROM_REG(data->temp8[2]) - val;
+ i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST,
+ HYST_TO_REG(hyst));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -427,7 +428,7 @@ static int lm63_detect(struct i2c_adapte
+
+ strlcpy(new_client->name, "lm63", I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -530,7 +531,7 @@ static struct lm63_data *lm63_update_dev
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm63_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
+ if (data->config & 0x04) { /* tachometer enabled */
+@@ -582,7 +583,7 @@ static struct lm63_data *lm63_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm75.c
++++ gregkh-2.6/drivers/hwmon/lm75.c
+@@ -25,6 +25,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include "lm75.h"
+
+
+@@ -47,7 +48,7 @@ I2C_CLIENT_INSMOD_1(lm75);
+ struct lm75_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+ u16 temp_input; /* Register values */
+@@ -91,10 +92,10 @@ static ssize_t set_##value(struct device
+ struct lm75_data *data = i2c_get_clientdata(client); \
+ int temp = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->value = LM75_TEMP_TO_REG(temp); \
+ lm75_write_value(client, reg, data->value); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ set(temp_max, LM75_REG_TEMP_OS);
+@@ -188,7 +189,7 @@ static int lm75_detect(struct i2c_adapte
+ /* Fill in the remaining client fields and put it into the global list */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -264,7 +265,7 @@ static struct lm75_data *lm75_update_dev
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm75_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -277,7 +278,7 @@ static struct lm75_data *lm75_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm77.c
++++ gregkh-2.6/drivers/hwmon/lm77.c
+@@ -32,6 +32,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, I2C_CLIENT_END };
+@@ -51,7 +52,7 @@ I2C_CLIENT_INSMOD_1(lm77);
+ struct lm77_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid;
+ unsigned long last_updated; /* In jiffies */
+ int temp_input; /* Temperatures */
+@@ -139,10 +140,10 @@ static ssize_t set_##value(struct device
+ struct lm77_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->value = val; \
+ lm77_write_value(client, reg, LM77_TEMP_TO_REG(data->value)); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+
+@@ -157,11 +158,11 @@ static ssize_t set_temp_crit_hyst(struct
+ struct lm77_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_hyst = data->temp_crit - val;
+ lm77_write_value(client, LM77_REG_TEMP_HYST,
+ LM77_TEMP_TO_REG(data->temp_hyst));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -173,7 +174,7 @@ static ssize_t set_temp_crit(struct devi
+ long val = simple_strtoul(buf, NULL, 10);
+ int oldcrithyst;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ oldcrithyst = data->temp_crit - data->temp_hyst;
+ data->temp_crit = val;
+ data->temp_hyst = data->temp_crit - oldcrithyst;
+@@ -181,7 +182,7 @@ static ssize_t set_temp_crit(struct devi
+ LM77_TEMP_TO_REG(data->temp_crit));
+ lm77_write_value(client, LM77_REG_TEMP_HYST,
+ LM77_TEMP_TO_REG(data->temp_hyst));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -306,7 +307,7 @@ static int lm77_detect(struct i2c_adapte
+ /* Fill in the remaining client fields and put it into the global list */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -380,7 +381,7 @@ static struct lm77_data *lm77_update_dev
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm77_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -406,7 +407,7 @@ static struct lm77_data *lm77_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm78.c
++++ gregkh-2.6/drivers/hwmon/lm78.c
+@@ -27,6 +27,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+ /* Addresses to scan */
+@@ -131,10 +132,10 @@ static inline int TEMP_FROM_REG(s8 val)
+ struct lm78_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -207,10 +208,10 @@ static ssize_t set_in_min(struct device
+ struct lm78_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[nr] = IN_TO_REG(val);
+ lm78_write_value(client, LM78_REG_IN_MIN(nr), data->in_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -221,10 +222,10 @@ static ssize_t set_in_max(struct device
+ struct lm78_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[nr] = IN_TO_REG(val);
+ lm78_write_value(client, LM78_REG_IN_MAX(nr), data->in_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -288,10 +289,10 @@ static ssize_t set_temp_over(struct devi
+ struct lm78_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_over = TEMP_TO_REG(val);
+ lm78_write_value(client, LM78_REG_TEMP_OVER, data->temp_over);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -307,10 +308,10 @@ static ssize_t set_temp_hyst(struct devi
+ struct lm78_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_hyst = TEMP_TO_REG(val);
+ lm78_write_value(client, LM78_REG_TEMP_HYST, data->temp_hyst);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -342,10 +343,10 @@ static ssize_t set_fan_min(struct device
+ struct lm78_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
+ lm78_write_value(client, LM78_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -368,7 +369,7 @@ static ssize_t set_fan_div(struct device
+ unsigned long min;
+ u8 reg;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ min = FAN_FROM_REG(data->fan_min[nr],
+ DIV_FROM_REG(data->fan_div[nr]));
+
+@@ -380,7 +381,7 @@ static ssize_t set_fan_div(struct device
+ default:
+ dev_err(&client->dev, "fan_div value %ld not "
+ "supported. Choose one of 1, 2, 4 or 8!\n", val);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+@@ -398,7 +399,7 @@ static ssize_t set_fan_div(struct device
+ data->fan_min[nr] =
+ FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
+ lm78_write_value(client, LM78_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -548,7 +549,7 @@ static int lm78_detect(struct i2c_adapte
+
+ new_client = &data->client;
+ if (is_isa)
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+ new_client->adapter = adapter;
+@@ -598,7 +599,7 @@ static int lm78_detect(struct i2c_adapte
+ data->type = kind;
+
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -697,10 +698,10 @@ static int lm78_read_value(struct i2c_cl
+ int res;
+ if (i2c_is_isa_client(client)) {
+ struct lm78_data *data = i2c_get_clientdata(client);
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb_p(reg, client->addr + LM78_ADDR_REG_OFFSET);
+ res = inb_p(client->addr + LM78_DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return res;
+ } else
+ return i2c_smbus_read_byte_data(client, reg);
+@@ -717,10 +718,10 @@ static int lm78_write_value(struct i2c_c
+ {
+ if (i2c_is_isa_client(client)) {
+ struct lm78_data *data = i2c_get_clientdata(client);
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb_p(reg, client->addr + LM78_ADDR_REG_OFFSET);
+ outb_p(value, client->addr + LM78_DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return 0;
+ } else
+ return i2c_smbus_write_byte_data(client, reg, value);
+@@ -742,7 +743,7 @@ static struct lm78_data *lm78_update_dev
+ struct lm78_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -786,7 +787,7 @@ static struct lm78_data *lm78_update_dev
+ data->fan_div[2] = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm80.c
++++ gregkh-2.6/drivers/hwmon/lm80.c
+@@ -28,6 +28,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c,
+@@ -108,7 +109,7 @@ static inline long TEMP_FROM_REG(u16 tem
+ struct lm80_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -191,10 +192,10 @@ static ssize_t set_in_##suffix(struct de
+ struct lm80_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock);\
++ mutex_lock(&data->update_lock);\
+ data->value = IN_TO_REG(val); \
+ lm80_write_value(client, reg, data->value); \
+- up(&data->update_lock);\
++ mutex_unlock(&data->update_lock);\
+ return count; \
+ }
+ set_in(min0, in_min[0], LM80_REG_IN_MIN(0));
+@@ -241,10 +242,10 @@ static ssize_t set_fan_##suffix(struct d
+ struct lm80_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock);\
++ mutex_lock(&data->update_lock);\
+ data->value = FAN_TO_REG(val, DIV_FROM_REG(data->div)); \
+ lm80_write_value(client, reg, data->value); \
+- up(&data->update_lock);\
++ mutex_unlock(&data->update_lock);\
+ return count; \
+ }
+ set_fan(min1, fan_min[0], LM80_REG_FAN_MIN(1), fan_div[0]);
+@@ -263,7 +264,7 @@ static ssize_t set_fan_div(struct device
+ u8 reg;
+
+ /* Save fan_min */
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ min = FAN_FROM_REG(data->fan_min[nr],
+ DIV_FROM_REG(data->fan_div[nr]));
+
+@@ -275,7 +276,7 @@ static ssize_t set_fan_div(struct device
+ default:
+ dev_err(&client->dev, "fan_div value %ld not "
+ "supported. Choose one of 1, 2, 4 or 8!\n", val);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+@@ -286,7 +287,7 @@ static ssize_t set_fan_div(struct device
+ /* Restore fan_min */
+ data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
+ lm80_write_value(client, LM80_REG_FAN_MIN(nr + 1), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -325,10 +326,10 @@ static ssize_t set_temp_##suffix(struct
+ struct lm80_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->value = TEMP_LIMIT_TO_REG(val); \
+ lm80_write_value(client, reg, data->value); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ set_temp(hot_max, temp_hot_max, LM80_REG_TEMP_HOT_MAX);
+@@ -437,7 +438,7 @@ static int lm80_detect(struct i2c_adapte
+ /* Fill in the remaining client fields and put it into the global list */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -545,7 +546,7 @@ static struct lm80_data *lm80_update_dev
+ struct lm80_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
+ dev_dbg(&client->dev, "Starting lm80 update\n");
+@@ -585,7 +586,7 @@ static struct lm80_data *lm80_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm83.c
++++ gregkh-2.6/drivers/hwmon/lm83.c
+@@ -35,6 +35,7 @@
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /*
+ * Addresses to scan
+@@ -139,7 +140,7 @@ static struct i2c_driver lm83_driver = {
+ struct lm83_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+@@ -171,11 +172,11 @@ static ssize_t set_temp(struct device *d
+ long val = simple_strtol(buf, NULL, 10);
+ int nr = attr->index;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp[nr] = TEMP_TO_REG(val);
+ i2c_smbus_write_byte_data(client, LM83_REG_W_HIGH[nr - 4],
+ data->temp[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -300,7 +301,7 @@ static int lm83_detect(struct i2c_adapte
+ /* We can fill in the remaining client fields */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -373,7 +374,7 @@ static struct lm83_data *lm83_update_dev
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm83_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
+ int nr;
+@@ -393,7 +394,7 @@ static struct lm83_data *lm83_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm85.c
++++ gregkh-2.6/drivers/hwmon/lm85.c
+@@ -31,6 +31,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
+@@ -331,10 +332,10 @@ struct lm85_autofan {
+ struct lm85_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ int valid; /* !=0 if following fields are valid */
+ unsigned long last_reading; /* In jiffies */
+ unsigned long last_config; /* In jiffies */
+@@ -407,10 +408,10 @@ static ssize_t set_fan_min(struct device
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr] = FAN_TO_REG(val);
+ lm85_write_value(client, LM85_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -499,10 +500,10 @@ static ssize_t set_pwm(struct device *de
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm[nr] = PWM_TO_REG(val);
+ lm85_write_value(client, LM85_REG_PWM(nr), data->pwm[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_pwm_enable(struct device *dev, char *buf, int nr)
+@@ -559,10 +560,10 @@ static ssize_t set_in_min(struct device
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[nr] = INS_TO_REG(nr, val);
+ lm85_write_value(client, LM85_REG_IN_MIN(nr), data->in_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_in_max(struct device *dev, char *buf, int nr)
+@@ -577,10 +578,10 @@ static ssize_t set_in_max(struct device
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[nr] = INS_TO_REG(nr, val);
+ lm85_write_value(client, LM85_REG_IN_MAX(nr), data->in_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ #define show_in_reg(offset) \
+@@ -640,10 +641,10 @@ static ssize_t set_temp_min(struct devic
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_min[nr] = TEMP_TO_REG(val);
+ lm85_write_value(client, LM85_REG_TEMP_MIN(nr), data->temp_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_temp_max(struct device *dev, char *buf, int nr)
+@@ -658,10 +659,10 @@ static ssize_t set_temp_max(struct devic
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[nr] = TEMP_TO_REG(val);
+ lm85_write_value(client, LM85_REG_TEMP_MAX(nr), data->temp_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ #define show_temp_reg(offset) \
+@@ -713,12 +714,12 @@ static ssize_t set_pwm_auto_channels(str
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->autofan[nr].config = (data->autofan[nr].config & (~0xe0))
+ | ZONE_TO_REG(val) ;
+ lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr),
+ data->autofan[nr].config);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_pwm_auto_pwm_min(struct device *dev, char *buf, int nr)
+@@ -733,11 +734,11 @@ static ssize_t set_pwm_auto_pwm_min(stru
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->autofan[nr].min_pwm = PWM_TO_REG(val);
+ lm85_write_value(client, LM85_REG_AFAN_MINPWM(nr),
+ data->autofan[nr].min_pwm);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_pwm_auto_pwm_minctl(struct device *dev, char *buf, int nr)
+@@ -752,7 +753,7 @@ static ssize_t set_pwm_auto_pwm_minctl(s
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->autofan[nr].min_off = val;
+ lm85_write_value(client, LM85_REG_AFAN_SPIKE1, data->smooth[0]
+ | data->syncpwm3
+@@ -760,7 +761,7 @@ static ssize_t set_pwm_auto_pwm_minctl(s
+ | (data->autofan[1].min_off ? 0x40 : 0)
+ | (data->autofan[2].min_off ? 0x80 : 0)
+ );
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_pwm_auto_pwm_freq(struct device *dev, char *buf, int nr)
+@@ -775,13 +776,13 @@ static ssize_t set_pwm_auto_pwm_freq(str
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->autofan[nr].freq = FREQ_TO_REG(val);
+ lm85_write_value(client, LM85_REG_AFAN_RANGE(nr),
+ (data->zone[nr].range << 4)
+ | data->autofan[nr].freq
+ );
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ #define pwm_auto(offset) \
+@@ -857,7 +858,7 @@ static ssize_t set_temp_auto_temp_off(st
+ int min;
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ min = TEMP_FROM_REG(data->zone[nr].limit);
+ data->zone[nr].off_desired = TEMP_TO_REG(val);
+ data->zone[nr].hyst = HYST_TO_REG(min - val);
+@@ -871,7 +872,7 @@ static ssize_t set_temp_auto_temp_off(st
+ (data->zone[2].hyst << 4)
+ );
+ }
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_temp_auto_temp_min(struct device *dev, char *buf, int nr)
+@@ -886,7 +887,7 @@ static ssize_t set_temp_auto_temp_min(st
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->zone[nr].limit = TEMP_TO_REG(val);
+ lm85_write_value(client, LM85_REG_AFAN_LIMIT(nr),
+ data->zone[nr].limit);
+@@ -913,7 +914,7 @@ static ssize_t set_temp_auto_temp_min(st
+ (data->zone[2].hyst << 4)
+ );
+ }
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_temp_auto_temp_max(struct device *dev, char *buf, int nr)
+@@ -930,7 +931,7 @@ static ssize_t set_temp_auto_temp_max(st
+ int min;
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ min = TEMP_FROM_REG(data->zone[nr].limit);
+ data->zone[nr].max_desired = TEMP_TO_REG(val);
+ data->zone[nr].range = RANGE_TO_REG(
+@@ -938,7 +939,7 @@ static ssize_t set_temp_auto_temp_max(st
+ lm85_write_value(client, LM85_REG_AFAN_RANGE(nr),
+ ((data->zone[nr].range & 0x0f) << 4)
+ | (data->autofan[nr].freq & 0x07));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t show_temp_auto_temp_crit(struct device *dev, char *buf, int nr)
+@@ -953,11 +954,11 @@ static ssize_t set_temp_auto_temp_crit(s
+ struct lm85_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->zone[nr].critical = TEMP_TO_REG(val);
+ lm85_write_value(client, LM85_REG_AFAN_CRITICAL(nr),
+ data->zone[nr].critical);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ #define temp_auto(offset) \
+@@ -1149,7 +1150,7 @@ static int lm85_detect(struct i2c_adapte
+ /* Fill in the remaining client fields */
+ data->type = kind;
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -1368,7 +1369,7 @@ static struct lm85_data *lm85_update_dev
+ struct lm85_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if ( !data->valid ||
+ time_after(jiffies, data->last_reading + LM85_DATA_INTERVAL) ) {
+@@ -1571,7 +1572,7 @@ static struct lm85_data *lm85_update_dev
+
+ data->valid = 1;
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm87.c
++++ gregkh-2.6/drivers/hwmon/lm87.c
+@@ -60,6 +60,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /*
+ * Addresses to scan
+@@ -176,7 +177,7 @@ static struct i2c_driver lm87_driver = {
+ struct lm87_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -253,11 +254,11 @@ static void set_in_min(struct device *de
+ struct lm87_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[nr] = IN_TO_REG(val, data->in_scale[nr]);
+ lm87_write_value(client, nr<6 ? LM87_REG_IN_MIN(nr) :
+ LM87_REG_AIN_MIN(nr-6), data->in_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+
+ static void set_in_max(struct device *dev, const char *buf, int nr)
+@@ -266,11 +267,11 @@ static void set_in_max(struct device *de
+ struct lm87_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[nr] = IN_TO_REG(val, data->in_scale[nr]);
+ lm87_write_value(client, nr<6 ? LM87_REG_IN_MAX(nr) :
+ LM87_REG_AIN_MAX(nr-6), data->in_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+
+ #define set_in(offset) \
+@@ -327,10 +328,10 @@ static void set_temp_low(struct device *
+ struct lm87_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_low[nr] = TEMP_TO_REG(val);
+ lm87_write_value(client, LM87_REG_TEMP_LOW[nr], data->temp_low[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+
+ static void set_temp_high(struct device *dev, const char *buf, int nr)
+@@ -339,10 +340,10 @@ static void set_temp_high(struct device
+ struct lm87_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_high[nr] = TEMP_TO_REG(val);
+ lm87_write_value(client, LM87_REG_TEMP_HIGH[nr], data->temp_high[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+
+ #define set_temp(offset) \
+@@ -411,11 +412,11 @@ static void set_fan_min(struct device *d
+ struct lm87_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr] = FAN_TO_REG(val,
+ FAN_DIV_FROM_REG(data->fan_div[nr]));
+ lm87_write_value(client, LM87_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+
+ /* Note: we save and restore the fan minimum here, because its value is
+@@ -431,7 +432,7 @@ static ssize_t set_fan_div(struct device
+ unsigned long min;
+ u8 reg;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ min = FAN_FROM_REG(data->fan_min[nr],
+ FAN_DIV_FROM_REG(data->fan_div[nr]));
+
+@@ -441,7 +442,7 @@ static ssize_t set_fan_div(struct device
+ case 4: data->fan_div[nr] = 2; break;
+ case 8: data->fan_div[nr] = 3; break;
+ default:
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+@@ -459,7 +460,7 @@ static ssize_t set_fan_div(struct device
+ data->fan_min[nr] = FAN_TO_REG(min, val);
+ lm87_write_value(client, LM87_REG_FAN_MIN(nr),
+ data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -522,10 +523,10 @@ static ssize_t set_aout(struct device *d
+ struct lm87_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->aout = AOUT_TO_REG(val);
+ lm87_write_value(client, LM87_REG_AOUT, data->aout);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
+@@ -589,7 +590,7 @@ static int lm87_detect(struct i2c_adapte
+ /* We can fill in the remaining client fields */
+ strlcpy(new_client->name, "lm87", I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -744,7 +745,7 @@ static struct lm87_data *lm87_update_dev
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm87_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
+ int i, j;
+@@ -813,7 +814,7 @@ static struct lm87_data *lm87_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm90.c
++++ gregkh-2.6/drivers/hwmon/lm90.c
+@@ -78,6 +78,7 @@
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /*
+ * Addresses to scan
+@@ -201,7 +202,7 @@ static struct i2c_driver lm90_driver = {
+ struct lm90_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+ int kind;
+@@ -247,13 +248,13 @@ static ssize_t set_temp8(struct device *
+ long val = simple_strtol(buf, NULL, 10);
+ int nr = attr->index;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ if (data->kind == adt7461)
+ data->temp8[nr] = TEMP1_TO_REG_ADT7461(val);
+ else
+ data->temp8[nr] = TEMP1_TO_REG(val);
+ i2c_smbus_write_byte_data(client, reg[nr - 1], data->temp8[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -281,7 +282,7 @@ static ssize_t set_temp11(struct device
+ long val = simple_strtol(buf, NULL, 10);
+ int nr = attr->index;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ if (data->kind == adt7461)
+ data->temp11[nr] = TEMP2_TO_REG_ADT7461(val);
+ else
+@@ -290,7 +291,7 @@ static ssize_t set_temp11(struct device
+ data->temp11[nr] >> 8);
+ i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1],
+ data->temp11[nr] & 0xff);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -311,11 +312,11 @@ static ssize_t set_temphyst(struct devic
+ long val = simple_strtol(buf, NULL, 10);
+ long hyst;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ hyst = TEMP1_FROM_REG(data->temp8[3]) - val;
+ i2c_smbus_write_byte_data(client, LM90_REG_W_TCRIT_HYST,
+ HYST_TO_REG(hyst));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -558,7 +559,7 @@ static int lm90_detect(struct i2c_adapte
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+ data->kind = kind;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -646,7 +647,7 @@ static struct lm90_data *lm90_update_dev
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm90_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
+ u8 oldh, newh, l;
+@@ -692,7 +693,7 @@ static struct lm90_data *lm90_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/lm92.c
++++ gregkh-2.6/drivers/hwmon/lm92.c
+@@ -46,6 +46,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* The LM92 and MAX6635 have 2 two-state pins for address selection,
+ resulting in 4 possible addresses. */
+@@ -96,7 +97,7 @@ static struct i2c_driver lm92_driver;
+ struct lm92_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+@@ -114,7 +115,7 @@ static struct lm92_data *lm92_update_dev
+ struct i2c_client *client = to_i2c_client(dev);
+ struct lm92_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ)
+ || !data->valid) {
+@@ -134,7 +135,7 @@ static struct lm92_data *lm92_update_dev
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+@@ -158,10 +159,10 @@ static ssize_t set_##value(struct device
+ struct lm92_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->value = TEMP_TO_REG(val); \
+ i2c_smbus_write_word_data(client, reg, swab16(data->value)); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ set_temp(temp1_crit, LM92_REG_TEMP_CRIT);
+@@ -194,11 +195,11 @@ static ssize_t set_temp1_crit_hyst(struc
+ struct lm92_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp1_hyst = TEMP_FROM_REG(data->temp1_crit) - val;
+ i2c_smbus_write_word_data(client, LM92_REG_TEMP_HYST,
+ swab16(TEMP_TO_REG(data->temp1_hyst)));
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -348,7 +349,7 @@ static int lm92_detect(struct i2c_adapte
+ /* Fill in the remaining client fields */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the i2c subsystem a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+--- gregkh-2.6.orig/drivers/hwmon/max1619.c
++++ gregkh-2.6/drivers/hwmon/max1619.c
+@@ -33,6 +33,7 @@
+ #include <linux/i2c.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a,
+ 0x29, 0x2a, 0x2b,
+@@ -104,7 +105,7 @@ static struct i2c_driver max1619_driver
+ struct max1619_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+@@ -141,10 +142,10 @@ static ssize_t set_##value(struct device
+ struct max1619_data *data = i2c_get_clientdata(client); \
+ long val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->value = TEMP_TO_REG(val); \
+ i2c_smbus_write_byte_data(client, reg, data->value); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+
+@@ -262,7 +263,7 @@ static int max1619_detect(struct i2c_ada
+ /* We can fill in the remaining client fields */
+ strlcpy(new_client->name, name, I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -330,7 +331,7 @@ static struct max1619_data *max1619_upda
+ struct i2c_client *client = to_i2c_client(dev);
+ struct max1619_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
+ dev_dbg(&client->dev, "Updating max1619 data.\n");
+@@ -353,7 +354,7 @@ static struct max1619_data *max1619_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/pc87360.c
++++ gregkh-2.6/drivers/hwmon/pc87360.c
+@@ -43,6 +43,7 @@
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+ static u8 devid;
+@@ -183,8 +184,8 @@ static inline u8 PWM_TO_REG(int val, int
+ struct pc87360_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
+- struct semaphore update_lock;
++ struct mutex lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -283,7 +284,7 @@ static ssize_t set_fan_min(struct device
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long fan_min = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ fan_min = FAN_TO_REG(fan_min, FAN_DIV_FROM_REG(data->fan_status[attr->index]));
+
+ /* If it wouldn't fit, change clock divisor */
+@@ -300,7 +301,7 @@ static ssize_t set_fan_min(struct device
+ /* Write new divider, preserve alarm bits */
+ pc87360_write_value(data, LD_FAN, NO_BANK, PC87360_REG_FAN_STATUS(attr->index),
+ data->fan_status[attr->index] & 0xF9);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -343,12 +344,12 @@ static ssize_t set_pwm(struct device *de
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm[attr->index] = PWM_TO_REG(val,
+ FAN_CONFIG_INVERT(data->fan_conf, attr->index));
+ pc87360_write_value(data, LD_FAN, NO_BANK, PC87360_REG_PWM(attr->index),
+ data->pwm[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -393,11 +394,11 @@ static ssize_t set_in_min(struct device
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[attr->index] = IN_TO_REG(val, data->in_vref);
+ pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_IN_MIN,
+ data->in_min[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_in_max(struct device *dev, struct device_attribute *devattr, const char *buf,
+@@ -408,12 +409,12 @@ static ssize_t set_in_max(struct device
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[attr->index] = IN_TO_REG(val,
+ data->in_vref);
+ pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_IN_MAX,
+ data->in_max[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -512,11 +513,11 @@ static ssize_t set_therm_min(struct devi
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[attr->index] = IN_TO_REG(val, data->in_vref);
+ pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_TEMP_MIN,
+ data->in_min[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_therm_max(struct device *dev, struct device_attribute *devattr, const char *buf,
+@@ -527,11 +528,11 @@ static ssize_t set_therm_max(struct devi
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[attr->index] = IN_TO_REG(val, data->in_vref);
+ pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_TEMP_MAX,
+ data->in_max[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_therm_crit(struct device *dev, struct device_attribute *devattr, const char *buf,
+@@ -542,11 +543,11 @@ static ssize_t set_therm_crit(struct dev
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_crit[attr->index-11] = IN_TO_REG(val, data->in_vref);
+ pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_TEMP_CRIT,
+ data->in_crit[attr->index-11]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -654,11 +655,11 @@ static ssize_t set_temp_min(struct devic
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_min[attr->index] = TEMP_TO_REG(val);
+ pc87360_write_value(data, LD_TEMP, attr->index, PC87365_REG_TEMP_MIN,
+ data->temp_min[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_temp_max(struct device *dev, struct device_attribute *devattr, const char *buf,
+@@ -669,11 +670,11 @@ static ssize_t set_temp_max(struct devic
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[attr->index] = TEMP_TO_REG(val);
+ pc87360_write_value(data, LD_TEMP, attr->index, PC87365_REG_TEMP_MAX,
+ data->temp_max[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *devattr, const char *buf,
+@@ -684,11 +685,11 @@ static ssize_t set_temp_crit(struct devi
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_crit[attr->index] = TEMP_TO_REG(val);
+ pc87360_write_value(data, LD_TEMP, attr->index, PC87365_REG_TEMP_CRIT,
+ data->temp_crit[attr->index]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -845,7 +846,7 @@ static int pc87360_detect(struct i2c_ada
+ dev = &client->dev;
+ i2c_set_clientdata(client, data);
+ client->addr = address;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ client->adapter = adapter;
+ client->driver = &pc87360_driver;
+ client->flags = 0;
+@@ -878,7 +879,7 @@ static int pc87360_detect(struct i2c_ada
+
+ strlcpy(client->name, name, sizeof(client->name));
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ for (i = 0; i < 3; i++) {
+ if (((data->address[i] = extra_isa[i]))
+@@ -1027,11 +1028,11 @@ static int pc87360_read_value(struct pc8
+ {
+ int res;
+
+- down(&(data->lock));
++ mutex_lock(&(data->lock));
+ if (bank != NO_BANK)
+ outb_p(bank, data->address[ldi] + PC87365_REG_BANK);
+ res = inb_p(data->address[ldi] + reg);
+- up(&(data->lock));
++ mutex_unlock(&(data->lock));
+
+ return res;
+ }
+@@ -1039,11 +1040,11 @@ static int pc87360_read_value(struct pc8
+ static void pc87360_write_value(struct pc87360_data *data, u8 ldi, u8 bank,
+ u8 reg, u8 value)
+ {
+- down(&(data->lock));
++ mutex_lock(&(data->lock));
+ if (bank != NO_BANK)
+ outb_p(bank, data->address[ldi] + PC87365_REG_BANK);
+ outb_p(value, data->address[ldi] + reg);
+- up(&(data->lock));
++ mutex_unlock(&(data->lock));
+ }
+
+ static void pc87360_init_client(struct i2c_client *client, int use_thermistors)
+@@ -1215,7 +1216,7 @@ static struct pc87360_data *pc87360_upda
+ struct pc87360_data *data = i2c_get_clientdata(client);
+ u8 i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
+ dev_dbg(&client->dev, "Data update\n");
+@@ -1315,7 +1316,7 @@ static struct pc87360_data *pc87360_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/sis5595.c
++++ gregkh-2.6/drivers/hwmon/sis5595.c
+@@ -60,6 +60,7 @@
+ #include <linux/err.h>
+ #include <linux/init.h>
+ #include <linux/jiffies.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+
+@@ -167,9 +168,9 @@ static inline u8 DIV_TO_REG(int val)
+ struct sis5595_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+ char maxins; /* == 3 if temp enabled, otherwise == 4 */
+@@ -231,10 +232,10 @@ static ssize_t set_in_min(struct device
+ struct sis5595_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[nr] = IN_TO_REG(val);
+ sis5595_write_value(client, SIS5595_REG_IN_MIN(nr), data->in_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -245,10 +246,10 @@ static ssize_t set_in_max(struct device
+ struct sis5595_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[nr] = IN_TO_REG(val);
+ sis5595_write_value(client, SIS5595_REG_IN_MAX(nr), data->in_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -310,10 +311,10 @@ static ssize_t set_temp_over(struct devi
+ struct sis5595_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_over = TEMP_TO_REG(val);
+ sis5595_write_value(client, SIS5595_REG_TEMP_OVER, data->temp_over);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -329,10 +330,10 @@ static ssize_t set_temp_hyst(struct devi
+ struct sis5595_data *data = i2c_get_clientdata(client);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_hyst = TEMP_TO_REG(val);
+ sis5595_write_value(client, SIS5595_REG_TEMP_HYST, data->temp_hyst);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -364,10 +365,10 @@ static ssize_t set_fan_min(struct device
+ struct sis5595_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
+ sis5595_write_value(client, SIS5595_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -390,7 +391,7 @@ static ssize_t set_fan_div(struct device
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+ int reg;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ min = FAN_FROM_REG(data->fan_min[nr],
+ DIV_FROM_REG(data->fan_div[nr]));
+ reg = sis5595_read_value(client, SIS5595_REG_FANDIV);
+@@ -403,7 +404,7 @@ static ssize_t set_fan_div(struct device
+ default:
+ dev_err(&client->dev, "fan_div value %ld not "
+ "supported. Choose one of 1, 2, 4 or 8!\n", val);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+@@ -419,7 +420,7 @@ static ssize_t set_fan_div(struct device
+ data->fan_min[nr] =
+ FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
+ sis5595_write_value(client, SIS5595_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -527,7 +528,7 @@ static int sis5595_detect(struct i2c_ada
+
+ new_client = &data->client;
+ new_client->addr = address;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ i2c_set_clientdata(new_client, data);
+ new_client->adapter = adapter;
+ new_client->driver = &sis5595_driver;
+@@ -548,7 +549,7 @@ static int sis5595_detect(struct i2c_ada
+ strlcpy(new_client->name, "sis5595", I2C_NAME_SIZE);
+
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -635,20 +636,20 @@ static int sis5595_read_value(struct i2c
+ int res;
+
+ struct sis5595_data *data = i2c_get_clientdata(client);
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb_p(reg, client->addr + SIS5595_ADDR_REG_OFFSET);
+ res = inb_p(client->addr + SIS5595_DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return res;
+ }
+
+ static int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
+ {
+ struct sis5595_data *data = i2c_get_clientdata(client);
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb_p(reg, client->addr + SIS5595_ADDR_REG_OFFSET);
+ outb_p(value, client->addr + SIS5595_DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return 0;
+ }
+
+@@ -667,7 +668,7 @@ static struct sis5595_data *sis5595_upda
+ struct sis5595_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -707,7 +708,7 @@ static struct sis5595_data *sis5595_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/smsc47b397.c
++++ gregkh-2.6/drivers/hwmon/smsc47b397.c
+@@ -35,6 +35,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
+ #include <linux/init.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+ /* Address is autodetected, there is no default value */
+@@ -92,9 +93,9 @@ static u8 smsc47b397_reg_temp[] = {0x25,
+ struct smsc47b397_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ unsigned long last_updated; /* in jiffies */
+ int valid;
+
+@@ -108,10 +109,10 @@ static int smsc47b397_read_value(struct
+ struct smsc47b397_data *data = i2c_get_clientdata(client);
+ int res;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb(reg, client->addr);
+ res = inb_p(client->addr + 1);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return res;
+ }
+
+@@ -121,7 +122,7 @@ static struct smsc47b397_data *smsc47b39
+ struct smsc47b397_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
+ dev_dbg(&client->dev, "starting device update...\n");
+@@ -144,7 +145,7 @@ static struct smsc47b397_data *smsc47b39
+ dev_dbg(&client->dev, "... device update complete\n");
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+@@ -254,14 +255,14 @@ static int smsc47b397_detect(struct i2c_
+ new_client = &data->client;
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ new_client->adapter = adapter;
+ new_client->driver = &smsc47b397_driver;
+ new_client->flags = 0;
+
+ strlcpy(new_client->name, "smsc47b397", I2C_NAME_SIZE);
+
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ if ((err = i2c_attach_client(new_client)))
+ goto error_free;
+--- gregkh-2.6.orig/drivers/hwmon/smsc47m1.c
++++ gregkh-2.6/drivers/hwmon/smsc47m1.c
+@@ -34,6 +34,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
+ #include <linux/init.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+ /* Address is autodetected, there is no default value */
+@@ -102,9 +103,9 @@ superio_exit(void)
+ struct smsc47m1_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ unsigned long last_updated; /* In jiffies */
+
+ u8 fan[2]; /* Register value */
+@@ -188,18 +189,18 @@ static ssize_t set_fan_min(struct device
+ struct smsc47m1_data *data = i2c_get_clientdata(client);
+ long rpmdiv, val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ rpmdiv = val * DIV_FROM_REG(data->fan_div[nr]);
+
+ if (983040 > 192 * rpmdiv || 2 * rpmdiv > 983040) {
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+ data->fan_preload[nr] = 192 - ((983040 + rpmdiv / 2) / rpmdiv);
+ smsc47m1_write_value(client, SMSC47M1_REG_FAN_PRELOAD(nr),
+ data->fan_preload[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -220,14 +221,14 @@ static ssize_t set_fan_div(struct device
+ if (new_div == old_div) /* No change */
+ return count;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ switch (new_div) {
+ case 1: data->fan_div[nr] = 0; break;
+ case 2: data->fan_div[nr] = 1; break;
+ case 4: data->fan_div[nr] = 2; break;
+ case 8: data->fan_div[nr] = 3; break;
+ default:
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+@@ -241,7 +242,7 @@ static ssize_t set_fan_div(struct device
+ data->fan_preload[nr] = SENSORS_LIMIT(tmp, 0, 191);
+ smsc47m1_write_value(client, SMSC47M1_REG_FAN_PRELOAD(nr),
+ data->fan_preload[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -257,12 +258,12 @@ static ssize_t set_pwm(struct device *de
+ if (val < 0 || val > 255)
+ return -EINVAL;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm[nr] &= 0x81; /* Preserve additional bits */
+ data->pwm[nr] |= PWM_TO_REG(val);
+ smsc47m1_write_value(client, SMSC47M1_REG_PWM(nr),
+ data->pwm[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -278,12 +279,12 @@ static ssize_t set_pwm_en(struct device
+ if (val != 0 && val != 1)
+ return -EINVAL;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm[nr] &= 0xFE; /* preserve the other bits */
+ data->pwm[nr] |= !val;
+ smsc47m1_write_value(client, SMSC47M1_REG_PWM(nr),
+ data->pwm[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -408,13 +409,13 @@ static int smsc47m1_detect(struct i2c_ad
+ new_client = &data->client;
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ new_client->adapter = adapter;
+ new_client->driver = &smsc47m1_driver;
+ new_client->flags = 0;
+
+ strlcpy(new_client->name, "smsc47m1", I2C_NAME_SIZE);
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* If no function is properly configured, there's no point in
+ actually registering the chip. */
+@@ -512,17 +513,17 @@ static int smsc47m1_read_value(struct i2
+ {
+ int res;
+
+- down(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
++ mutex_lock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
+ res = inb_p(client->addr + reg);
+- up(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
++ mutex_unlock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
+ return res;
+ }
+
+ static void smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value)
+ {
+- down(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
++ mutex_lock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
+ outb_p(value, client->addr + reg);
+- up(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
++ mutex_unlock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
+ }
+
+ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
+@@ -531,7 +532,7 @@ static struct smsc47m1_data *smsc47m1_up
+ struct i2c_client *client = to_i2c_client(dev);
+ struct smsc47m1_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || init) {
+ int i;
+@@ -558,7 +559,7 @@ static struct smsc47m1_data *smsc47m1_up
+ data->last_updated = jiffies;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return data;
+ }
+
+--- gregkh-2.6.orig/drivers/hwmon/via686a.c
++++ gregkh-2.6/drivers/hwmon/via686a.c
+@@ -39,6 +39,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
+ #include <linux/init.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+
+@@ -296,7 +297,7 @@ static inline long TEMP_FROM_REG10(u16 v
+ struct via686a_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -355,11 +356,11 @@ static ssize_t set_in_min(struct device
+ struct via686a_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[nr] = IN_TO_REG(val, nr);
+ via686a_write_value(client, VIA686A_REG_IN_MIN(nr),
+ data->in_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_in_max(struct device *dev, const char *buf,
+@@ -368,11 +369,11 @@ static ssize_t set_in_max(struct device
+ struct via686a_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[nr] = IN_TO_REG(val, nr);
+ via686a_write_value(client, VIA686A_REG_IN_MAX(nr),
+ data->in_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ #define show_in_offset(offset) \
+@@ -432,11 +433,11 @@ static ssize_t set_temp_over(struct devi
+ struct via686a_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_over[nr] = TEMP_TO_REG(val);
+ via686a_write_value(client, VIA686A_REG_TEMP_OVER[nr],
+ data->temp_over[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_temp_hyst(struct device *dev, const char *buf,
+@@ -445,11 +446,11 @@ static ssize_t set_temp_hyst(struct devi
+ struct via686a_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_hyst[nr] = TEMP_TO_REG(val);
+ via686a_write_value(client, VIA686A_REG_TEMP_HYST[nr],
+ data->temp_hyst[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ #define show_temp_offset(offset) \
+@@ -508,10 +509,10 @@ static ssize_t set_fan_min(struct device
+ struct via686a_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
+ via686a_write_value(client, VIA686A_REG_FAN_MIN(nr+1), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_fan_div(struct device *dev, const char *buf,
+@@ -521,12 +522,12 @@ static ssize_t set_fan_div(struct device
+ int val = simple_strtol(buf, NULL, 10);
+ int old;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ old = via686a_read_value(client, VIA686A_REG_FANDIV);
+ data->fan_div[nr] = DIV_TO_REG(val);
+ old = (old & 0x0f) | (data->fan_div[1] << 6) | (data->fan_div[0] << 4);
+ via686a_write_value(client, VIA686A_REG_FANDIV, old);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -639,7 +640,7 @@ static int via686a_detect(struct i2c_ada
+ strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
+
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+ goto exit_free;
+@@ -733,7 +734,7 @@ static struct via686a_data *via686a_upda
+ struct via686a_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -788,7 +789,7 @@ static struct via686a_data *via686a_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/vt8231.c
++++ gregkh-2.6/drivers/hwmon/vt8231.c
+@@ -35,6 +35,7 @@
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+ static int force_addr;
+@@ -148,7 +149,7 @@ static inline u8 FAN_TO_REG(long rpm, in
+
+ struct vt8231_data {
+ struct i2c_client client;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ struct class_device *class_dev;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+@@ -223,10 +224,10 @@ static ssize_t set_in_min(struct device
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[nr] = SENSORS_LIMIT(((val * 958) / 10000) + 3, 0, 255);
+ vt8231_write_value(client, regvoltmin[nr], data->in_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -239,10 +240,10 @@ static ssize_t set_in_max(struct device
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[nr] = SENSORS_LIMIT(((val * 958) / 10000) + 3, 0, 255);
+ vt8231_write_value(client, regvoltmax[nr], data->in_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -281,11 +282,11 @@ static ssize_t set_in5_min(struct device
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_min[5] = SENSORS_LIMIT(((val * 958 * 34) / (10000 * 54)) + 3,
+ 0, 255);
+ vt8231_write_value(client, regvoltmin[5], data->in_min[5]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -296,11 +297,11 @@ static ssize_t set_in5_max(struct device
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_max[5] = SENSORS_LIMIT(((val * 958 * 34) / (10000 * 54)) + 3,
+ 0, 255);
+ vt8231_write_value(client, regvoltmax[5], data->in_max[5]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -351,10 +352,10 @@ static ssize_t set_temp0_max(struct devi
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[0] = SENSORS_LIMIT((val + 500) / 1000, 0, 255);
+ vt8231_write_value(client, regtempmax[0], data->temp_max[0]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_temp0_min(struct device *dev, struct device_attribute *attr,
+@@ -364,10 +365,10 @@ static ssize_t set_temp0_min(struct devi
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_min[0] = SENSORS_LIMIT((val + 500) / 1000, 0, 255);
+ vt8231_write_value(client, regtempmin[0], data->temp_min[0]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -407,10 +408,10 @@ static ssize_t set_temp_max(struct devic
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_max[nr] = SENSORS_LIMIT(TEMP_MAXMIN_TO_REG(val), 0, 255);
+ vt8231_write_value(client, regtempmax[nr], data->temp_max[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
+@@ -422,10 +423,10 @@ static ssize_t set_temp_min(struct devic
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ int val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_min[nr] = SENSORS_LIMIT(TEMP_MAXMIN_TO_REG(val), 0, 255);
+ vt8231_write_value(client, regtempmin[nr], data->temp_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -520,10 +521,10 @@ static ssize_t set_fan_min(struct device
+ struct vt8231_data *data = i2c_get_clientdata(client);
+ int val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
+ vt8231_write_value(client, VT8231_REG_FAN_MIN(nr), data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -539,7 +540,7 @@ static ssize_t set_fan_div(struct device
+ long min = FAN_FROM_REG(data->fan_min[nr],
+ DIV_FROM_REG(data->fan_div[nr]));
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ switch (val) {
+ case 1: data->fan_div[nr] = 0; break;
+ case 2: data->fan_div[nr] = 1; break;
+@@ -548,7 +549,7 @@ static ssize_t set_fan_div(struct device
+ default:
+ dev_err(&client->dev, "fan_div value %ld not supported."
+ "Choose one of 1, 2, 4 or 8!\n", val);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+@@ -558,7 +559,7 @@ static ssize_t set_fan_div(struct device
+
+ old = (old & 0x0f) | (data->fan_div[1] << 6) | (data->fan_div[0] << 4);
+ vt8231_write_value(client, VT8231_REG_FANDIV, old);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -660,7 +661,7 @@ int vt8231_detect(struct i2c_adapter *ad
+ /* Fill in the remaining client fields and put into the global list */
+ strlcpy(client->name, "vt8231", I2C_NAME_SIZE);
+
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(client)))
+@@ -745,7 +746,7 @@ static struct vt8231_data *vt8231_update
+ int i;
+ u16 low;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -804,7 +805,7 @@ static struct vt8231_data *vt8231_update
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/w83627ehf.c
++++ gregkh-2.6/drivers/hwmon/w83627ehf.c
+@@ -43,6 +43,7 @@
+ #include <linux/i2c-isa.h>
+ #include <linux/hwmon.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+ #include "lm75.h"
+
+@@ -177,9 +178,9 @@ temp1_to_reg(int temp)
+ struct w83627ehf_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -230,7 +231,7 @@ static u16 w83627ehf_read_value(struct i
+ struct w83627ehf_data *data = i2c_get_clientdata(client);
+ int res, word_sized = is_word_sized(reg);
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+
+ w83627ehf_set_bank(client, reg);
+ outb_p(reg & 0xff, client->addr + ADDR_REG_OFFSET);
+@@ -242,7 +243,7 @@ static u16 w83627ehf_read_value(struct i
+ }
+ w83627ehf_reset_bank(client, reg);
+
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+
+ return res;
+ }
+@@ -252,7 +253,7 @@ static int w83627ehf_write_value(struct
+ struct w83627ehf_data *data = i2c_get_clientdata(client);
+ int word_sized = is_word_sized(reg);
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+
+ w83627ehf_set_bank(client, reg);
+ outb_p(reg & 0xff, client->addr + ADDR_REG_OFFSET);
+@@ -264,7 +265,7 @@ static int w83627ehf_write_value(struct
+ outb_p(value & 0xff, client->addr + DATA_REG_OFFSET);
+ w83627ehf_reset_bank(client, reg);
+
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return 0;
+ }
+
+@@ -322,7 +323,7 @@ static struct w83627ehf_data *w83627ehf_
+ struct w83627ehf_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ)
+ || !data->valid) {
+@@ -397,7 +398,7 @@ static struct w83627ehf_data *w83627ehf_
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return data;
+ }
+
+@@ -434,7 +435,7 @@ store_fan_min(struct device *dev, const
+ unsigned int reg;
+ u8 new_div;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ if (!val) {
+ /* No min limit, alarm disabled */
+ data->fan_min[nr] = 255;
+@@ -482,7 +483,7 @@ store_fan_min(struct device *dev, const
+ }
+ w83627ehf_write_value(client, W83627EHF_REG_FAN_MIN[nr],
+ data->fan_min[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -561,11 +562,11 @@ store_temp1_##reg(struct device *dev, st
+ struct w83627ehf_data *data = i2c_get_clientdata(client); \
+ u32 val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->temp1_##reg = temp1_to_reg(val); \
+ w83627ehf_write_value(client, W83627EHF_REG_TEMP1_##REG, \
+ data->temp1_##reg); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ store_temp1_reg(OVER, max);
+@@ -597,11 +598,11 @@ store_##reg (struct device *dev, const c
+ struct w83627ehf_data *data = i2c_get_clientdata(client); \
+ u32 val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->reg[nr] = LM75_TEMP_TO_REG(val); \
+ w83627ehf_write_value(client, W83627EHF_REG_TEMP_##REG[nr], \
+ data->reg[nr]); \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ store_temp_reg(OVER, temp_max);
+@@ -689,14 +690,14 @@ static int w83627ehf_detect(struct i2c_a
+ client = &data->client;
+ i2c_set_clientdata(client, data);
+ client->addr = address;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ client->adapter = adapter;
+ client->driver = &w83627ehf_driver;
+ client->flags = 0;
+
+ strlcpy(client->name, "w83627ehf", I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the i2c layer a new client has arrived */
+ if ((err = i2c_attach_client(client)))
+--- gregkh-2.6.orig/drivers/hwmon/w83627hf.c
++++ gregkh-2.6/drivers/hwmon/w83627hf.c
+@@ -46,6 +46,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+ #include "lm75.h"
+
+@@ -285,10 +286,10 @@ static inline u8 DIV_TO_REG(long val)
+ struct w83627hf_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -360,12 +361,12 @@ store_in_##reg (struct device *dev, cons
+ \
+ val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->in_##reg[nr] = IN_TO_REG(val); \
+ w83627hf_write_value(client, W83781D_REG_IN_##REG(nr), \
+ data->in_##reg[nr]); \
+ \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ store_in_reg(MIN, min)
+@@ -451,7 +452,7 @@ static ssize_t store_regs_in_min0(struct
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if ((data->vrm_ovt & 0x01) &&
+ (w83627thf == data->type || w83637hf == data->type))
+@@ -465,7 +466,7 @@ static ssize_t store_regs_in_min0(struct
+ data->in_min[0] = IN_TO_REG(val);
+
+ w83627hf_write_value(client, W83781D_REG_IN_MIN(0), data->in_min[0]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -478,7 +479,7 @@ static ssize_t store_regs_in_max0(struct
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if ((data->vrm_ovt & 0x01) &&
+ (w83627thf == data->type || w83637hf == data->type))
+@@ -492,7 +493,7 @@ static ssize_t store_regs_in_max0(struct
+ data->in_max[0] = IN_TO_REG(val);
+
+ w83627hf_write_value(client, W83781D_REG_IN_MAX(0), data->in_max[0]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -529,13 +530,13 @@ store_fan_min(struct device *dev, const
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr - 1] =
+ FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr - 1]));
+ w83627hf_write_value(client, W83781D_REG_FAN_MIN(nr),
+ data->fan_min[nr - 1]);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -597,7 +598,7 @@ store_temp_##reg (struct device *dev, co
+ \
+ val = simple_strtoul(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ \
+ if (nr >= 2) { /* TEMP2 and TEMP3 */ \
+ data->temp_##reg##_add[nr-2] = LM75_TEMP_TO_REG(val); \
+@@ -609,7 +610,7 @@ store_temp_##reg (struct device *dev, co
+ data->temp_##reg); \
+ } \
+ \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ store_temp_reg(OVER, max);
+@@ -718,7 +719,7 @@ store_beep_reg(struct device *dev, const
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (update_mask == BEEP_MASK) { /* We are storing beep_mask */
+ data->beep_mask = BEEP_MASK_TO_REG(val);
+@@ -736,7 +737,7 @@ store_beep_reg(struct device *dev, const
+ w83627hf_write_value(client, W83781D_REG_BEEP_INTS2,
+ val2 | data->beep_enable << 7);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -783,7 +784,7 @@ store_fan_div_reg(struct device *dev, co
+ u8 reg;
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ /* Save fan_min */
+ min = FAN_FROM_REG(data->fan_min[nr],
+@@ -805,7 +806,7 @@ store_fan_div_reg(struct device *dev, co
+ data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
+ w83627hf_write_value(client, W83781D_REG_FAN_MIN(nr+1), data->fan_min[nr]);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -848,7 +849,7 @@ store_pwm_reg(struct device *dev, const
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (data->type == w83627thf) {
+ /* bits 0-3 are reserved in 627THF */
+@@ -865,7 +866,7 @@ store_pwm_reg(struct device *dev, const
+ data->pwm[nr - 1]);
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -907,7 +908,7 @@ store_sensor_reg(struct device *dev, con
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ switch (val) {
+ case 1: /* PII/Celeron diode */
+@@ -941,7 +942,7 @@ store_sensor_reg(struct device *dev, con
+ break;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1057,7 +1058,7 @@ static int w83627hf_detect(struct i2c_ad
+ new_client = &data->client;
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ new_client->adapter = adapter;
+ new_client->driver = &w83627hf_driver;
+ new_client->flags = 0;
+@@ -1077,7 +1078,7 @@ static int w83627hf_detect(struct i2c_ad
+ strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
+ data->type = kind;
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -1187,7 +1188,7 @@ static int w83627hf_read_value(struct i2
+ struct w83627hf_data *data = i2c_get_clientdata(client);
+ int res, word_sized;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ word_sized = (((reg & 0xff00) == 0x100)
+ || ((reg & 0xff00) == 0x200))
+ && (((reg & 0x00ff) == 0x50)
+@@ -1213,7 +1214,7 @@ static int w83627hf_read_value(struct i2
+ client->addr + W83781D_ADDR_REG_OFFSET);
+ outb_p(0, client->addr + W83781D_DATA_REG_OFFSET);
+ }
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return res;
+ }
+
+@@ -1252,7 +1253,7 @@ static int w83627hf_write_value(struct i
+ struct w83627hf_data *data = i2c_get_clientdata(client);
+ int word_sized;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ word_sized = (((reg & 0xff00) == 0x100)
+ || ((reg & 0xff00) == 0x200))
+ && (((reg & 0x00ff) == 0x53)
+@@ -1277,7 +1278,7 @@ static int w83627hf_write_value(struct i
+ client->addr + W83781D_ADDR_REG_OFFSET);
+ outb_p(0, client->addr + W83781D_DATA_REG_OFFSET);
+ }
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return 0;
+ }
+
+@@ -1387,7 +1388,7 @@ static struct w83627hf_data *w83627hf_up
+ struct w83627hf_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -1470,7 +1471,7 @@ static struct w83627hf_data *w83627hf_up
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/w83781d.c
++++ gregkh-2.6/drivers/hwmon/w83781d.c
+@@ -42,6 +42,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-vid.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+ #include "lm75.h"
+
+@@ -221,10 +222,10 @@ DIV_TO_REG(long val, enum chips type)
+ struct w83781d_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore lock;
++ struct mutex lock;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -306,11 +307,11 @@ static ssize_t store_in_##reg (struct de
+ \
+ val = simple_strtoul(buf, NULL, 10) / 10; \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ data->in_##reg[nr] = IN_TO_REG(val); \
+ w83781d_write_value(client, W83781D_REG_IN_##REG(nr), data->in_##reg[nr]); \
+ \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ store_in_reg(MIN, min);
+@@ -376,13 +377,13 @@ store_fan_min(struct device *dev, const
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_min[nr - 1] =
+ FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr - 1]));
+ w83781d_write_value(client, W83781D_REG_FAN_MIN(nr),
+ data->fan_min[nr - 1]);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -441,7 +442,7 @@ static ssize_t store_temp_##reg (struct
+ \
+ val = simple_strtol(buf, NULL, 10); \
+ \
+- down(&data->update_lock); \
++ mutex_lock(&data->update_lock); \
+ \
+ if (nr >= 2) { /* TEMP2 and TEMP3 */ \
+ data->temp_##reg##_add[nr-2] = LM75_TEMP_TO_REG(val); \
+@@ -453,7 +454,7 @@ static ssize_t store_temp_##reg (struct
+ data->temp_##reg); \
+ } \
+ \
+- up(&data->update_lock); \
++ mutex_unlock(&data->update_lock); \
+ return count; \
+ }
+ store_temp_reg(OVER, max);
+@@ -566,7 +567,7 @@ store_beep_reg(struct device *dev, const
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (update_mask == BEEP_MASK) { /* We are storing beep_mask */
+ data->beep_mask = BEEP_MASK_TO_REG(val, data->type);
+@@ -587,7 +588,7 @@ store_beep_reg(struct device *dev, const
+ w83781d_write_value(client, W83781D_REG_BEEP_INTS2,
+ val2 | data->beep_enable << 7);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -632,7 +633,7 @@ store_fan_div_reg(struct device *dev, co
+ u8 reg;
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ /* Save fan_min */
+ min = FAN_FROM_REG(data->fan_min[nr],
+@@ -657,7 +658,7 @@ store_fan_div_reg(struct device *dev, co
+ data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
+ w83781d_write_value(client, W83781D_REG_FAN_MIN(nr+1), data->fan_min[nr]);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -704,10 +705,10 @@ store_pwm_reg(struct device *dev, const
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->pwm[nr - 1] = PWM_TO_REG(val);
+ w83781d_write_value(client, W83781D_REG_PWM(nr), data->pwm[nr - 1]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -720,7 +721,7 @@ store_pwmenable_reg(struct device *dev,
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ switch (val) {
+ case 0:
+@@ -737,11 +738,11 @@ store_pwmenable_reg(struct device *dev,
+ break;
+
+ default:
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return -EINVAL;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -803,7 +804,7 @@ store_sensor_reg(struct device *dev, con
+
+ val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ switch (val) {
+ case 1: /* PII/Celeron diode */
+@@ -836,7 +837,7 @@ store_sensor_reg(struct device *dev, con
+ break;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -1068,7 +1069,7 @@ w83781d_detect(struct i2c_adapter *adapt
+ new_client = &data->client;
+ i2c_set_clientdata(new_client, data);
+ new_client->addr = address;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ new_client->adapter = adapter;
+ new_client->driver = is_isa ? &w83781d_isa_driver : &w83781d_driver;
+ new_client->flags = 0;
+@@ -1173,7 +1174,7 @@ w83781d_detect(struct i2c_adapter *adapt
+ data->type = kind;
+
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -1320,7 +1321,7 @@ w83781d_read_value(struct i2c_client *cl
+ int res, word_sized, bank;
+ struct i2c_client *cl;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ if (i2c_is_isa_client(client)) {
+ word_sized = (((reg & 0xff00) == 0x100)
+ || ((reg & 0xff00) == 0x200))
+@@ -1378,7 +1379,7 @@ w83781d_read_value(struct i2c_client *cl
+ if (bank > 2)
+ i2c_smbus_write_byte_data(client, W83781D_REG_BANK, 0);
+ }
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return res;
+ }
+
+@@ -1389,7 +1390,7 @@ w83781d_write_value(struct i2c_client *c
+ int word_sized, bank;
+ struct i2c_client *cl;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ if (i2c_is_isa_client(client)) {
+ word_sized = (((reg & 0xff00) == 0x100)
+ || ((reg & 0xff00) == 0x200))
+@@ -1442,7 +1443,7 @@ w83781d_write_value(struct i2c_client *c
+ if (bank > 2)
+ i2c_smbus_write_byte_data(client, W83781D_REG_BANK, 0);
+ }
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ return 0;
+ }
+
+@@ -1537,7 +1538,7 @@ static struct w83781d_data *w83781d_upda
+ struct w83781d_data *data = i2c_get_clientdata(client);
+ int i;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+ || !data->valid) {
+@@ -1634,7 +1635,7 @@ static struct w83781d_data *w83781d_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+--- gregkh-2.6.orig/drivers/hwmon/w83792d.c
++++ gregkh-2.6/drivers/hwmon/w83792d.c
+@@ -43,6 +43,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
+@@ -271,7 +272,7 @@ struct w83792d_data {
+ struct class_device *class_dev;
+ enum chips type;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+
+@@ -1222,7 +1223,7 @@ w83792d_detect(struct i2c_adapter *adapt
+ data->type = kind;
+
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(client)))
+@@ -1373,7 +1374,7 @@ static struct w83792d_data *w83792d_upda
+ int i, j;
+ u8 reg_array_tmp[4], pwm_array_tmp[7], reg_tmp;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (time_after
+ (jiffies - data->last_updated, (unsigned long) (HZ * 3))
+@@ -1484,7 +1485,7 @@ static struct w83792d_data *w83792d_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ #ifdef DEBUG
+ w83792d_print_debug(data, dev);
+--- gregkh-2.6.orig/drivers/hwmon/w83l785ts.c
++++ gregkh-2.6/drivers/hwmon/w83l785ts.c
+@@ -39,6 +39,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+
+ /* How many retries on register read error */
+ #define MAX_RETRIES 5
+@@ -107,7 +108,7 @@ static struct i2c_driver w83l785ts_drive
+ struct w83l785ts_data {
+ struct i2c_client client;
+ struct class_device *class_dev;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* zero until following fields are valid */
+ unsigned long last_updated; /* in jiffies */
+
+@@ -221,7 +222,7 @@ static int w83l785ts_detect(struct i2c_a
+ /* We can fill in the remaining client fields. */
+ strlcpy(new_client->name, "w83l785ts", I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Default values in case the first read fails (unlikely). */
+ data->temp[1] = data->temp[0] = 0;
+@@ -299,7 +300,7 @@ static struct w83l785ts_data *w83l785ts_
+ struct i2c_client *client = to_i2c_client(dev);
+ struct w83l785ts_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (!data->valid || time_after(jiffies, data->last_updated + HZ * 2)) {
+ dev_dbg(&client->dev, "Updating w83l785ts data.\n");
+@@ -312,7 +313,7 @@ static struct w83l785ts_data *w83l785ts_
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
diff --git a/i2c/hwmon-f71805f-convert-semaphore-to-mutex.patch b/i2c/hwmon-f71805f-convert-semaphore-to-mutex.patch
new file mode 100644
index 00000000000000..75b71e949d00a2
--- /dev/null
+++ b/i2c/hwmon-f71805f-convert-semaphore-to-mutex.patch
@@ -0,0 +1,216 @@
+From khali@linux-fr.org Wed Jan 18 14:20:07 2006
+Date: Wed, 18 Jan 2006 23:20:53 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ingo Molnar <mingo@elte.hu>
+Subject: [PATCH 16/17] hwmon: f71805f semaphore to mutex conversions
+Message-Id: <20060118232053.036f5a7c.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-f71805f-convert-semaphore-to-mutex.patch
+
+Convert the new f71805f hardware monitoring driver to use mutexes
+instead of semaphores.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/hwmon/f71805f.c | 57 ++++++++++++++++++++++++------------------------
+ 1 file changed, 29 insertions(+), 28 deletions(-)
+
+--- gregkh-2.6.orig/drivers/hwmon/f71805f.c
++++ gregkh-2.6/drivers/hwmon/f71805f.c
+@@ -30,6 +30,7 @@
+ #include <linux/hwmon.h>
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/err.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+
+ static struct platform_device *pdev;
+@@ -131,10 +132,10 @@ static struct resource f71805f_resource
+ struct f71805f_data {
+ unsigned short addr;
+ const char *name;
+- struct semaphore lock;
++ struct mutex lock;
+ struct class_device *class_dev;
+
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ char valid; /* !=0 if following fields are valid */
+ unsigned long last_updated; /* In jiffies */
+ unsigned long last_limits; /* In jiffies */
+@@ -224,20 +225,20 @@ static u8 f71805f_read8(struct f71805f_d
+ {
+ u8 val;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb(reg, data->addr + ADDR_REG_OFFSET);
+ val = inb(data->addr + DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+
+ return val;
+ }
+
+ static void f71805f_write8(struct f71805f_data *data, u8 reg, u8 val)
+ {
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb(reg, data->addr + ADDR_REG_OFFSET);
+ outb(val, data->addr + DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ }
+
+ /* It is important to read the MSB first, because doing so latches the
+@@ -246,24 +247,24 @@ static u16 f71805f_read16(struct f71805f
+ {
+ u16 val;
+
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb(reg, data->addr + ADDR_REG_OFFSET);
+ val = inb(data->addr + DATA_REG_OFFSET) << 8;
+ outb(++reg, data->addr + ADDR_REG_OFFSET);
+ val |= inb(data->addr + DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+
+ return val;
+ }
+
+ static void f71805f_write16(struct f71805f_data *data, u8 reg, u16 val)
+ {
+- down(&data->lock);
++ mutex_lock(&data->lock);
+ outb(reg, data->addr + ADDR_REG_OFFSET);
+ outb(val >> 8, data->addr + DATA_REG_OFFSET);
+ outb(++reg, data->addr + ADDR_REG_OFFSET);
+ outb(val & 0xff, data->addr + DATA_REG_OFFSET);
+- up(&data->lock);
++ mutex_unlock(&data->lock);
+ }
+
+ static struct f71805f_data *f71805f_update_device(struct device *dev)
+@@ -271,7 +272,7 @@ static struct f71805f_data *f71805f_upda
+ struct f71805f_data *data = dev_get_drvdata(dev);
+ int nr;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ /* Limit registers cache is refreshed after 60 seconds */
+ if (time_after(jiffies, data->last_updated + 60 * HZ)
+@@ -323,7 +324,7 @@ static struct f71805f_data *f71805f_upda
+ data->valid = 1;
+ }
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return data;
+ }
+@@ -362,10 +363,10 @@ static ssize_t set_in0_max(struct device
+ struct f71805f_data *data = dev_get_drvdata(dev);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_high[0] = in0_to_reg(val);
+ f71805f_write8(data, F71805F_REG_IN_HIGH(0), data->in_high[0]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -376,10 +377,10 @@ static ssize_t set_in0_min(struct device
+ struct f71805f_data *data = dev_get_drvdata(dev);
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_low[0] = in0_to_reg(val);
+ f71805f_write8(data, F71805F_REG_IN_LOW(0), data->in_low[0]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -422,10 +423,10 @@ static ssize_t set_in_max(struct device
+ int nr = attr->index;
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_high[nr] = in_to_reg(val);
+ f71805f_write8(data, F71805F_REG_IN_HIGH(nr), data->in_high[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -438,10 +439,10 @@ static ssize_t set_in_min(struct device
+ int nr = attr->index;
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->in_low[nr] = in_to_reg(val);
+ f71805f_write8(data, F71805F_REG_IN_LOW(nr), data->in_low[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -474,10 +475,10 @@ static ssize_t set_fan_min(struct device
+ int nr = attr->index;
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->fan_low[nr] = fan_to_reg(val);
+ f71805f_write16(data, F71805F_REG_FAN_LOW(nr), data->fan_low[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -531,10 +532,10 @@ static ssize_t set_temp_max(struct devic
+ int nr = attr->index;
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_high[nr] = temp_to_reg(val);
+ f71805f_write8(data, F71805F_REG_TEMP_HIGH(nr), data->temp_high[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -547,10 +548,10 @@ static ssize_t set_temp_hyst(struct devi
+ int nr = attr->index;
+ long val = simple_strtol(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ data->temp_hyst[nr] = temp_to_reg(val);
+ f71805f_write8(data, F71805F_REG_TEMP_HYST(nr), data->temp_hyst[nr]);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ return count;
+ }
+@@ -711,9 +712,9 @@ static int __devinit f71805f_probe(struc
+
+ res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ data->addr = res->start;
+- init_MUTEX(&data->lock);
++ mutex_init(&data->lock);
+ data->name = "f71805f";
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ platform_set_drvdata(pdev, data);
+
diff --git a/i2c/hwmon-it87-probe-i2c-0x2d-only.patch b/i2c/hwmon-it87-probe-i2c-0x2d-only.patch
new file mode 100644
index 00000000000000..4f5aaab4b14550
--- /dev/null
+++ b/i2c/hwmon-it87-probe-i2c-0x2d-only.patch
@@ -0,0 +1,79 @@
+From khali@linux-fr.org Wed Jan 18 13:39:09 2006
+Date: Wed, 18 Jan 2006 22:39:48 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: LM Sensors <lm-sensors@lm-sensors.org>, dragoran@feuerpokemon.de
+Subject: [PATCH 01/17] hwmon: Fix reboot on it87 driver load
+Message-Id: <20060118223948.16bd611a.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-it87-probe-i2c-0x2d-only.patch
+
+Only scan I2C address 0x2d. This is the default address and no IT87xxF
+chip was ever seen on I2C at a different address. These chips are
+better accessed through their ISA interface anyway.
+
+This fixes bug #5889, although it doesn't address the whole class
+of problems. We'd need the ability to blacklist arbitrary I2C addresses
+on systems known to contain I2C devices which behave badly when probed.
+
+Plan the I2C interface for removal as well. If nobody complains within
+a year, it will confirm my impression that the I2C interface isn't
+actually needed by anyone.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ Documentation/feature-removal-schedule.txt | 9 +++++++++
+ Documentation/hwmon/it87 | 2 +-
+ drivers/hwmon/it87.c | 8 ++++++--
+ 3 files changed, 16 insertions(+), 3 deletions(-)
+
+--- gregkh-2.6.orig/Documentation/hwmon/it87
++++ gregkh-2.6/Documentation/hwmon/it87
+@@ -9,7 +9,7 @@ Supported chips:
+ http://www.ite.com.tw/
+ * IT8712F
+ Prefix: 'it8712'
+- Addresses scanned: I2C 0x28 - 0x2f
++ Addresses scanned: I2C 0x2d
+ from Super I/O config space (8 I/O ports)
+ Datasheet: Publicly available at the ITE website
+ http://www.ite.com.tw/
+--- gregkh-2.6.orig/drivers/hwmon/it87.c
++++ gregkh-2.6/drivers/hwmon/it87.c
+@@ -45,8 +45,7 @@
+
+
+ /* Addresses to scan */
+-static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
+- 0x2e, 0x2f, I2C_CLIENT_END };
++static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
+ static unsigned short isa_address;
+
+ /* Insmod parameters */
+@@ -830,6 +829,11 @@ static int it87_detect(struct i2c_adapte
+ if ((err = i2c_attach_client(new_client)))
+ goto ERROR2;
+
++ if (!is_isa)
++ dev_info(&new_client->dev, "The I2C interface to IT87xxF "
++ "hardware monitoring chips is deprecated. Please "
++ "report if you still rely on it.\n");
++
+ /* Check PWM configuration */
+ enable_pwm_interface = it87_check_pwm(new_client);
+
+--- gregkh-2.6.orig/Documentation/feature-removal-schedule.txt
++++ gregkh-2.6/Documentation/feature-removal-schedule.txt
+@@ -148,3 +148,12 @@ Why: The 8250 serial driver now has the
+ brother on Alchemy SOCs. The loss of features is not considered an
+ issue.
+ Who: Ralf Baechle <ralf@linux-mips.org>
++
++---------------------------
++
++What: I2C interface of the it87 driver
++When: January 2007
++Why: The ISA interface is faster and should be always available. The I2C
++ probing is also known to cause trouble in at least one case (see
++ bug #5889.)
++Who: Jean Delvare <khali@linux-fr.org>
diff --git a/i2c/hwmon-sensor-attr-array-2.patch b/i2c/hwmon-sensor-attr-array-2.patch
new file mode 100644
index 00000000000000..0ed20ce2dbd0ec
--- /dev/null
+++ b/i2c/hwmon-sensor-attr-array-2.patch
@@ -0,0 +1,44 @@
+From khali@linux-fr.org Wed Jan 18 14:10:02 2006
+Date: Wed, 18 Jan 2006 23:10:49 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Jim Cromie <jim.cromie@gmail.com>
+Subject: [PATCH 09/17] hwmon: Refactor SENSOR_DEVICE_ATTR_2
+Message-Id: <20060118231049.0e73d173.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-sensor-attr-array-2.patch
+
+From: Jim Cromie <jim.cromie@gmail.com>
+
+This patch refactors SENSOR_DEVICE_ATTR_2 macro, following pattern set by
+SENSOR_ATTR. First it creates a new macro SENSOR_ATTR_2() which expands
+to an initialization expression, then it uses that in SENSOR_DEVICE_ATTR_2,
+which declares and initializes a struct sensor_device_attribute_2.
+
+Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ include/linux/hwmon-sysfs.h | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+--- gregkh-2.6.orig/include/linux/hwmon-sysfs.h
++++ gregkh-2.6/include/linux/hwmon-sysfs.h
+@@ -43,11 +43,13 @@ struct sensor_device_attribute_2 {
+ #define to_sensor_dev_attr_2(_dev_attr) \
+ container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr)
+
++#define SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index) \
++ { .dev_attr = __ATTR(_name, _mode, _show, _store), \
++ .index = _index, \
++ .nr = _nr }
++
+ #define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \
+-struct sensor_device_attribute_2 sensor_dev_attr_##_name = { \
+- .dev_attr = __ATTR(_name,_mode,_show,_store), \
+- .index = _index, \
+- .nr = _nr, \
+-}
++struct sensor_device_attribute_2 sensor_dev_attr_##_name \
++ = SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index)
+
+ #endif /* _LINUX_HWMON_SYSFS_H */
diff --git a/i2c/hwmon-w83627hf-add-w83687thf-support.patch b/i2c/hwmon-w83627hf-add-w83687thf-support.patch
new file mode 100644
index 00000000000000..539dd12ee2c16e
--- /dev/null
+++ b/i2c/hwmon-w83627hf-add-w83687thf-support.patch
@@ -0,0 +1,252 @@
+From khali@linux-fr.org Wed Jan 18 14:21:24 2006
+Date: Wed, 18 Jan 2006 23:22:12 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Steven Karatnyk <stevenkaratnyk@rogers.com>
+Subject: [PATCH 17/17] hwmon: Add support for the Winbond W83687THF
+Message-Id: <20060118232212.74619ffb.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-w83627hf-add-w83687thf-support.patch
+
+Add support for the Winbond W83687THF chip to the w83627hf hardware
+monitoring driver. This new chip is almost similar to the already
+supported W83627THF chip, except for VID and a few other minor
+changes.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ Documentation/hwmon/w83627hf | 4 ++
+ drivers/hwmon/Kconfig | 7 ++--
+ drivers/hwmon/w83627hf.c | 72 ++++++++++++++++++++++++++++++++++---------
+ 3 files changed, 66 insertions(+), 17 deletions(-)
+
+--- gregkh-2.6.orig/drivers/hwmon/w83627hf.c
++++ gregkh-2.6/drivers/hwmon/w83627hf.c
+@@ -28,6 +28,7 @@
+ w83627hf 9 3 2 3 0x20 0x5ca3 no yes(LPC)
+ w83627thf 7 3 3 3 0x90 0x5ca3 no yes(LPC)
+ w83637hf 7 3 3 3 0x80 0x5ca3 no yes(LPC)
++ w83687thf 7 3 3 3 0x90 0x5ca3 no yes(LPC)
+ w83697hf 8 2 2 2 0x60 0x5ca3 no yes(LPC)
+
+ For other winbond chips, and for i2c support in the above chips,
+@@ -63,7 +64,7 @@ MODULE_PARM_DESC(force_i2c,
+ static unsigned short address;
+
+ /* Insmod parameters */
+-enum chips { any_chip, w83627hf, w83627thf, w83697hf, w83637hf };
++enum chips { any_chip, w83627hf, w83627thf, w83697hf, w83637hf, w83687thf };
+
+ static int reset;
+ module_param(reset, bool, 0);
+@@ -101,6 +102,10 @@ static int VAL; /* The value to read/wr
+ #define W83627THF_GPIO5_IOSR 0xf3 /* w83627thf only */
+ #define W83627THF_GPIO5_DR 0xf4 /* w83627thf only */
+
++#define W83687THF_VID_EN 0x29 /* w83687thf only */
++#define W83687THF_VID_CFG 0xF0 /* w83687thf only */
++#define W83687THF_VID_DATA 0xF1 /* w83687thf only */
++
+ static inline void
+ superio_outb(int reg, int val)
+ {
+@@ -139,6 +144,7 @@ superio_exit(void)
+ #define W627THF_DEVID 0x82
+ #define W697_DEVID 0x60
+ #define W637_DEVID 0x70
++#define W687THF_DEVID 0x85
+ #define WINB_ACT_REG 0x30
+ #define WINB_BASE_REG 0x60
+ /* Constants specified below */
+@@ -202,11 +208,11 @@ superio_exit(void)
+ #define W83627HF_REG_PWM1 0x5A
+ #define W83627HF_REG_PWM2 0x5B
+
+-#define W83627THF_REG_PWM1 0x01 /* 697HF and 637HF too */
+-#define W83627THF_REG_PWM2 0x03 /* 697HF and 637HF too */
+-#define W83627THF_REG_PWM3 0x11 /* 637HF too */
++#define W83627THF_REG_PWM1 0x01 /* 697HF/637HF/687THF too */
++#define W83627THF_REG_PWM2 0x03 /* 697HF/637HF/687THF too */
++#define W83627THF_REG_PWM3 0x11 /* 637HF/687THF too */
+
+-#define W83627THF_REG_VRM_OVT_CFG 0x18 /* 637HF too */
++#define W83627THF_REG_VRM_OVT_CFG 0x18 /* 637HF/687THF too */
+
+ static const u8 regpwm_627hf[] = { W83627HF_REG_PWM1, W83627HF_REG_PWM2 };
+ static const u8 regpwm[] = { W83627THF_REG_PWM1, W83627THF_REG_PWM2,
+@@ -319,7 +325,7 @@ struct w83627hf_data {
+ Default = 3435.
+ Other Betas unimplemented */
+ u8 vrm;
+- u8 vrm_ovt; /* Register value, 627thf & 637hf only */
++ u8 vrm_ovt; /* Register value, 627THF/637HF/687THF only */
+ };
+
+
+@@ -414,7 +420,8 @@ static ssize_t show_in_0(struct w83627hf
+ long in0;
+
+ if ((data->vrm_ovt & 0x01) &&
+- (w83627thf == data->type || w83637hf == data->type))
++ (w83627thf == data->type || w83637hf == data->type
++ || w83687thf == data->type))
+
+ /* use VRM9 calculation */
+ in0 = (long)((reg * 488 + 70000 + 50) / 100);
+@@ -455,7 +462,8 @@ static ssize_t store_regs_in_min0(struct
+ mutex_lock(&data->update_lock);
+
+ if ((data->vrm_ovt & 0x01) &&
+- (w83627thf == data->type || w83637hf == data->type))
++ (w83627thf == data->type || w83637hf == data->type
++ || w83687thf == data->type))
+
+ /* use VRM9 calculation */
+ data->in_min[0] =
+@@ -482,7 +490,8 @@ static ssize_t store_regs_in_max0(struct
+ mutex_lock(&data->update_lock);
+
+ if ((data->vrm_ovt & 0x01) &&
+- (w83627thf == data->type || w83637hf == data->type))
++ (w83627thf == data->type || w83637hf == data->type
++ || w83687thf == data->type))
+
+ /* use VRM9 calculation */
+ data->in_max[0] =
+@@ -981,7 +990,8 @@ static int __init w83627hf_find(int sioa
+ if(val != W627_DEVID &&
+ val != W627THF_DEVID &&
+ val != W697_DEVID &&
+- val != W637_DEVID) {
++ val != W637_DEVID &&
++ val != W687THF_DEVID) {
+ superio_exit();
+ return -ENODEV;
+ }
+@@ -1035,6 +1045,8 @@ static int w83627hf_detect(struct i2c_ad
+ kind = w83627thf;
+ else if(val == W637_DEVID)
+ kind = w83637hf;
++ else if (val == W687THF_DEVID)
++ kind = w83687thf;
+ else {
+ dev_info(&adapter->dev,
+ "Unsupported chip (dev_id=0x%02X).\n", val);
+@@ -1072,6 +1084,8 @@ static int w83627hf_detect(struct i2c_ad
+ client_name = "w83697hf";
+ } else if (kind == w83637hf) {
+ client_name = "w83637hf";
++ } else if (kind == w83687thf) {
++ client_name = "w83687thf";
+ }
+
+ /* Fill in the remaining client fields and put into the global list */
+@@ -1107,7 +1121,7 @@ static int w83627hf_detect(struct i2c_ad
+ device_create_file_in(new_client, 2);
+ device_create_file_in(new_client, 3);
+ device_create_file_in(new_client, 4);
+- if (kind != w83627thf && kind != w83637hf) {
++ if (kind == w83627hf || kind == w83697hf) {
+ device_create_file_in(new_client, 5);
+ device_create_file_in(new_client, 6);
+ }
+@@ -1140,7 +1154,7 @@ static int w83627hf_detect(struct i2c_ad
+
+ device_create_file_pwm(new_client, 1);
+ device_create_file_pwm(new_client, 2);
+- if (kind == w83627thf || kind == w83637hf)
++ if (kind == w83627thf || kind == w83637hf || kind == w83687thf)
+ device_create_file_pwm(new_client, 3);
+
+ device_create_file_sensor(new_client, 1);
+@@ -1248,6 +1262,33 @@ exit:
+ return res;
+ }
+
++static int w83687thf_read_vid(struct i2c_client *client)
++{
++ int res = 0xff;
++
++ superio_enter();
++ superio_select(W83627HF_LD_HWM);
++
++ /* Make sure these GPIO pins are enabled */
++ if (!(superio_inb(W83687THF_VID_EN) & (1 << 2))) {
++ dev_dbg(&client->dev, "VID disabled, no VID function\n");
++ goto exit;
++ }
++
++ /* Make sure the pins are configured for input */
++ if (!(superio_inb(W83687THF_VID_CFG) & (1 << 4))) {
++ dev_dbg(&client->dev, "VID configured as output, "
++ "no VID function\n");
++ goto exit;
++ }
++
++ res = superio_inb(W83687THF_VID_DATA) & 0x3f;
++
++exit:
++ superio_exit();
++ return res;
++}
++
+ static int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
+ {
+ struct w83627hf_data *data = i2c_get_clientdata(client);
+@@ -1325,10 +1366,13 @@ static void w83627hf_init_client(struct
+ data->vid = (lo & 0x0f) | ((hi & 0x01) << 4);
+ } else if (w83627thf == data->type) {
+ data->vid = w83627thf_read_gpio5(client);
++ } else if (w83687thf == data->type) {
++ data->vid = w83687thf_read_vid(client);
+ }
+
+ /* Read VRM & OVT Config only once */
+- if (w83627thf == data->type || w83637hf == data->type) {
++ if (w83627thf == data->type || w83637hf == data->type
++ || w83687thf == data->type) {
+ data->vrm_ovt =
+ w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG);
+ }
+@@ -1395,7 +1439,7 @@ static struct w83627hf_data *w83627hf_up
+ for (i = 0; i <= 8; i++) {
+ /* skip missing sensors */
+ if (((data->type == w83697hf) && (i == 1)) ||
+- ((data->type == w83627thf || data->type == w83637hf)
++ ((data->type != w83627hf && data->type != w83697hf)
+ && (i == 5 || i == 6)))
+ continue;
+ data->in[i] =
+--- gregkh-2.6.orig/Documentation/hwmon/w83627hf
++++ gregkh-2.6/Documentation/hwmon/w83627hf
+@@ -18,6 +18,10 @@ Supported chips:
+ Prefix: 'w83637hf'
+ Addresses scanned: ISA address retrieved from Super I/O registers
+ Datasheet: http://www.winbond.com/PDF/sheet/w83637hf.pdf
++ * Winbond W83687THF
++ Prefix: 'w83687thf'
++ Addresses scanned: ISA address retrieved from Super I/O registers
++ Datasheet: Provided by Winbond on request
+
+ Authors:
+ Frodo Looijaard <frodol@dds.nl>,
+--- gregkh-2.6.orig/drivers/hwmon/Kconfig
++++ gregkh-2.6/drivers/hwmon/Kconfig
+@@ -406,13 +406,14 @@ config SENSORS_W83L785TS
+ will be called w83l785ts.
+
+ config SENSORS_W83627HF
+- tristate "Winbond W83627HF, W83627THF, W83637HF, W83697HF"
+- depends on HWMON && I2C && EXPERIMENTAL
++ tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF"
++ depends on HWMON && I2C
+ select I2C_ISA
+ select HWMON_VID
+ help
+ If you say yes here you get support for the Winbond W836X7 series
+- of sensor chips: the W83627HF, W83627THF, W83637HF, and the W83697HF
++ of sensor chips: the W83627HF, W83627THF, W83637HF, W83687THF and
++ W83697HF.
+
+ This driver can also be built as a module. If so, the module
+ will be called w83627hf.
diff --git a/i2c/hwmon-w83792d-drop-useless-macros.patch b/i2c/hwmon-w83792d-drop-useless-macros.patch
new file mode 100644
index 00000000000000..a6a2918c8fc80d
--- /dev/null
+++ b/i2c/hwmon-w83792d-drop-useless-macros.patch
@@ -0,0 +1,76 @@
+From khali@linux-fr.org Wed Jan 18 14:12:24 2006
+Date: Wed, 18 Jan 2006 23:13:09 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Subject: [PATCH 11/17] hwmon: w83792d drop useless macros
+Message-Id: <20060118231309.1509ba3d.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-w83792d-drop-useless-macros.patch
+
+Drop 3 useless macros in the w83792d hardware monitoring driver.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/hwmon/w83792d.c | 24 +++---------------------
+ 1 file changed, 3 insertions(+), 21 deletions(-)
+
+--- gregkh-2.6.orig/drivers/hwmon/w83792d.c
++++ gregkh-2.6/drivers/hwmon/w83792d.c
+@@ -618,10 +618,6 @@ show_alarms_reg(struct device *dev, stru
+
+ static
+ DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
+-#define device_create_file_alarms() \
+-device_create_file(dev, &dev_attr_alarms);
+-
+-
+
+ static ssize_t
+ show_pwm(struct device *dev, struct device_attribute *attr,
+@@ -775,12 +771,6 @@ show_regs_chassis(struct device *dev, st
+
+ static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL);
+
+-#define device_create_file_chassis() \
+-do { \
+-device_create_file(dev, &dev_attr_chassis); \
+-} while (0)
+-
+-
+ static ssize_t
+ show_chassis_clear(struct device *dev, struct device_attribute *attr, char *buf)
+ {
+@@ -811,13 +801,6 @@ store_chassis_clear(struct device *dev,
+ static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR,
+ show_chassis_clear, store_chassis_clear);
+
+-#define device_create_file_chassis_clear() \
+-do { \
+-device_create_file(dev, &dev_attr_chassis_clear); \
+-} while (0)
+-
+-
+-
+ /* For Smart Fan I / Thermal Cruise */
+ static ssize_t
+ show_thermal_cruise(struct device *dev, struct device_attribute *attr,
+@@ -1294,16 +1277,15 @@ w83792d_detect(struct i2c_adapter *adapt
+ device_create_file(dev, &sda_tolerance[i].dev_attr);
+ }
+
+- device_create_file_alarms();
+-
+ for (i = 0; i < ARRAY_SIZE(sda_pwm); i++) {
+ device_create_file(dev, &sda_pwm[i].dev_attr);
+ device_create_file(dev, &sda_pwm_enable[i].dev_attr);
+ device_create_file(dev, &sda_pwm_mode[i].dev_attr);
+ }
+
+- device_create_file_chassis();
+- device_create_file_chassis_clear();
++ device_create_file(dev, &dev_attr_alarms);
++ device_create_file(dev, &dev_attr_chassis);
++ device_create_file(dev, &dev_attr_chassis_clear);
+
+ for (i = 0; i < ARRAY_SIZE(sda_sf2_point); i++)
+ device_create_file(dev, &sda_sf2_point[i].dev_attr);
diff --git a/i2c/hwmon-w83792d-use-attr-arrays.patch b/i2c/hwmon-w83792d-use-attr-arrays.patch
new file mode 100644
index 00000000000000..5a4d33b73c9fce
--- /dev/null
+++ b/i2c/hwmon-w83792d-use-attr-arrays.patch
@@ -0,0 +1,748 @@
+From khali@linux-fr.org Wed Jan 18 14:11:10 2006
+Date: Wed, 18 Jan 2006 23:11:55 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Yuan Mu <ymu@winbond.com.tw>, Jim Cromie <jim.cromie@gmail.com>
+Subject: [PATCH 10/17] hwmon: w83792d use arrays of attributes
+Message-Id: <20060118231155.78eb9509.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-w83792d-use-attr-arrays.patch
+
+From: Yuan Mu <ymu@winbond.com.tw>
+
+Use arrays of attributes in the w83792d driver.
+
+Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
+Signed-off-by: Yuan Mu <ymu@winbond.com.tw>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/hwmon/w83792d.c | 525 ++++++++++++++++++++++--------------------------
+ 1 file changed, 241 insertions(+), 284 deletions(-)
+
+--- gregkh-2.6.orig/drivers/hwmon/w83792d.c
++++ gregkh-2.6/drivers/hwmon/w83792d.c
+@@ -382,30 +382,40 @@ static ssize_t store_in_##reg (struct de
+ store_in_reg(MIN, min);
+ store_in_reg(MAX, max);
+
+-#define sysfs_in_reg(offset) \
+-static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in, \
+- NULL, offset); \
+-static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
+- show_in_min, store_in_min, offset); \
+-static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
+- show_in_max, store_in_max, offset);
+-
+-sysfs_in_reg(0);
+-sysfs_in_reg(1);
+-sysfs_in_reg(2);
+-sysfs_in_reg(3);
+-sysfs_in_reg(4);
+-sysfs_in_reg(5);
+-sysfs_in_reg(6);
+-sysfs_in_reg(7);
+-sysfs_in_reg(8);
++static struct sensor_device_attribute sda_in_input[] = {
++ SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0),
++ SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1),
++ SENSOR_ATTR(in2_input, S_IRUGO, show_in, NULL, 2),
++ SENSOR_ATTR(in3_input, S_IRUGO, show_in, NULL, 3),
++ SENSOR_ATTR(in4_input, S_IRUGO, show_in, NULL, 4),
++ SENSOR_ATTR(in5_input, S_IRUGO, show_in, NULL, 5),
++ SENSOR_ATTR(in6_input, S_IRUGO, show_in, NULL, 6),
++ SENSOR_ATTR(in7_input, S_IRUGO, show_in, NULL, 7),
++ SENSOR_ATTR(in8_input, S_IRUGO, show_in, NULL, 8),
++};
++static struct sensor_device_attribute sda_in_min[] = {
++ SENSOR_ATTR(in0_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 0),
++ SENSOR_ATTR(in1_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 1),
++ SENSOR_ATTR(in2_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 2),
++ SENSOR_ATTR(in3_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 3),
++ SENSOR_ATTR(in4_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 4),
++ SENSOR_ATTR(in5_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 5),
++ SENSOR_ATTR(in6_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 6),
++ SENSOR_ATTR(in7_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 7),
++ SENSOR_ATTR(in8_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 8),
++};
++static struct sensor_device_attribute sda_in_max[] = {
++ SENSOR_ATTR(in0_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 0),
++ SENSOR_ATTR(in1_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 1),
++ SENSOR_ATTR(in2_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 2),
++ SENSOR_ATTR(in3_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 3),
++ SENSOR_ATTR(in4_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 4),
++ SENSOR_ATTR(in5_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 5),
++ SENSOR_ATTR(in6_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 6),
++ SENSOR_ATTR(in7_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 7),
++ SENSOR_ATTR(in8_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 8),
++};
+
+-#define device_create_file_in(client, offset) \
+-do { \
+-device_create_file(&client->dev, &sensor_dev_attr_in##offset##_input.dev_attr); \
+-device_create_file(&client->dev, &sensor_dev_attr_in##offset##_max.dev_attr); \
+-device_create_file(&client->dev, &sensor_dev_attr_in##offset##_min.dev_attr); \
+-} while (0)
+
+ #define show_fan_reg(reg) \
+ static ssize_t show_##reg (struct device *dev, struct device_attribute *attr, \
+@@ -486,28 +496,33 @@ store_fan_div(struct device *dev, struct
+ return count;
+ }
+
+-#define sysfs_fan(offset) \
+-static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan, NULL, \
+- offset); \
+-static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
+- show_fan_div, store_fan_div, offset); \
+-static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
+- show_fan_min, store_fan_min, offset);
+-
+-sysfs_fan(1);
+-sysfs_fan(2);
+-sysfs_fan(3);
+-sysfs_fan(4);
+-sysfs_fan(5);
+-sysfs_fan(6);
+-sysfs_fan(7);
+-
+-#define device_create_file_fan(client, offset) \
+-do { \
+-device_create_file(&client->dev, &sensor_dev_attr_fan##offset##_input.dev_attr); \
+-device_create_file(&client->dev, &sensor_dev_attr_fan##offset##_div.dev_attr); \
+-device_create_file(&client->dev, &sensor_dev_attr_fan##offset##_min.dev_attr); \
+-} while (0)
++static struct sensor_device_attribute sda_fan_input[] = {
++ SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 1),
++ SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 2),
++ SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 3),
++ SENSOR_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 4),
++ SENSOR_ATTR(fan5_input, S_IRUGO, show_fan, NULL, 5),
++ SENSOR_ATTR(fan6_input, S_IRUGO, show_fan, NULL, 6),
++ SENSOR_ATTR(fan7_input, S_IRUGO, show_fan, NULL, 7),
++};
++static struct sensor_device_attribute sda_fan_min[] = {
++ SENSOR_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 1),
++ SENSOR_ATTR(fan2_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 2),
++ SENSOR_ATTR(fan3_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 3),
++ SENSOR_ATTR(fan4_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 4),
++ SENSOR_ATTR(fan5_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 5),
++ SENSOR_ATTR(fan6_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 6),
++ SENSOR_ATTR(fan7_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 7),
++};
++static struct sensor_device_attribute sda_fan_div[] = {
++ SENSOR_ATTR(fan1_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 1),
++ SENSOR_ATTR(fan2_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 2),
++ SENSOR_ATTR(fan3_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 3),
++ SENSOR_ATTR(fan4_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 4),
++ SENSOR_ATTR(fan5_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 5),
++ SENSOR_ATTR(fan6_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 6),
++ SENSOR_ATTR(fan7_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 7),
++};
+
+
+ /* read/write the temperature1, includes measured value and limits */
+@@ -539,21 +554,6 @@ static ssize_t store_temp1(struct device
+ return count;
+ }
+
+-
+-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0);
+-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp1,
+- store_temp1, 1);
+-static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp1,
+- store_temp1, 2);
+-
+-#define device_create_file_temp1(client) \
+-do { \
+-device_create_file(&client->dev, &sensor_dev_attr_temp1_input.dev_attr); \
+-device_create_file(&client->dev, &sensor_dev_attr_temp1_max.dev_attr); \
+-device_create_file(&client->dev, &sensor_dev_attr_temp1_max_hyst.dev_attr); \
+-} while (0)
+-
+-
+ /* read/write the temperature2-3, includes measured value and limits */
+
+ static ssize_t show_temp23(struct device *dev, struct device_attribute *attr,
+@@ -590,25 +590,23 @@ static ssize_t store_temp23(struct devic
+ return count;
+ }
+
+-#define sysfs_temp23(name,idx) \
+-static SENSOR_DEVICE_ATTR_2(name##_input, S_IRUGO, show_temp23, NULL, \
+- idx, 0); \
+-static SENSOR_DEVICE_ATTR_2(name##_max, S_IRUGO | S_IWUSR, \
+- show_temp23, store_temp23, idx, 2); \
+-static SENSOR_DEVICE_ATTR_2(name##_max_hyst, S_IRUGO | S_IWUSR, \
+- show_temp23, store_temp23, idx, 4);
+-
+-sysfs_temp23(temp2,0)
+-sysfs_temp23(temp3,1)
+-
+-#define device_create_file_temp_add(client, offset) \
+-do { \
+-device_create_file(&client->dev, &sensor_dev_attr_temp##offset##_input.dev_attr); \
+-device_create_file(&client->dev, &sensor_dev_attr_temp##offset##_max.dev_attr); \
+-device_create_file(&client->dev, \
+-&sensor_dev_attr_temp##offset##_max_hyst.dev_attr); \
+-} while (0)
+-
++static struct sensor_device_attribute_2 sda_temp_input[] = {
++ SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp1, NULL, 0, 0),
++ SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp23, NULL, 0, 0),
++ SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp23, NULL, 1, 0),
++};
++
++static struct sensor_device_attribute_2 sda_temp_max[] = {
++ SENSOR_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp1, store_temp1, 0, 1),
++ SENSOR_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp23, store_temp23, 0, 2),
++ SENSOR_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp23, store_temp23, 1, 2),
++};
++
++static struct sensor_device_attribute_2 sda_temp_max_hyst[] = {
++ SENSOR_ATTR_2(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp1, store_temp1, 0, 2),
++ SENSOR_ATTR_2(temp2_max_hyst, S_IRUGO | S_IWUSR, show_temp23, store_temp23, 0, 4),
++ SENSOR_ATTR_2(temp3_max_hyst, S_IRUGO | S_IWUSR, show_temp23, store_temp23, 1, 4),
++};
+
+ /* get reatime status of all sensors items: voltage, temp, fan */
+ static ssize_t
+@@ -620,8 +618,8 @@ show_alarms_reg(struct device *dev, stru
+
+ static
+ DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
+-#define device_create_file_alarms(client) \
+-device_create_file(&client->dev, &dev_attr_alarms);
++#define device_create_file_alarms() \
++device_create_file(dev, &dev_attr_alarms);
+
+
+
+@@ -711,26 +709,19 @@ store_pwmenable(struct device *dev, stru
+ return count;
+ }
+
+-#define sysfs_pwm(offset) \
+-static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \
+- show_pwm, store_pwm, offset); \
+-static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \
+- show_pwmenable, store_pwmenable, offset); \
+-
+-sysfs_pwm(1);
+-sysfs_pwm(2);
+-sysfs_pwm(3);
+-
+-
+-#define device_create_file_pwm(client, offset) \
+-do { \
+-device_create_file(&client->dev, &sensor_dev_attr_pwm##offset.dev_attr); \
+-} while (0)
+-
+-#define device_create_file_pwmenable(client, offset) \
+-do { \
+-device_create_file(&client->dev, &sensor_dev_attr_pwm##offset##_enable.dev_attr); \
+-} while (0)
++static struct sensor_device_attribute sda_pwm[] = {
++ SENSOR_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1),
++ SENSOR_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 2),
++ SENSOR_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 3),
++};
++static struct sensor_device_attribute sda_pwm_enable[] = {
++ SENSOR_ATTR(pwm1_enable, S_IWUSR | S_IRUGO,
++ show_pwmenable, store_pwmenable, 1),
++ SENSOR_ATTR(pwm2_enable, S_IWUSR | S_IRUGO,
++ show_pwmenable, store_pwmenable, 2),
++ SENSOR_ATTR(pwm3_enable, S_IWUSR | S_IRUGO,
++ show_pwmenable, store_pwmenable, 3),
++};
+
+
+ static ssize_t
+@@ -764,18 +755,14 @@ store_pwm_mode(struct device *dev, struc
+ return count;
+ }
+
+-#define sysfs_pwm_mode(offset) \
+-static SENSOR_DEVICE_ATTR(pwm##offset##_mode, S_IRUGO | S_IWUSR, \
+- show_pwm_mode, store_pwm_mode, offset);
+-
+-sysfs_pwm_mode(1);
+-sysfs_pwm_mode(2);
+-sysfs_pwm_mode(3);
+-
+-#define device_create_file_pwm_mode(client, offset) \
+-do { \
+-device_create_file(&client->dev, &sensor_dev_attr_pwm##offset##_mode.dev_attr); \
+-} while (0)
++static struct sensor_device_attribute sda_pwm_mode[] = {
++ SENSOR_ATTR(pwm1_mode, S_IWUSR | S_IRUGO,
++ show_pwm_mode, store_pwm_mode, 1),
++ SENSOR_ATTR(pwm2_mode, S_IWUSR | S_IRUGO,
++ show_pwm_mode, store_pwm_mode, 2),
++ SENSOR_ATTR(pwm3_mode, S_IWUSR | S_IRUGO,
++ show_pwm_mode, store_pwm_mode, 3),
++};
+
+
+ static ssize_t
+@@ -788,9 +775,9 @@ show_regs_chassis(struct device *dev, st
+
+ static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL);
+
+-#define device_create_file_chassis(client) \
++#define device_create_file_chassis() \
+ do { \
+-device_create_file(&client->dev, &dev_attr_chassis); \
++device_create_file(dev, &dev_attr_chassis); \
+ } while (0)
+
+
+@@ -824,9 +811,9 @@ store_chassis_clear(struct device *dev,
+ static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR,
+ show_chassis_clear, store_chassis_clear);
+
+-#define device_create_file_chassis_clear(client) \
++#define device_create_file_chassis_clear() \
+ do { \
+-device_create_file(&client->dev, &dev_attr_chassis_clear); \
++device_create_file(dev, &dev_attr_chassis_clear); \
+ } while (0)
+
+
+@@ -864,20 +851,14 @@ store_thermal_cruise(struct device *dev,
+ return count;
+ }
+
+-#define sysfs_thermal_cruise(offset) \
+-static SENSOR_DEVICE_ATTR(thermal_cruise##offset, S_IRUGO | S_IWUSR, \
+- show_thermal_cruise, store_thermal_cruise, offset);
+-
+-sysfs_thermal_cruise(1);
+-sysfs_thermal_cruise(2);
+-sysfs_thermal_cruise(3);
+-
+-#define device_create_file_thermal_cruise(client, offset) \
+-do { \
+-device_create_file(&client->dev, \
+-&sensor_dev_attr_thermal_cruise##offset.dev_attr); \
+-} while (0)
+-
++static struct sensor_device_attribute sda_thermal_cruise[] = {
++ SENSOR_ATTR(thermal_cruise1, S_IWUSR | S_IRUGO,
++ show_thermal_cruise, store_thermal_cruise, 1),
++ SENSOR_ATTR(thermal_cruise2, S_IWUSR | S_IRUGO,
++ show_thermal_cruise, store_thermal_cruise, 2),
++ SENSOR_ATTR(thermal_cruise3, S_IWUSR | S_IRUGO,
++ show_thermal_cruise, store_thermal_cruise, 3),
++};
+
+ /* For Smart Fan I/Thermal Cruise and Smart Fan II */
+ static ssize_t
+@@ -916,19 +897,14 @@ store_tolerance(struct device *dev, stru
+ return count;
+ }
+
+-#define sysfs_tolerance(offset) \
+-static SENSOR_DEVICE_ATTR(tolerance##offset, S_IRUGO | S_IWUSR, \
+- show_tolerance, store_tolerance, offset);
+-
+-sysfs_tolerance(1);
+-sysfs_tolerance(2);
+-sysfs_tolerance(3);
+-
+-#define device_create_file_tolerance(client, offset) \
+-do { \
+-device_create_file(&client->dev, &sensor_dev_attr_tolerance##offset.dev_attr); \
+-} while (0)
+-
++static struct sensor_device_attribute sda_tolerance[] = {
++ SENSOR_ATTR(tolerance1, S_IWUSR | S_IRUGO,
++ show_tolerance, store_tolerance, 1),
++ SENSOR_ATTR(tolerance2, S_IWUSR | S_IRUGO,
++ show_tolerance, store_tolerance, 2),
++ SENSOR_ATTR(tolerance3, S_IWUSR | S_IRUGO,
++ show_tolerance, store_tolerance, 3),
++};
+
+ /* For Smart Fan II */
+ static ssize_t
+@@ -964,28 +940,34 @@ store_sf2_point(struct device *dev, stru
+ return count;
+ }
+
+-#define sysfs_sf2_point(offset, index) \
+-static SENSOR_DEVICE_ATTR_2(sf2_point##offset##_fan##index, S_IRUGO | S_IWUSR, \
+- show_sf2_point, store_sf2_point, offset, index);
+-
+-sysfs_sf2_point(1, 1); /* Fan1 */
+-sysfs_sf2_point(2, 1); /* Fan1 */
+-sysfs_sf2_point(3, 1); /* Fan1 */
+-sysfs_sf2_point(4, 1); /* Fan1 */
+-sysfs_sf2_point(1, 2); /* Fan2 */
+-sysfs_sf2_point(2, 2); /* Fan2 */
+-sysfs_sf2_point(3, 2); /* Fan2 */
+-sysfs_sf2_point(4, 2); /* Fan2 */
+-sysfs_sf2_point(1, 3); /* Fan3 */
+-sysfs_sf2_point(2, 3); /* Fan3 */
+-sysfs_sf2_point(3, 3); /* Fan3 */
+-sysfs_sf2_point(4, 3); /* Fan3 */
+-
+-#define device_create_file_sf2_point(client, offset, index) \
+-do { \
+-device_create_file(&client->dev, \
+-&sensor_dev_attr_sf2_point##offset##_fan##index.dev_attr); \
+-} while (0)
++static struct sensor_device_attribute_2 sda_sf2_point[] = {
++ SENSOR_ATTR_2(sf2_point1_fan1, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 1, 1),
++ SENSOR_ATTR_2(sf2_point2_fan1, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 2, 1),
++ SENSOR_ATTR_2(sf2_point3_fan1, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 3, 1),
++ SENSOR_ATTR_2(sf2_point4_fan1, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 4, 1),
++
++ SENSOR_ATTR_2(sf2_point1_fan2, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 1, 2),
++ SENSOR_ATTR_2(sf2_point2_fan2, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 2, 2),
++ SENSOR_ATTR_2(sf2_point3_fan2, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 3, 2),
++ SENSOR_ATTR_2(sf2_point4_fan2, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 4, 2),
++
++ SENSOR_ATTR_2(sf2_point1_fan3, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 1, 3),
++ SENSOR_ATTR_2(sf2_point2_fan3, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 2, 3),
++ SENSOR_ATTR_2(sf2_point3_fan3, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 3, 3),
++ SENSOR_ATTR_2(sf2_point4_fan3, S_IRUGO | S_IWUSR,
++ show_sf2_point, store_sf2_point, 4, 3),
++};
+
+
+ static ssize_t
+@@ -1026,26 +1008,28 @@ store_sf2_level(struct device *dev, stru
+ return count;
+ }
+
+-#define sysfs_sf2_level(offset, index) \
+-static SENSOR_DEVICE_ATTR_2(sf2_level##offset##_fan##index, S_IRUGO | S_IWUSR, \
+- show_sf2_level, store_sf2_level, offset, index);
+-
+-sysfs_sf2_level(1, 1); /* Fan1 */
+-sysfs_sf2_level(2, 1); /* Fan1 */
+-sysfs_sf2_level(3, 1); /* Fan1 */
+-sysfs_sf2_level(1, 2); /* Fan2 */
+-sysfs_sf2_level(2, 2); /* Fan2 */
+-sysfs_sf2_level(3, 2); /* Fan2 */
+-sysfs_sf2_level(1, 3); /* Fan3 */
+-sysfs_sf2_level(2, 3); /* Fan3 */
+-sysfs_sf2_level(3, 3); /* Fan3 */
+-
+-#define device_create_file_sf2_level(client, offset, index) \
+-do { \
+-device_create_file(&client->dev, \
+-&sensor_dev_attr_sf2_level##offset##_fan##index.dev_attr); \
+-} while (0)
+-
++static struct sensor_device_attribute_2 sda_sf2_level[] = {
++ SENSOR_ATTR_2(sf2_level1_fan1, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 1, 1),
++ SENSOR_ATTR_2(sf2_level2_fan1, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 2, 1),
++ SENSOR_ATTR_2(sf2_level3_fan1, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 3, 1),
++
++ SENSOR_ATTR_2(sf2_level1_fan2, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 1, 2),
++ SENSOR_ATTR_2(sf2_level2_fan2, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 2, 2),
++ SENSOR_ATTR_2(sf2_level3_fan2, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 3, 2),
++
++ SENSOR_ATTR_2(sf2_level1_fan3, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 1, 3),
++ SENSOR_ATTR_2(sf2_level2_fan3, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 2, 3),
++ SENSOR_ATTR_2(sf2_level3_fan3, S_IRUGO | S_IWUSR,
++ show_sf2_level, store_sf2_level, 3, 3),
++};
+
+ /* This function is called when:
+ * w83792d_driver is inserted (when this module is loaded), for each
+@@ -1147,12 +1131,19 @@ ERROR_SC_0:
+ return err;
+ }
+
++static void device_create_file_fan(struct device *dev, int i)
++{
++ device_create_file(dev, &sda_fan_input[i].dev_attr);
++ device_create_file(dev, &sda_fan_div[i].dev_attr);
++ device_create_file(dev, &sda_fan_min[i].dev_attr);
++}
+
+ static int
+ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
+ {
+ int i = 0, val1 = 0, val2;
+- struct i2c_client *new_client;
++ struct i2c_client *client;
++ struct device *dev;
+ struct w83792d_data *data;
+ int err = 0;
+ const char *client_name = "";
+@@ -1170,12 +1161,13 @@ w83792d_detect(struct i2c_adapter *adapt
+ goto ERROR0;
+ }
+
+- new_client = &data->client;
+- i2c_set_clientdata(new_client, data);
+- new_client->addr = address;
+- new_client->adapter = adapter;
+- new_client->driver = &w83792d_driver;
+- new_client->flags = 0;
++ client = &data->client;
++ dev = &client->dev;
++ i2c_set_clientdata(client, data);
++ client->addr = address;
++ client->adapter = adapter;
++ client->driver = &w83792d_driver;
++ client->flags = 0;
+
+ /* Now, we do the remaining detection. */
+
+@@ -1184,13 +1176,12 @@ w83792d_detect(struct i2c_adapter *adapt
+ force_*=... parameter, and the Winbond will be reset to the right
+ bank. */
+ if (kind < 0) {
+- if (w83792d_read_value(new_client, W83792D_REG_CONFIG) & 0x80) {
+- dev_warn(&new_client->dev, "Detection failed at step "
+- "3\n");
++ if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) {
++ dev_warn(dev, "Detection failed at step 3\n");
+ goto ERROR1;
+ }
+- val1 = w83792d_read_value(new_client, W83792D_REG_BANK);
+- val2 = w83792d_read_value(new_client, W83792D_REG_CHIPMAN);
++ val1 = w83792d_read_value(client, W83792D_REG_BANK);
++ val2 = w83792d_read_value(client, W83792D_REG_CHIPMAN);
+ /* Check for Winbond ID if in bank 0 */
+ if (!(val1 & 0x07)) { /* is Bank0 */
+ if (((!(val1 & 0x80)) && (val2 != 0xa3)) ||
+@@ -1200,34 +1191,33 @@ w83792d_detect(struct i2c_adapter *adapt
+ }
+ /* If Winbond chip, address of chip and W83792D_REG_I2C_ADDR
+ should match */
+- if (w83792d_read_value(new_client,
++ if (w83792d_read_value(client,
+ W83792D_REG_I2C_ADDR) != address) {
+- dev_warn(&new_client->dev, "Detection failed "
+- "at step 5\n");
++ dev_warn(dev, "Detection failed at step 5\n");
+ goto ERROR1;
+ }
+ }
+
+ /* We have either had a force parameter, or we have already detected the
+ Winbond. Put it now into bank 0 and Vendor ID High Byte */
+- w83792d_write_value(new_client,
++ w83792d_write_value(client,
+ W83792D_REG_BANK,
+- (w83792d_read_value(new_client,
++ (w83792d_read_value(client,
+ W83792D_REG_BANK) & 0x78) | 0x80);
+
+ /* Determine the chip type. */
+ if (kind <= 0) {
+ /* get vendor ID */
+- val2 = w83792d_read_value(new_client, W83792D_REG_CHIPMAN);
++ val2 = w83792d_read_value(client, W83792D_REG_CHIPMAN);
+ if (val2 != 0x5c) { /* the vendor is NOT Winbond */
+ goto ERROR1;
+ }
+- val1 = w83792d_read_value(new_client, W83792D_REG_WCHIPID);
++ val1 = w83792d_read_value(client, W83792D_REG_WCHIPID);
+ if (val1 == 0x7a) {
+ kind = w83792d;
+ } else {
+ if (kind == 0)
+- dev_warn(&new_client->dev,
++ dev_warn(dev,
+ "w83792d: Ignoring 'force' parameter for"
+ " unknown chip at adapter %d, address"
+ " 0x%02x\n", i2c_adapter_id(adapter),
+@@ -1239,120 +1229,87 @@ w83792d_detect(struct i2c_adapter *adapt
+ if (kind == w83792d) {
+ client_name = "w83792d";
+ } else {
+- dev_err(&new_client->dev, "w83792d: Internal error: unknown"
++ dev_err(dev, "w83792d: Internal error: unknown"
+ " kind (%d)?!?", kind);
+ goto ERROR1;
+ }
+
+ /* Fill in the remaining client fields and put into the global list */
+- strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
++ strlcpy(client->name, client_name, I2C_NAME_SIZE);
+ data->type = kind;
+
+ data->valid = 0;
+ init_MUTEX(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+- if ((err = i2c_attach_client(new_client)))
++ if ((err = i2c_attach_client(client)))
+ goto ERROR1;
+
+ if ((err = w83792d_detect_subclients(adapter, address,
+- kind, new_client)))
++ kind, client)))
+ goto ERROR2;
+
+ /* Initialize the chip */
+- w83792d_init_client(new_client);
++ w83792d_init_client(client);
+
+ /* A few vars need to be filled upon startup */
+ for (i = 0; i < 7; i++) {
+- data->fan_min[i] = w83792d_read_value(new_client,
++ data->fan_min[i] = w83792d_read_value(client,
+ W83792D_REG_FAN_MIN[i]);
+ }
+
+ /* Register sysfs hooks */
+- data->class_dev = hwmon_device_register(&new_client->dev);
++ data->class_dev = hwmon_device_register(dev);
+ if (IS_ERR(data->class_dev)) {
+ err = PTR_ERR(data->class_dev);
+ goto ERROR3;
+ }
+- device_create_file_in(new_client, 0);
+- device_create_file_in(new_client, 1);
+- device_create_file_in(new_client, 2);
+- device_create_file_in(new_client, 3);
+- device_create_file_in(new_client, 4);
+- device_create_file_in(new_client, 5);
+- device_create_file_in(new_client, 6);
+- device_create_file_in(new_client, 7);
+- device_create_file_in(new_client, 8);
+-
+- device_create_file_fan(new_client, 1);
+- device_create_file_fan(new_client, 2);
+- device_create_file_fan(new_client, 3);
++ for (i = 0; i < 9; i++) {
++ device_create_file(dev, &sda_in_input[i].dev_attr);
++ device_create_file(dev, &sda_in_max[i].dev_attr);
++ device_create_file(dev, &sda_in_min[i].dev_attr);
++ }
++ for (i = 0; i < 3; i++)
++ device_create_file_fan(dev, i);
+
+ /* Read GPIO enable register to check if pins for fan 4,5 are used as
+ GPIO */
+- val1 = w83792d_read_value(new_client, W83792D_REG_GPIO_EN);
++ val1 = w83792d_read_value(client, W83792D_REG_GPIO_EN);
+ if (!(val1 & 0x40))
+- device_create_file_fan(new_client, 4);
++ device_create_file_fan(dev, 3);
+ if (!(val1 & 0x20))
+- device_create_file_fan(new_client, 5);
++ device_create_file_fan(dev, 4);
+
+- val1 = w83792d_read_value(new_client, W83792D_REG_PIN);
++ val1 = w83792d_read_value(client, W83792D_REG_PIN);
+ if (val1 & 0x40)
+- device_create_file_fan(new_client, 6);
++ device_create_file_fan(dev, 5);
+ if (val1 & 0x04)
+- device_create_file_fan(new_client, 7);
++ device_create_file_fan(dev, 6);
++
++ for (i = 0; i < 3; i++) {
++ device_create_file(dev, &sda_temp_input[i].dev_attr);
++ device_create_file(dev, &sda_temp_max[i].dev_attr);
++ device_create_file(dev, &sda_temp_max_hyst[i].dev_attr);
++ device_create_file(dev, &sda_thermal_cruise[i].dev_attr);
++ device_create_file(dev, &sda_tolerance[i].dev_attr);
++ }
++
++ device_create_file_alarms();
++
++ for (i = 0; i < ARRAY_SIZE(sda_pwm); i++) {
++ device_create_file(dev, &sda_pwm[i].dev_attr);
++ device_create_file(dev, &sda_pwm_enable[i].dev_attr);
++ device_create_file(dev, &sda_pwm_mode[i].dev_attr);
++ }
++
++ device_create_file_chassis();
++ device_create_file_chassis_clear();
++
++ for (i = 0; i < ARRAY_SIZE(sda_sf2_point); i++)
++ device_create_file(dev, &sda_sf2_point[i].dev_attr);
+
+- device_create_file_temp1(new_client); /* Temp1 */
+- device_create_file_temp_add(new_client, 2); /* Temp2 */
+- device_create_file_temp_add(new_client, 3); /* Temp3 */
+-
+- device_create_file_alarms(new_client);
+-
+- device_create_file_pwm(new_client, 1);
+- device_create_file_pwm(new_client, 2);
+- device_create_file_pwm(new_client, 3);
+-
+- device_create_file_pwmenable(new_client, 1);
+- device_create_file_pwmenable(new_client, 2);
+- device_create_file_pwmenable(new_client, 3);
+-
+- device_create_file_pwm_mode(new_client, 1);
+- device_create_file_pwm_mode(new_client, 2);
+- device_create_file_pwm_mode(new_client, 3);
+-
+- device_create_file_chassis(new_client);
+- device_create_file_chassis_clear(new_client);
+-
+- device_create_file_thermal_cruise(new_client, 1);
+- device_create_file_thermal_cruise(new_client, 2);
+- device_create_file_thermal_cruise(new_client, 3);
+-
+- device_create_file_tolerance(new_client, 1);
+- device_create_file_tolerance(new_client, 2);
+- device_create_file_tolerance(new_client, 3);
+-
+- device_create_file_sf2_point(new_client, 1, 1); /* Fan1 */
+- device_create_file_sf2_point(new_client, 2, 1); /* Fan1 */
+- device_create_file_sf2_point(new_client, 3, 1); /* Fan1 */
+- device_create_file_sf2_point(new_client, 4, 1); /* Fan1 */
+- device_create_file_sf2_point(new_client, 1, 2); /* Fan2 */
+- device_create_file_sf2_point(new_client, 2, 2); /* Fan2 */
+- device_create_file_sf2_point(new_client, 3, 2); /* Fan2 */
+- device_create_file_sf2_point(new_client, 4, 2); /* Fan2 */
+- device_create_file_sf2_point(new_client, 1, 3); /* Fan3 */
+- device_create_file_sf2_point(new_client, 2, 3); /* Fan3 */
+- device_create_file_sf2_point(new_client, 3, 3); /* Fan3 */
+- device_create_file_sf2_point(new_client, 4, 3); /* Fan3 */
+-
+- device_create_file_sf2_level(new_client, 1, 1); /* Fan1 */
+- device_create_file_sf2_level(new_client, 2, 1); /* Fan1 */
+- device_create_file_sf2_level(new_client, 3, 1); /* Fan1 */
+- device_create_file_sf2_level(new_client, 1, 2); /* Fan2 */
+- device_create_file_sf2_level(new_client, 2, 2); /* Fan2 */
+- device_create_file_sf2_level(new_client, 3, 2); /* Fan2 */
+- device_create_file_sf2_level(new_client, 1, 3); /* Fan3 */
+- device_create_file_sf2_level(new_client, 2, 3); /* Fan3 */
+- device_create_file_sf2_level(new_client, 3, 3); /* Fan3 */
++ for (i = 0; i < ARRAY_SIZE(sda_sf2_level); i++)
++ device_create_file(dev, &sda_sf2_level[i].dev_attr);
+
+ return 0;
+
+@@ -1366,7 +1323,7 @@ ERROR3:
+ kfree(data->lm75[1]);
+ }
+ ERROR2:
+- i2c_detach_client(new_client);
++ i2c_detach_client(client);
+ ERROR1:
+ kfree(data);
+ ERROR0:
diff --git a/i2c/i2c-convert-semaphores-to-mutexes-2.patch b/i2c/i2c-convert-semaphores-to-mutexes-2.patch
new file mode 100644
index 00000000000000..e886211da7dae6
--- /dev/null
+++ b/i2c/i2c-convert-semaphores-to-mutexes-2.patch
@@ -0,0 +1,596 @@
+From khali@linux-fr.org Wed Jan 18 14:15:18 2006
+Date: Wed, 18 Jan 2006 23:16:04 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ingo Molnar <mingo@elte.hu>
+Subject: [PATCH 13/17] i2c: Semaphore to mutex conversions, part 2
+Message-Id: <20060118231604.2b07615c.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-convert-semaphores-to-mutexes-2.patch
+
+From: Ingo Molnar <mingo@elte.hu>
+
+semaphore to mutex conversion.
+
+the conversion was generated via scripts, and the result was validated
+automatically via a script as well.
+
+build tested.
+
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+----
+ drivers/i2c/busses/i2c-amd756-s4882.c | 13 +++++----
+ drivers/i2c/busses/i2c-isa.c | 2 -
+ drivers/i2c/chips/eeprom.c | 9 +++---
+ drivers/i2c/chips/max6875.c | 10 +++----
+ drivers/i2c/chips/pcf8591.c | 13 +++++----
+ drivers/i2c/chips/tps65010.c | 45 +++++++++++++++++-----------------
+ drivers/i2c/i2c-core.c | 34 ++++++++++++-------------
+ include/linux/i2c.h | 6 ++--
+ 8 files changed, 68 insertions(+), 64 deletions(-)
+
+---
+--- gregkh-2.6.orig/drivers/i2c/busses/i2c-amd756-s4882.c
++++ gregkh-2.6/drivers/i2c/busses/i2c-amd756-s4882.c
+@@ -38,6 +38,7 @@
+ #include <linux/slab.h>
+ #include <linux/init.h>
+ #include <linux/i2c.h>
++#include <linux/mutex.h>
+
+ extern struct i2c_adapter amd756_smbus;
+
+@@ -45,7 +46,7 @@ static struct i2c_adapter *s4882_adapter
+ static struct i2c_algorithm *s4882_algo;
+
+ /* Wrapper access functions for multiplexed SMBus */
+-static struct semaphore amd756_lock;
++static struct mutex amd756_lock;
+
+ static s32 amd756_access_virt0(struct i2c_adapter * adap, u16 addr,
+ unsigned short flags, char read_write,
+@@ -59,12 +60,12 @@ static s32 amd756_access_virt0(struct i2
+ || addr == 0x18)
+ return -1;
+
+- down(&amd756_lock);
++ mutex_lock(&amd756_lock);
+
+ error = amd756_smbus.algo->smbus_xfer(adap, addr, flags, read_write,
+ command, size, data);
+
+- up(&amd756_lock);
++ mutex_unlock(&amd756_lock);
+
+ return error;
+ }
+@@ -87,7 +88,7 @@ static inline s32 amd756_access_channel(
+ if (addr != 0x4c && (addr & 0xfc) != 0x50 && (addr & 0xfc) != 0x30)
+ return -1;
+
+- down(&amd756_lock);
++ mutex_lock(&amd756_lock);
+
+ if (last_channels != channels) {
+ union i2c_smbus_data mplxdata;
+@@ -105,7 +106,7 @@ static inline s32 amd756_access_channel(
+ command, size, data);
+
+ UNLOCK:
+- up(&amd756_lock);
++ mutex_unlock(&amd756_lock);
+ return error;
+ }
+
+@@ -166,7 +167,7 @@ static int __init amd756_s4882_init(void
+ }
+
+ printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n");
+- init_MUTEX(&amd756_lock);
++ mutex_init(&amd756_lock);
+
+ /* Define the 5 virtual adapters and algorithms structures */
+ if (!(s4882_adapter = kzalloc(5 * sizeof(struct i2c_adapter),
+--- gregkh-2.6.orig/drivers/i2c/busses/i2c-isa.c
++++ gregkh-2.6/drivers/i2c/busses/i2c-isa.c
+@@ -137,7 +137,7 @@ int i2c_isa_del_driver(struct i2c_driver
+
+ static int __init i2c_isa_init(void)
+ {
+- init_MUTEX(&isa_adapter.clist_lock);
++ mutex_init(&isa_adapter.clist_lock);
+ INIT_LIST_HEAD(&isa_adapter.clients);
+
+ isa_adapter.nr = ANY_I2C_ISA_BUS;
+--- gregkh-2.6.orig/drivers/i2c/chips/eeprom.c
++++ gregkh-2.6/drivers/i2c/chips/eeprom.c
+@@ -33,6 +33,7 @@
+ #include <linux/sched.h>
+ #include <linux/jiffies.h>
+ #include <linux/i2c.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
+@@ -54,7 +55,7 @@ enum eeprom_nature {
+ /* Each client has this additional data */
+ struct eeprom_data {
+ struct i2c_client client;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+ u8 valid; /* bitfield, bit!=0 if slice is valid */
+ unsigned long last_updated[8]; /* In jiffies, 8 slices */
+ u8 data[EEPROM_SIZE]; /* Register values */
+@@ -81,7 +82,7 @@ static void eeprom_update_client(struct
+ struct eeprom_data *data = i2c_get_clientdata(client);
+ int i, j;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if (!(data->valid & (1 << slice)) ||
+ time_after(jiffies, data->last_updated[slice] + 300 * HZ)) {
+@@ -107,7 +108,7 @@ static void eeprom_update_client(struct
+ data->valid |= (1 << slice);
+ }
+ exit:
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+
+ static ssize_t eeprom_read(struct kobject *kobj, char *buf, loff_t off, size_t count)
+@@ -187,7 +188,7 @@ static int eeprom_detect(struct i2c_adap
+ /* Fill in the remaining client fields */
+ strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE);
+ data->valid = 0;
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+ data->nature = UNKNOWN;
+
+ /* Tell the I2C layer a new client has arrived */
+--- gregkh-2.6.orig/drivers/i2c/chips/max6875.c
++++ gregkh-2.6/drivers/i2c/chips/max6875.c
+@@ -31,7 +31,7 @@
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/i2c.h>
+-#include <asm/semaphore.h>
++#include <linux/mutex.h>
+
+ /* Do not scan - the MAX6875 access method will write to some EEPROM chips */
+ static unsigned short normal_i2c[] = {I2C_CLIENT_END};
+@@ -54,7 +54,7 @@ I2C_CLIENT_INSMOD_1(max6875);
+ /* Each client has this additional data */
+ struct max6875_data {
+ struct i2c_client client;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+
+ u32 valid;
+ u8 data[USER_EEPROM_SIZE];
+@@ -83,7 +83,7 @@ static void max6875_update_slice(struct
+ if (slice >= USER_EEPROM_SLICES)
+ return;
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ buf = &data->data[slice << SLICE_BITS];
+
+@@ -122,7 +122,7 @@ static void max6875_update_slice(struct
+ data->valid |= (1 << slice);
+ }
+ exit_up:
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ }
+
+ static ssize_t max6875_read(struct kobject *kobj, char *buf, loff_t off,
+@@ -196,7 +196,7 @@ static int max6875_detect(struct i2c_ada
+ real_client->driver = &max6875_driver;
+ real_client->flags = 0;
+ strlcpy(real_client->name, "max6875", I2C_NAME_SIZE);
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Init fake client data */
+ /* set the client data to the i2c_client so that it will get freed */
+--- gregkh-2.6.orig/drivers/i2c/chips/pcf8591.c
++++ gregkh-2.6/drivers/i2c/chips/pcf8591.c
+@@ -24,6 +24,7 @@
+ #include <linux/init.h>
+ #include <linux/slab.h>
+ #include <linux/i2c.h>
++#include <linux/mutex.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
+@@ -74,7 +75,7 @@ MODULE_PARM_DESC(input_mode,
+
+ struct pcf8591_data {
+ struct i2c_client client;
+- struct semaphore update_lock;
++ struct mutex update_lock;
+
+ u8 control;
+ u8 aout;
+@@ -144,13 +145,13 @@ static ssize_t set_out0_enable(struct de
+ struct pcf8591_data *data = i2c_get_clientdata(client);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+ if (val)
+ data->control |= PCF8591_CONTROL_AOEF;
+ else
+ data->control &= ~PCF8591_CONTROL_AOEF;
+ i2c_smbus_write_byte(client, data->control);
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+ return count;
+ }
+
+@@ -200,7 +201,7 @@ static int pcf8591_detect(struct i2c_ada
+ /* Fill in the remaining client fields and put it into the global
+ list */
+ strlcpy(new_client->name, "pcf8591", I2C_NAME_SIZE);
+- init_MUTEX(&data->update_lock);
++ mutex_init(&data->update_lock);
+
+ /* Tell the I2C layer a new client has arrived */
+ if ((err = i2c_attach_client(new_client)))
+@@ -265,7 +266,7 @@ static int pcf8591_read_channel(struct d
+ struct i2c_client *client = to_i2c_client(dev);
+ struct pcf8591_data *data = i2c_get_clientdata(client);
+
+- down(&data->update_lock);
++ mutex_lock(&data->update_lock);
+
+ if ((data->control & PCF8591_CONTROL_AICH_MASK) != channel) {
+ data->control = (data->control & ~PCF8591_CONTROL_AICH_MASK)
+@@ -278,7 +279,7 @@ static int pcf8591_read_channel(struct d
+ }
+ value = i2c_smbus_read_byte(client);
+
+- up(&data->update_lock);
++ mutex_unlock(&data->update_lock);
+
+ if ((channel == 2 && input_mode == 2) ||
+ (channel != 3 && (input_mode == 1 || input_mode == 3)))
+--- gregkh-2.6.orig/drivers/i2c/chips/tps65010.c
++++ gregkh-2.6/drivers/i2c/chips/tps65010.c
+@@ -32,6 +32,7 @@
+ #include <linux/suspend.h>
+ #include <linux/debugfs.h>
+ #include <linux/seq_file.h>
++#include <linux/mutex.h>
+
+ #include <asm/irq.h>
+ #include <asm/mach-types.h>
+@@ -81,7 +82,7 @@ enum tps_model {
+
+ struct tps65010 {
+ struct i2c_client client;
+- struct semaphore lock;
++ struct mutex lock;
+ int irq;
+ struct work_struct work;
+ struct dentry *file;
+@@ -218,7 +219,7 @@ static int dbg_show(struct seq_file *s,
+ seq_printf(s, "driver %s\nversion %s\nchip %s\n\n",
+ DRIVER_NAME, DRIVER_VERSION, chip);
+
+- down(&tps->lock);
++ mutex_lock(&tps->lock);
+
+ /* FIXME how can we tell whether a battery is present?
+ * likely involves a charge gauging chip (like BQ26501).
+@@ -300,7 +301,7 @@ static int dbg_show(struct seq_file *s,
+ (v2 & (1 << (4 + i))) ? "rising" : "falling");
+ }
+
+- up(&tps->lock);
++ mutex_unlock(&tps->lock);
+ return 0;
+ }
+
+@@ -416,7 +417,7 @@ static void tps65010_work(void *_tps)
+ {
+ struct tps65010 *tps = _tps;
+
+- down(&tps->lock);
++ mutex_lock(&tps->lock);
+
+ tps65010_interrupt(tps);
+
+@@ -444,7 +445,7 @@ static void tps65010_work(void *_tps)
+ if (test_and_clear_bit(FLAG_IRQ_ENABLE, &tps->flags))
+ enable_irq(tps->irq);
+
+- up(&tps->lock);
++ mutex_unlock(&tps->lock);
+ }
+
+ static irqreturn_t tps65010_irq(int irq, void *_tps, struct pt_regs *regs)
+@@ -505,7 +506,7 @@ tps65010_probe(struct i2c_adapter *bus,
+ if (!tps)
+ return 0;
+
+- init_MUTEX(&tps->lock);
++ mutex_init(&tps->lock);
+ INIT_WORK(&tps->work, tps65010_work, tps);
+ tps->irq = -1;
+ tps->client.addr = address;
+@@ -695,7 +696,7 @@ int tps65010_set_gpio_out_value(unsigned
+ if ((gpio < GPIO1) || (gpio > GPIO4))
+ return -EINVAL;
+
+- down(&the_tps->lock);
++ mutex_lock(&the_tps->lock);
+
+ defgpio = i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO);
+
+@@ -720,7 +721,7 @@ int tps65010_set_gpio_out_value(unsigned
+ gpio, value ? "high" : "low",
+ i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO));
+
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+ return status;
+ }
+ EXPORT_SYMBOL(tps65010_set_gpio_out_value);
+@@ -745,7 +746,7 @@ int tps65010_set_led(unsigned led, unsig
+ led = LED2;
+ }
+
+- down(&the_tps->lock);
++ mutex_lock(&the_tps->lock);
+
+ pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led,
+ i2c_smbus_read_byte_data(&the_tps->client,
+@@ -771,7 +772,7 @@ int tps65010_set_led(unsigned led, unsig
+ default:
+ printk(KERN_ERR "%s: Wrong mode parameter for set_led()\n",
+ DRIVER_NAME);
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+ return -EINVAL;
+ }
+
+@@ -781,7 +782,7 @@ int tps65010_set_led(unsigned led, unsig
+ if (status != 0) {
+ printk(KERN_ERR "%s: Failed to write led%i_on register\n",
+ DRIVER_NAME, led);
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+ return status;
+ }
+
+@@ -794,7 +795,7 @@ int tps65010_set_led(unsigned led, unsig
+ if (status != 0) {
+ printk(KERN_ERR "%s: Failed to write led%i_per register\n",
+ DRIVER_NAME, led);
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+ return status;
+ }
+
+@@ -802,7 +803,7 @@ int tps65010_set_led(unsigned led, unsig
+ i2c_smbus_read_byte_data(&the_tps->client,
+ TPS_LED1_PER + offs));
+
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+
+ return status;
+ }
+@@ -820,7 +821,7 @@ int tps65010_set_vib(unsigned value)
+ if (!the_tps)
+ return -ENODEV;
+
+- down(&the_tps->lock);
++ mutex_lock(&the_tps->lock);
+
+ vdcdc2 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC2);
+ vdcdc2 &= ~(1 << 1);
+@@ -831,7 +832,7 @@ int tps65010_set_vib(unsigned value)
+
+ pr_debug("%s: vibrator %s\n", DRIVER_NAME, value ? "on" : "off");
+
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+ return status;
+ }
+ EXPORT_SYMBOL(tps65010_set_vib);
+@@ -848,7 +849,7 @@ int tps65010_set_low_pwr(unsigned mode)
+ if (!the_tps)
+ return -ENODEV;
+
+- down(&the_tps->lock);
++ mutex_lock(&the_tps->lock);
+
+ pr_debug("%s: %s low_pwr, vdcdc1 0x%02x\n", DRIVER_NAME,
+ mode ? "enable" : "disable",
+@@ -876,7 +877,7 @@ int tps65010_set_low_pwr(unsigned mode)
+ pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
+ i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
+
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+
+ return status;
+ }
+@@ -894,7 +895,7 @@ int tps65010_config_vregs1(unsigned valu
+ if (!the_tps)
+ return -ENODEV;
+
+- down(&the_tps->lock);
++ mutex_lock(&the_tps->lock);
+
+ pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
+ i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
+@@ -909,7 +910,7 @@ int tps65010_config_vregs1(unsigned valu
+ pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
+ i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
+
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+
+ return status;
+ }
+@@ -931,7 +932,7 @@ int tps65013_set_low_pwr(unsigned mode)
+ if (!the_tps || the_tps->por)
+ return -ENODEV;
+
+- down(&the_tps->lock);
++ mutex_lock(&the_tps->lock);
+
+ pr_debug("%s: %s low_pwr, chgconfig 0x%02x vdcdc1 0x%02x\n",
+ DRIVER_NAME,
+@@ -959,7 +960,7 @@ int tps65013_set_low_pwr(unsigned mode)
+ if (status != 0) {
+ printk(KERN_ERR "%s: Failed to write chconfig register\n",
+ DRIVER_NAME);
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+ return status;
+ }
+
+@@ -977,7 +978,7 @@ int tps65013_set_low_pwr(unsigned mode)
+ pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
+ i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
+
+- up(&the_tps->lock);
++ mutex_unlock(&the_tps->lock);
+
+ return status;
+ }
+--- gregkh-2.6.orig/drivers/i2c/i2c-core.c
++++ gregkh-2.6/drivers/i2c/i2c-core.c
+@@ -169,8 +169,8 @@ int i2c_add_adapter(struct i2c_adapter *
+ }
+
+ adap->nr = id & MAX_ID_MASK;
+- init_MUTEX(&adap->bus_lock);
+- init_MUTEX(&adap->clist_lock);
++ mutex_init(&adap->bus_lock);
++ mutex_init(&adap->clist_lock);
+ list_add_tail(&adap->list,&adapters);
+ INIT_LIST_HEAD(&adap->clients);
+
+@@ -385,9 +385,9 @@ int i2c_check_addr(struct i2c_adapter *a
+ {
+ int rval;
+
+- down(&adapter->clist_lock);
++ mutex_lock(&adapter->clist_lock);
+ rval = __i2c_check_addr(adapter, addr);
+- up(&adapter->clist_lock);
++ mutex_unlock(&adapter->clist_lock);
+
+ return rval;
+ }
+@@ -396,13 +396,13 @@ int i2c_attach_client(struct i2c_client
+ {
+ struct i2c_adapter *adapter = client->adapter;
+
+- down(&adapter->clist_lock);
++ mutex_lock(&adapter->clist_lock);
+ if (__i2c_check_addr(client->adapter, client->addr)) {
+- up(&adapter->clist_lock);
++ mutex_unlock(&adapter->clist_lock);
+ return -EBUSY;
+ }
+ list_add_tail(&client->list,&adapter->clients);
+- up(&adapter->clist_lock);
++ mutex_unlock(&adapter->clist_lock);
+
+ if (adapter->client_register) {
+ if (adapter->client_register(client)) {
+@@ -451,12 +451,12 @@ int i2c_detach_client(struct i2c_client
+ }
+ }
+
+- down(&adapter->clist_lock);
++ mutex_lock(&adapter->clist_lock);
+ list_del(&client->list);
+ init_completion(&client->released);
+ device_remove_file(&client->dev, &dev_attr_client_name);
+ device_unregister(&client->dev);
+- up(&adapter->clist_lock);
++ mutex_unlock(&adapter->clist_lock);
+ wait_for_completion(&client->released);
+
+ out:
+@@ -514,19 +514,19 @@ void i2c_clients_command(struct i2c_adap
+ struct list_head *item;
+ struct i2c_client *client;
+
+- down(&adap->clist_lock);
++ mutex_lock(&adap->clist_lock);
+ list_for_each(item,&adap->clients) {
+ client = list_entry(item, struct i2c_client, list);
+ if (!try_module_get(client->driver->driver.owner))
+ continue;
+ if (NULL != client->driver->command) {
+- up(&adap->clist_lock);
++ mutex_unlock(&adap->clist_lock);
+ client->driver->command(client,cmd,arg);
+- down(&adap->clist_lock);
++ mutex_lock(&adap->clist_lock);
+ }
+ module_put(client->driver->driver.owner);
+ }
+- up(&adap->clist_lock);
++ mutex_unlock(&adap->clist_lock);
+ }
+
+ static int __init i2c_init(void)
+@@ -570,9 +570,9 @@ int i2c_transfer(struct i2c_adapter * ad
+ }
+ #endif
+
+- down(&adap->bus_lock);
++ mutex_lock(&adap->bus_lock);
+ ret = adap->algo->master_xfer(adap,msgs,num);
+- up(&adap->bus_lock);
++ mutex_unlock(&adap->bus_lock);
+
+ return ret;
+ } else {
+@@ -1116,10 +1116,10 @@ s32 i2c_smbus_xfer(struct i2c_adapter *
+ flags &= I2C_M_TEN | I2C_CLIENT_PEC;
+
+ if (adapter->algo->smbus_xfer) {
+- down(&adapter->bus_lock);
++ mutex_lock(&adapter->bus_lock);
+ res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write,
+ command,size,data);
+- up(&adapter->bus_lock);
++ mutex_unlock(&adapter->bus_lock);
+ } else
+ res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write,
+ command,size,data);
+--- gregkh-2.6.orig/include/linux/i2c.h
++++ gregkh-2.6/include/linux/i2c.h
+@@ -32,7 +32,7 @@
+ #include <linux/mod_devicetable.h>
+ #include <linux/device.h> /* for struct device */
+ #include <linux/sched.h> /* for completion */
+-#include <asm/semaphore.h>
++#include <linux/mutex.h>
+
+ /* --- For i2c-isa ---------------------------------------------------- */
+
+@@ -225,8 +225,8 @@ struct i2c_adapter {
+ int (*client_unregister)(struct i2c_client *);
+
+ /* data fields that are valid for all devices */
+- struct semaphore bus_lock;
+- struct semaphore clist_lock;
++ struct mutex bus_lock;
++ struct mutex clist_lock;
+
+ int timeout;
+ int retries;
diff --git a/i2c/i2c-convert-semaphores-to-mutexes-3.patch b/i2c/i2c-convert-semaphores-to-mutexes-3.patch
new file mode 100644
index 00000000000000..ff294c3987b2de
--- /dev/null
+++ b/i2c/i2c-convert-semaphores-to-mutexes-3.patch
@@ -0,0 +1,87 @@
+From khali@linux-fr.org Wed Jan 18 14:16:14 2006
+Date: Wed, 18 Jan 2006 23:17:01 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ingo Molnar <mingo@elte.hu>
+Subject: [PATCH 14/17] i2c: Semaphore to mutex conversions, part 3
+Message-Id: <20060118231701.3d26b007.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-convert-semaphores-to-mutexes-3.patch
+
+Cleanup after the semaphores to mutexes conversions in the i2c
+subsystem.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/i2c/busses/i2c-ali1535.c | 1 -
+ drivers/i2c/busses/i2c-pxa.c | 2 +-
+ drivers/i2c/busses/scx200_acb.c | 9 +++++----
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/i2c-ali1535.c
++++ gregkh-2.6/drivers/i2c/busses/i2c-ali1535.c
+@@ -64,7 +64,6 @@
+ #include <linux/init.h>
+ #include <linux/mutex.h>
+ #include <asm/io.h>
+-#include <asm/semaphore.h>
+
+
+ /* ALI1535 SMBus address offsets */
+--- gregkh-2.6.orig/drivers/i2c/busses/i2c-pxa.c
++++ gregkh-2.6/drivers/i2c/busses/i2c-pxa.c
+@@ -647,7 +647,7 @@ static inline void i2c_pxa_start_message
+ }
+
+ /*
+- * We are protected by the adapter bus semaphore.
++ * We are protected by the adapter bus mutex.
+ */
+ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
+ {
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -31,6 +31,7 @@
+ #include <linux/smp_lock.h>
+ #include <linux/pci.h>
+ #include <linux/delay.h>
++#include <linux/mutex.h>
+ #include <asm/io.h>
+ #include <asm/msr.h>
+
+@@ -74,7 +75,7 @@ struct scx200_acb_iface {
+ struct scx200_acb_iface *next;
+ struct i2c_adapter adapter;
+ unsigned base;
+- struct semaphore sem;
++ struct mutex mutex;
+
+ /* State machine data */
+ enum scx200_acb_state state;
+@@ -314,7 +315,7 @@ static s32 scx200_acb_smbus_xfer(struct
+ return -EINVAL;
+ }
+
+- down(&iface->sem);
++ mutex_lock(&iface->mutex);
+
+ iface->address_byte = (address << 1) | rw;
+ iface->command = command;
+@@ -338,7 +339,7 @@ static s32 scx200_acb_smbus_xfer(struct
+
+ rc = iface->result;
+
+- up(&iface->sem);
++ mutex_unlock(&iface->mutex);
+
+ if (rc == 0 && size == I2C_SMBUS_WORD_DATA && rw == I2C_SMBUS_READ)
+ data->word = le16_to_cpu(cur_word);
+@@ -431,7 +432,7 @@ static int __init scx200_acb_create(con
+ adapter->algo = &scx200_acb_algorithm;
+ adapter->class = I2C_CLASS_HWMON;
+
+- init_MUTEX(&iface->sem);
++ mutex_init(&iface->mutex);
+
+ snprintf(description, sizeof(description), "%s ACCESS.bus [%s]",
+ text, adapter->name);
diff --git a/i2c/i2c-device-id-lm75.patch b/i2c/i2c-device-id-lm75.patch
index 29a74a0fd07a0d..4cc9fc98e3b643 100644
--- a/i2c/i2c-device-id-lm75.patch
+++ b/i2c/i2c-device-id-lm75.patch
@@ -12,7 +12,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- gregkh-2.6.orig/drivers/hwmon/lm75.c
+++ gregkh-2.6/drivers/hwmon/lm75.c
-@@ -32,6 +32,19 @@
+@@ -33,6 +33,19 @@
static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
diff --git a/i2c/i2c-scx200_acb-01-whitespace.patch b/i2c/i2c-scx200_acb-01-whitespace.patch
new file mode 100644
index 00000000000000..8b6433f647bd0c
--- /dev/null
+++ b/i2c/i2c-scx200_acb-01-whitespace.patch
@@ -0,0 +1,259 @@
+From khali@linux-fr.org Wed Jan 18 13:41:04 2006
+Date: Wed, 18 Jan 2006 22:41:50 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Subject: [PATCH 02/17] i2c: scx200_acb whitespace and comment cleanup
+Message-Id: <20060118224150.388fc280.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-01-whitespace.patch
+
+From: Ben Gardner <bgardner@wabtec.com>
+
+scx200_acb: Whitespace and comment cleanup
+
+Signed-off-by: Ben Gardner <bgardner@wabtec.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/i2c/busses/scx200_acb.c | 90 +++++++++++++++++++---------------------
+ 1 file changed, 43 insertions(+), 47 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -1,27 +1,25 @@
+-/* linux/drivers/i2c/scx200_acb.c
+-
++/*
+ Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
+
+ National Semiconductor SCx200 ACCESS.bus support
+-
++
+ Based on i2c-keywest.c which is:
+ Copyright (c) 2001 Benjamin Herrenschmidt <benh@kernel.crashing.org>
+ Copyright (c) 2000 Philip Edelbrock <phil@stimpy.netroedge.com>
+-
++
+ 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 Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+-
++
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+-
++
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+-
+ */
+
+ #include <linux/module.h>
+@@ -79,8 +77,7 @@ static const char *scx200_acb_state_name
+ };
+
+ /* Physical interface */
+-struct scx200_acb_iface
+-{
++struct scx200_acb_iface {
+ struct scx200_acb_iface *next;
+ struct i2c_adapter adapter;
+ unsigned base;
+@@ -100,7 +97,7 @@ struct scx200_acb_iface
+ #define ACBSDA (iface->base + 0)
+ #define ACBST (iface->base + 1)
+ #define ACBST_SDAST 0x40 /* SDA Status */
+-#define ACBST_BER 0x20
++#define ACBST_BER 0x20
+ #define ACBST_NEGACK 0x10 /* Negative Acknowledge */
+ #define ACBST_STASTR 0x08 /* Stall After Start */
+ #define ACBST_MASTER 0x02
+@@ -109,9 +106,9 @@ struct scx200_acb_iface
+ #define ACBCTL1 (iface->base + 3)
+ #define ACBCTL1_STASTRE 0x80
+ #define ACBCTL1_NMINTE 0x40
+-#define ACBCTL1_ACK 0x10
+-#define ACBCTL1_STOP 0x02
+-#define ACBCTL1_START 0x01
++#define ACBCTL1_ACK 0x10
++#define ACBCTL1_STOP 0x02
++#define ACBCTL1_START 0x01
+ #define ACBADDR (iface->base + 4)
+ #define ACBCTL2 (iface->base + 5)
+ #define ACBCTL2_ENABLE 0x01
+@@ -122,7 +119,7 @@ static void scx200_acb_machine(struct sc
+ {
+ const char *errmsg;
+
+- DBG("state %s, status = 0x%02x\n",
++ DBG("state %s, status = 0x%02x\n",
+ scx200_acb_state_name[iface->state], status);
+
+ if (status & ACBST_BER) {
+@@ -160,10 +157,10 @@ static void scx200_acb_machine(struct sc
+ case state_repeat_start:
+ outb(inb(ACBCTL1) | ACBCTL1_START, ACBCTL1);
+ /* fallthrough */
+-
++
+ case state_quick:
+ if (iface->address_byte & 1) {
+- if (iface->len == 1)
++ if (iface->len == 1)
+ outb(inb(ACBCTL1) | ACBCTL1_ACK, ACBCTL1);
+ else
+ outb(inb(ACBCTL1) & ~ACBCTL1_ACK, ACBCTL1);
+@@ -202,17 +199,17 @@ static void scx200_acb_machine(struct sc
+ outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1);
+ break;
+ }
+-
++
+ outb(*iface->ptr++, ACBSDA);
+ --iface->len;
+-
++
+ break;
+ }
+
+ return;
+
+ negack:
+- DBG("negative acknowledge in state %s\n",
++ DBG("negative acknowledge in state %s\n",
+ scx200_acb_state_name[iface->state]);
+
+ iface->state = state_idle;
+@@ -231,7 +228,7 @@ static void scx200_acb_machine(struct sc
+ iface->needs_reset = 1;
+ }
+
+-static void scx200_acb_timeout(struct scx200_acb_iface *iface)
++static void scx200_acb_timeout(struct scx200_acb_iface *iface)
+ {
+ dev_err(&iface->adapter.dev, "timeout in state %s\n",
+ scx200_acb_state_name[iface->state]);
+@@ -264,7 +261,7 @@ static void scx200_acb_poll(struct scx20
+ static void scx200_acb_reset(struct scx200_acb_iface *iface)
+ {
+ /* Disable the ACCESS.bus device and Configure the SCL
+- frequency: 16 clock cycles */
++ frequency: 16 clock cycles */
+ outb(0x70, ACBCTL2);
+ /* Polling mode */
+ outb(0, ACBCTL1);
+@@ -283,9 +280,9 @@ static void scx200_acb_reset(struct scx2
+ }
+
+ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter,
+- u16 address, unsigned short flags,
+- char rw, u8 command, int size,
+- union i2c_smbus_data *data)
++ u16 address, unsigned short flags,
++ char rw, u8 command, int size,
++ union i2c_smbus_data *data)
+ {
+ struct scx200_acb_iface *iface = i2c_get_adapdata(adapter);
+ int len;
+@@ -295,9 +292,10 @@ static s32 scx200_acb_smbus_xfer(struct
+
+ switch (size) {
+ case I2C_SMBUS_QUICK:
+- len = 0;
+- buffer = NULL;
+- break;
++ len = 0;
++ buffer = NULL;
++ break;
++
+ case I2C_SMBUS_BYTE:
+ if (rw == I2C_SMBUS_READ) {
+ len = 1;
+@@ -306,22 +304,26 @@ static s32 scx200_acb_smbus_xfer(struct
+ len = 1;
+ buffer = &command;
+ }
+- break;
++ break;
++
+ case I2C_SMBUS_BYTE_DATA:
+- len = 1;
+- buffer = &data->byte;
+- break;
++ len = 1;
++ buffer = &data->byte;
++ break;
++
+ case I2C_SMBUS_WORD_DATA:
+ len = 2;
+- cur_word = cpu_to_le16(data->word);
+- buffer = (u8 *)&cur_word;
++ cur_word = cpu_to_le16(data->word);
++ buffer = (u8 *)&cur_word;
+ break;
++
+ case I2C_SMBUS_BLOCK_DATA:
+- len = data->block[0];
+- buffer = &data->block[1];
++ len = data->block[0];
++ buffer = &data->block[1];
+ break;
++
+ default:
+- return -EINVAL;
++ return -EINVAL;
+ }
+
+ DBG("size=%d, address=0x%x, command=0x%x, len=%d, read=%d\n",
+@@ -370,7 +372,7 @@ static s32 scx200_acb_smbus_xfer(struct
+ up(&iface->sem);
+
+ if (rc == 0 && size == I2C_SMBUS_WORD_DATA && rw == I2C_SMBUS_READ)
+- data->word = le16_to_cpu(cur_word);
++ data->word = le16_to_cpu(cur_word);
+
+ #ifdef DEBUG
+ DBG(": transfer done, result: %d", rc);
+@@ -406,7 +408,7 @@ static int scx200_acb_probe(struct scx20
+ u8 val;
+
+ /* Disable the ACCESS.bus device and Configure the SCL
+- frequency: 16 clock cycles */
++ frequency: 16 clock cycles */
+ outb(0x70, ACBCTL2);
+
+ if (inb(ACBCTL2) != 0x70) {
+@@ -459,7 +461,8 @@ static int __init scx200_acb_create(int
+
+ init_MUTEX(&iface->sem);
+
+- snprintf(description, sizeof(description), "NatSemi SCx200 ACCESS.bus [%s]", adapter->name);
++ snprintf(description, sizeof(description),
++ "NatSemi SCx200 ACCESS.bus [%s]", adapter->name);
+ if (request_region(base, 8, description) == 0) {
+ dev_err(&adapter->dev, "can't allocate io 0x%x-0x%x\n",
+ base, base + 8-1);
+@@ -528,6 +531,7 @@ static int __init scx200_acb_init(void)
+ static void __exit scx200_acb_cleanup(void)
+ {
+ struct scx200_acb_iface *iface;
++
+ lock_kernel();
+ while ((iface = scx200_acb_list) != NULL) {
+ scx200_acb_list = iface->next;
+@@ -543,11 +547,3 @@ static void __exit scx200_acb_cleanup(vo
+
+ module_init(scx200_acb_init);
+ module_exit(scx200_acb_cleanup);
+-
+-/*
+- Local variables:
+- compile-command: "make -k -C ../.. SUBDIRS=drivers/i2c modules"
+- c-basic-offset: 8
+- End:
+-*/
+-
diff --git a/i2c/i2c-scx200_acb-02-debug.patch b/i2c/i2c-scx200_acb-02-debug.patch
new file mode 100644
index 00000000000000..fa642187ffc5c2
--- /dev/null
+++ b/i2c/i2c-scx200_acb-02-debug.patch
@@ -0,0 +1,145 @@
+From khali@linux-fr.org Wed Jan 18 13:42:23 2006
+Date: Wed, 18 Jan 2006 22:43:10 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Subject: [PATCH 03/17] i2c: scx200_acb debug log cleanup
+Message-Id: <20060118224310.0a776b76.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-02-debug.patch
+
+From: Ben Gardner <bgardner@wabtec.com>
+
+scx200_acb: debug log cleanup
+
+Signed-off-by: Ben Gardner <bgardner@wabtec.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/i2c/busses/scx200_acb.c | 42 ++++++++++++++++------------------------
+ 1 file changed, 17 insertions(+), 25 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -45,12 +45,6 @@ static int base[MAX_DEVICES] = { 0x820,
+ module_param_array(base, int, NULL, 0);
+ MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
+
+-#ifdef DEBUG
+-#define DBG(x...) printk(KERN_DEBUG NAME ": " x)
+-#else
+-#define DBG(x...)
+-#endif
+-
+ /* The hardware supports interrupt driven mode too, but I haven't
+ implemented that. */
+ #define POLLED_MODE 1
+@@ -119,8 +113,8 @@ static void scx200_acb_machine(struct sc
+ {
+ const char *errmsg;
+
+- DBG("state %s, status = 0x%02x\n",
+- scx200_acb_state_name[iface->state], status);
++ dev_dbg(&iface->adapter.dev, "state %s, status = 0x%02x\n",
++ scx200_acb_state_name[iface->state], status);
+
+ if (status & ACBST_BER) {
+ errmsg = "bus error";
+@@ -209,8 +203,8 @@ static void scx200_acb_machine(struct sc
+ return;
+
+ negack:
+- DBG("negative acknowledge in state %s\n",
+- scx200_acb_state_name[iface->state]);
++ dev_dbg(&iface->adapter.dev, "negative ack in state %s\n",
++ scx200_acb_state_name[iface->state]);
+
+ iface->state = state_idle;
+ iface->result = -ENXIO;
+@@ -326,19 +320,15 @@ static s32 scx200_acb_smbus_xfer(struct
+ return -EINVAL;
+ }
+
+- DBG("size=%d, address=0x%x, command=0x%x, len=%d, read=%d\n",
+- size, address, command, len, rw == I2C_SMBUS_READ);
++ dev_dbg(&adapter->dev,
++ "size=%d, address=0x%x, command=0x%x, len=%d, read=%d\n",
++ size, address, command, len, rw);
+
+ if (!len && rw == I2C_SMBUS_READ) {
+- dev_warn(&adapter->dev, "zero length read\n");
++ dev_dbg(&adapter->dev, "zero length read\n");
+ return -EINVAL;
+ }
+
+- if (len && !buffer) {
+- dev_warn(&adapter->dev, "nonzero length but no buffer\n");
+- return -EFAULT;
+- }
+-
+ down(&iface->sem);
+
+ iface->address_byte = address<<1;
+@@ -375,7 +365,7 @@ static s32 scx200_acb_smbus_xfer(struct
+ data->word = le16_to_cpu(cur_word);
+
+ #ifdef DEBUG
+- DBG(": transfer done, result: %d", rc);
++ dev_dbg(&adapter->dev, "transfer done, result: %d", rc);
+ if (buffer) {
+ int i;
+ printk(" data:");
+@@ -412,7 +402,7 @@ static int scx200_acb_probe(struct scx20
+ outb(0x70, ACBCTL2);
+
+ if (inb(ACBCTL2) != 0x70) {
+- DBG("ACBCTL2 readback failed\n");
++ pr_debug(NAME ": ACBCTL2 readback failed\n");
+ return -ENXIO;
+ }
+
+@@ -420,7 +410,8 @@ static int scx200_acb_probe(struct scx20
+
+ val = inb(ACBCTL1);
+ if (val) {
+- DBG("disabled, but ACBCTL1=0x%02x\n", val);
++ pr_debug(NAME ": disabled, but ACBCTL1=0x%02x\n",
++ val);
+ return -ENXIO;
+ }
+
+@@ -430,7 +421,8 @@ static int scx200_acb_probe(struct scx20
+
+ val = inb(ACBCTL1);
+ if ((val & ACBCTL1_NMINTE) != ACBCTL1_NMINTE) {
+- DBG("enabled, but NMINTE won't be set, ACBCTL1=0x%02x\n", val);
++ pr_debug(NAME ": enabled, but NMINTE won't be set, "
++ "ACBCTL1=0x%02x\n", val);
+ return -ENXIO;
+ }
+
+@@ -464,7 +456,7 @@ static int __init scx200_acb_create(int
+ snprintf(description, sizeof(description),
+ "NatSemi SCx200 ACCESS.bus [%s]", adapter->name);
+ if (request_region(base, 8, description) == 0) {
+- dev_err(&adapter->dev, "can't allocate io 0x%x-0x%x\n",
++ printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n",
+ base, base + 8-1);
+ rc = -EBUSY;
+ goto errout;
+@@ -473,14 +465,14 @@ static int __init scx200_acb_create(int
+
+ rc = scx200_acb_probe(iface);
+ if (rc) {
+- dev_warn(&adapter->dev, "probe failed\n");
++ printk(KERN_WARNING NAME ": probe failed\n");
+ goto errout;
+ }
+
+ scx200_acb_reset(iface);
+
+ if (i2c_add_adapter(adapter) < 0) {
+- dev_err(&adapter->dev, "failed to register\n");
++ printk(KERN_ERR NAME ": failed to register\n");
+ rc = -ENODEV;
+ goto errout;
+ }
diff --git a/i2c/i2c-scx200_acb-03-refactor.patch b/i2c/i2c-scx200_acb-03-refactor.patch
new file mode 100644
index 00000000000000..65b42d1a5b3d89
--- /dev/null
+++ b/i2c/i2c-scx200_acb-03-refactor.patch
@@ -0,0 +1,175 @@
+From khali@linux-fr.org Wed Jan 18 13:43:17 2006
+Date: Wed, 18 Jan 2006 22:44:04 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Subject: [PATCH 04/17] i2c: scx200_acb refactor/simplify code
+Message-Id: <20060118224404.0a55d834.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-03-refactor.patch
+
+From: Ben Gardner <bgardner@wabtec.com>
+
+scx200_acb: refactor/simplify code (no functional changes)
+
+Signed-off-by: Ben Gardner <bgardner@wabtec.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/i2c/busses/scx200_acb.c | 73 +++++++++++++++-------------------------
+ 1 file changed, 29 insertions(+), 44 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -124,8 +124,17 @@ static void scx200_acb_machine(struct sc
+ errmsg = "not master";
+ goto error;
+ }
+- if (status & ACBST_NEGACK)
+- goto negack;
++ if (status & ACBST_NEGACK) {
++ dev_dbg(&iface->adapter.dev, "negative ack in state %s\n",
++ scx200_acb_state_name[iface->state]);
++
++ iface->state = state_idle;
++ iface->result = -ENXIO;
++
++ outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1);
++ outb(ACBST_STASTR | ACBST_NEGACK, ACBST);
++ return;
++ }
+
+ switch (iface->state) {
+ case state_idle:
+@@ -202,17 +211,6 @@ static void scx200_acb_machine(struct sc
+
+ return;
+
+- negack:
+- dev_dbg(&iface->adapter.dev, "negative ack in state %s\n",
+- scx200_acb_state_name[iface->state]);
+-
+- iface->state = state_idle;
+- iface->result = -ENXIO;
+-
+- outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1);
+- outb(ACBST_STASTR | ACBST_NEGACK, ACBST);
+- return;
+-
+ error:
+ dev_err(&iface->adapter.dev, "%s in state %s\n", errmsg,
+ scx200_acb_state_name[iface->state]);
+@@ -222,20 +220,10 @@ static void scx200_acb_machine(struct sc
+ iface->needs_reset = 1;
+ }
+
+-static void scx200_acb_timeout(struct scx200_acb_iface *iface)
+-{
+- dev_err(&iface->adapter.dev, "timeout in state %s\n",
+- scx200_acb_state_name[iface->state]);
+-
+- iface->state = state_idle;
+- iface->result = -EIO;
+- iface->needs_reset = 1;
+-}
+-
+ #ifdef POLLED_MODE
+ static void scx200_acb_poll(struct scx200_acb_iface *iface)
+ {
+- u8 status = 0;
++ u8 status;
+ unsigned long timeout;
+
+ timeout = jiffies + POLL_TIMEOUT;
+@@ -248,7 +236,12 @@ static void scx200_acb_poll(struct scx20
+ msleep(10);
+ }
+
+- scx200_acb_timeout(iface);
++ dev_err(&iface->adapter.dev, "timeout in state %s\n",
++ scx200_acb_state_name[iface->state]);
++
++ iface->state = state_idle;
++ iface->result = -EIO;
++ iface->needs_reset = 1;
+ }
+ #endif /* POLLED_MODE */
+
+@@ -291,13 +284,8 @@ static s32 scx200_acb_smbus_xfer(struct
+ break;
+
+ case I2C_SMBUS_BYTE:
+- if (rw == I2C_SMBUS_READ) {
+- len = 1;
+- buffer = &data->byte;
+- } else {
+- len = 1;
+- buffer = &command;
+- }
++ len = 1;
++ buffer = rw ? &data->byte : &command;
+ break;
+
+ case I2C_SMBUS_BYTE_DATA:
+@@ -331,9 +319,7 @@ static s32 scx200_acb_smbus_xfer(struct
+
+ down(&iface->sem);
+
+- iface->address_byte = address<<1;
+- if (rw == I2C_SMBUS_READ)
+- iface->address_byte |= 1;
++ iface->address_byte = (address << 1) | rw;
+ iface->command = command;
+ iface->ptr = buffer;
+ iface->len = len;
+@@ -433,7 +419,7 @@ static int __init scx200_acb_create(int
+ {
+ struct scx200_acb_iface *iface;
+ struct i2c_adapter *adapter;
+- int rc = 0;
++ int rc;
+ char description[64];
+
+ iface = kzalloc(sizeof(*iface), GFP_KERNEL);
+@@ -459,14 +445,14 @@ static int __init scx200_acb_create(int
+ printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n",
+ base, base + 8-1);
+ rc = -EBUSY;
+- goto errout;
++ goto errout_free;
+ }
+ iface->base = base;
+
+ rc = scx200_acb_probe(iface);
+ if (rc) {
+ printk(KERN_WARNING NAME ": probe failed\n");
+- goto errout;
++ goto errout_release;
+ }
+
+ scx200_acb_reset(iface);
+@@ -474,7 +460,7 @@ static int __init scx200_acb_create(int
+ if (i2c_add_adapter(adapter) < 0) {
+ printk(KERN_ERR NAME ": failed to register\n");
+ rc = -ENODEV;
+- goto errout;
++ goto errout_release;
+ }
+
+ lock_kernel();
+@@ -484,12 +470,11 @@ static int __init scx200_acb_create(int
+
+ return 0;
+
++ errout_release:
++ release_region(iface->base, 8);
++ errout_free:
++ kfree(iface);
+ errout:
+- if (iface) {
+- if (iface->base)
+- release_region(iface->base, 8);
+- kfree(iface);
+- }
+ return rc;
+ }
+
diff --git a/i2c/i2c-scx200_acb-04-lock_kernel.patch b/i2c/i2c-scx200_acb-04-lock_kernel.patch
new file mode 100644
index 00000000000000..76034ed3daba90
--- /dev/null
+++ b/i2c/i2c-scx200_acb-04-lock_kernel.patch
@@ -0,0 +1,65 @@
+From khali@linux-fr.org Wed Jan 18 13:45:39 2006
+Date: Wed, 18 Jan 2006 22:46:26 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Subject: [PATCH 05/17] i2c: scx200_acb remove use of lock_kernel
+Message-Id: <20060118224626.03f91248.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-04-lock_kernel.patch
+
+From: Ben Gardner <bgardner@wabtec.com>
+
+scx200_acb: remove use of lock_kernel()
+
+Signed-off-by: Ben Gardner <bgardner@wabtec.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/i2c/busses/scx200_acb.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -378,6 +378,7 @@ static struct i2c_algorithm scx200_acb_a
+ };
+
+ static struct scx200_acb_iface *scx200_acb_list;
++static DECLARE_MUTEX(scx200_acb_list_mutex);
+
+ static int scx200_acb_probe(struct scx200_acb_iface *iface)
+ {
+@@ -463,10 +464,10 @@ static int __init scx200_acb_create(int
+ goto errout_release;
+ }
+
+- lock_kernel();
++ down(&scx200_acb_list_mutex);
+ iface->next = scx200_acb_list;
+ scx200_acb_list = iface;
+- unlock_kernel();
++ up(&scx200_acb_list_mutex);
+
+ return 0;
+
+@@ -509,17 +510,17 @@ static void __exit scx200_acb_cleanup(vo
+ {
+ struct scx200_acb_iface *iface;
+
+- lock_kernel();
++ down(&scx200_acb_list_mutex);
+ while ((iface = scx200_acb_list) != NULL) {
+ scx200_acb_list = iface->next;
+- unlock_kernel();
++ up(&scx200_acb_list_mutex);
+
+ i2c_del_adapter(&iface->adapter);
+ release_region(iface->base, 8);
+ kfree(iface);
+- lock_kernel();
++ down(&scx200_acb_list_mutex);
+ }
+- unlock_kernel();
++ up(&scx200_acb_list_mutex);
+ }
+
+ module_init(scx200_acb_init);
diff --git a/i2c/i2c-scx200_acb-05-cs5535.patch b/i2c/i2c-scx200_acb-05-cs5535.patch
new file mode 100644
index 00000000000000..4f9c4305c8a977
--- /dev/null
+++ b/i2c/i2c-scx200_acb-05-cs5535.patch
@@ -0,0 +1,128 @@
+From khali@linux-fr.org Wed Jan 18 13:47:39 2006
+Date: Wed, 18 Jan 2006 22:48:26 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Subject: [PATCH 06/17] i2c: scx200_acb add support for the CS5535/CS5536
+Message-Id: <20060118224826.20019da4.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-05-cs5535.patch
+
+From: Ben Gardner <bgardner@wabtec.com>
+
+scx200_acb: Add support for the CS5535/CS5536
+
+Signed-off-by: Ben Gardner <bgardner@wabtec.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+---
+ drivers/i2c/busses/scx200_acb.c | 57 ++++++++++++++++++++++++++++++----------
+ 1 file changed, 43 insertions(+), 14 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -2,6 +2,7 @@
+ Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
+
+ National Semiconductor SCx200 ACCESS.bus support
++ Also supports the AMD CS5535 and AMD CS5536
+
+ Based on i2c-keywest.c which is:
+ Copyright (c) 2001 Benjamin Herrenschmidt <benh@kernel.crashing.org>
+@@ -31,6 +32,7 @@
+ #include <linux/pci.h>
+ #include <linux/delay.h>
+ #include <asm/io.h>
++#include <asm/msr.h>
+
+ #include <linux/scx200.h>
+
+@@ -416,7 +418,7 @@ static int scx200_acb_probe(struct scx20
+ return 0;
+ }
+
+-static int __init scx200_acb_create(int base, int index)
++static int __init scx200_acb_create(const char *text, int base, int index)
+ {
+ struct scx200_acb_iface *iface;
+ struct i2c_adapter *adapter;
+@@ -432,7 +434,7 @@ static int __init scx200_acb_create(int
+
+ adapter = &iface->adapter;
+ i2c_set_adapdata(adapter, iface);
+- snprintf(adapter->name, I2C_NAME_SIZE, "SCx200 ACB%d", index);
++ snprintf(adapter->name, I2C_NAME_SIZE, "%s ACB%d", text, index);
+ adapter->owner = THIS_MODULE;
+ adapter->id = I2C_HW_SMBUS_SCX200;
+ adapter->algo = &scx200_acb_algorithm;
+@@ -440,8 +442,9 @@ static int __init scx200_acb_create(int
+
+ init_MUTEX(&iface->sem);
+
+- snprintf(description, sizeof(description),
+- "NatSemi SCx200 ACCESS.bus [%s]", adapter->name);
++ snprintf(description, sizeof(description), "%s ACCESS.bus [%s]",
++ text, adapter->name);
++
+ if (request_region(base, 8, description) == 0) {
+ printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n",
+ base, base + 8-1);
+@@ -485,24 +488,50 @@ static struct pci_device_id scx200[] = {
+ { },
+ };
+
++static struct pci_device_id divil_pci[] = {
++ { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA) },
++ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA) },
++ { } /* NULL entry */
++};
++
++#define MSR_LBAR_SMB 0x5140000B
++
++static int scx200_add_cs553x(void)
++{
++ u32 low, hi;
++ u32 smb_base;
++
++ /* Grab & reserve the SMB I/O range */
++ rdmsr(MSR_LBAR_SMB, low, hi);
++
++ /* Check the IO mask and whether SMB is enabled */
++ if (hi != 0x0000F001) {
++ printk(KERN_WARNING NAME ": SMBus not enabled\n");
++ return -ENODEV;
++ }
++
++ /* SMBus IO size is 8 bytes */
++ smb_base = low & 0x0000FFF8;
++
++ return scx200_acb_create("CS5535", smb_base, 0);
++}
++
+ static int __init scx200_acb_init(void)
+ {
+ int i;
+- int rc;
++ int rc = -ENODEV;
+
+ pr_debug(NAME ": NatSemi SCx200 ACCESS.bus Driver\n");
+
+ /* Verify that this really is a SCx200 processor */
+- if (pci_dev_present(scx200) == 0)
+- return -ENODEV;
++ if (pci_dev_present(scx200)) {
++ for (i = 0; i < MAX_DEVICES; ++i) {
++ if (base[i] > 0)
++ rc = scx200_acb_create("SCx200", base[i], i);
++ }
++ } else if (pci_dev_present(divil_pci))
++ rc = scx200_add_cs553x();
+
+- rc = -ENXIO;
+- for (i = 0; i < MAX_DEVICES; ++i) {
+- if (base[i] > 0)
+- rc = scx200_acb_create(base[i], i);
+- }
+- if (scx200_acb_list)
+- return 0;
+ return rc;
+ }
+
diff --git a/i2c/i2c-scx200_acb-06-poll.patch b/i2c/i2c-scx200_acb-06-poll.patch
new file mode 100644
index 00000000000000..6932ffb317080c
--- /dev/null
+++ b/i2c/i2c-scx200_acb-06-poll.patch
@@ -0,0 +1,72 @@
+From khali@linux-fr.org Wed Jan 18 13:51:19 2006
+Date: Wed, 18 Jan 2006 22:52:06 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Subject: [PATCH 07/17] i2c: scx200_acb fix and speed up the poll loop
+Message-Id: <20060118225206.50e42a42.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-06-poll.patch
+
+From: Ben Gardner <bgardner@wabtec.com>
+
+scx200_acb: Fix and speed up the poll loop
+
+Signed-off-by: Ben Gardner <bgardner@wabtec.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/i2c/busses/scx200_acb.c | 13 ++-----------
+ 1 file changed, 2 insertions(+), 11 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/busses/scx200_acb.c
++++ gregkh-2.6/drivers/i2c/busses/scx200_acb.c
+@@ -47,10 +47,7 @@ static int base[MAX_DEVICES] = { 0x820,
+ module_param_array(base, int, NULL, 0);
+ MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
+
+-/* The hardware supports interrupt driven mode too, but I haven't
+- implemented that. */
+-#define POLLED_MODE 1
+-#define POLL_TIMEOUT (HZ)
++#define POLL_TIMEOUT (HZ/5)
+
+ enum scx200_acb_state {
+ state_idle,
+@@ -222,7 +219,6 @@ static void scx200_acb_machine(struct sc
+ iface->needs_reset = 1;
+ }
+
+-#ifdef POLLED_MODE
+ static void scx200_acb_poll(struct scx200_acb_iface *iface)
+ {
+ u8 status;
+@@ -235,7 +231,7 @@ static void scx200_acb_poll(struct scx20
+ scx200_acb_machine(iface, status);
+ return;
+ }
+- msleep(10);
++ yield();
+ }
+
+ dev_err(&iface->adapter.dev, "timeout in state %s\n",
+@@ -245,7 +241,6 @@ static void scx200_acb_poll(struct scx20
+ iface->result = -EIO;
+ iface->needs_reset = 1;
+ }
+-#endif /* POLLED_MODE */
+
+ static void scx200_acb_reset(struct scx200_acb_iface *iface)
+ {
+@@ -335,12 +330,8 @@ static s32 scx200_acb_smbus_xfer(struct
+ else
+ iface->state = state_address;
+
+-#ifdef POLLED_MODE
+ while (iface->state != state_idle)
+ scx200_acb_poll(iface);
+-#else /* POLLED_MODE */
+-#error Interrupt driven mode not implemented
+-#endif /* POLLED_MODE */
+
+ if (iface->needs_reset)
+ scx200_acb_reset(iface);
diff --git a/i2c/i2c-scx200_acb-07-docs.patch b/i2c/i2c-scx200_acb-07-docs.patch
new file mode 100644
index 00000000000000..06cb598253b122
--- /dev/null
+++ b/i2c/i2c-scx200_acb-07-docs.patch
@@ -0,0 +1,52 @@
+From khali@linux-fr.org Wed Jan 18 13:52:24 2006
+Date: Wed, 18 Jan 2006 22:53:09 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Ben Gardner <bgardner@wabtec.com>
+Subject: [PATCH 08/17] i2c: scx200_acb minimal documentation update
+Message-Id: <20060118225309.708129dd.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-scx200_acb-07-docs.patch
+
+From: Ben Gardner <bgardner@wabtec.com>
+
+scx200_acb: Minimal documentation update
+
+Signed-off-by: Ben Gardner <bgardner@wabtec.com>
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ Documentation/i2c/busses/scx200_acb | 5 +++--
+ drivers/i2c/busses/Kconfig | 5 +++--
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+--- gregkh-2.6.orig/Documentation/i2c/busses/scx200_acb
++++ gregkh-2.6/Documentation/i2c/busses/scx200_acb
+@@ -6,9 +6,10 @@ Module Parameters
+ -----------------
+
+ * base: int
+- Base addresses for the ACCESS.bus controllers
++ Base addresses for the ACCESS.bus controllers on SCx200 and SC1100 devices
+
+ Description
+ -----------
+
+-Enable the use of the ACCESS.bus controllers of a SCx200 processor.
++Enable the use of the ACCESS.bus controller on the Geode SCx200 and
++SC1100 processors and the CS5535 and CS5536 Geode companion devices.
+--- gregkh-2.6.orig/drivers/i2c/busses/Kconfig
++++ gregkh-2.6/drivers/i2c/busses/Kconfig
+@@ -389,10 +389,11 @@ config SCx200_I2C_SDA
+ also be specified with a module parameter.
+
+ config SCx200_ACB
+- tristate "NatSemi SCx200 ACCESS.bus"
++ tristate "Geode ACCESS.bus support"
+ depends on I2C && PCI
+ help
+- Enable the use of the ACCESS.bus controllers of a SCx200 processor.
++ Enable the use of the ACCESS.bus controllers on the Geode SCx200 and
++ SC1100 processors and the CS5535 and CS5536 Geode companion devices.
+
+ If you don't know what to do here, say N.
+
diff --git a/i2c/i2c-speedup-block-transfers.patch b/i2c/i2c-speedup-block-transfers.patch
new file mode 100644
index 00000000000000..d256e2e6a5d1af
--- /dev/null
+++ b/i2c/i2c-speedup-block-transfers.patch
@@ -0,0 +1,55 @@
+From khali@linux-fr.org Wed Jan 18 14:14:09 2006
+Date: Wed, 18 Jan 2006 23:14:55 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Subject: [PATCH 12/17] i2c: Speed up block transfers
+Message-Id: <20060118231455.71b0c12e.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-speedup-block-transfers.patch
+
+Speed up i2c_smbus_write_block_data and i2c_smbus_read_i2c_block_data
+a bit by using memcpy instead of an explicit loop.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/i2c/i2c-core.c | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/i2c-core.c
++++ gregkh-2.6/drivers/i2c/i2c-core.c
+@@ -920,12 +920,11 @@ s32 i2c_smbus_write_block_data(struct i2
+ u8 length, u8 *values)
+ {
+ union i2c_smbus_data data;
+- int i;
++
+ if (length > I2C_SMBUS_BLOCK_MAX)
+ length = I2C_SMBUS_BLOCK_MAX;
+- for (i = 1; i <= length; i++)
+- data.block[i] = values[i-1];
+ data.block[0] = length;
++ memcpy(&data.block[1], values, length);
+ return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
+ I2C_SMBUS_WRITE,command,
+ I2C_SMBUS_BLOCK_DATA,&data);
+@@ -935,16 +934,14 @@ s32 i2c_smbus_write_block_data(struct i2
+ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values)
+ {
+ union i2c_smbus_data data;
+- int i;
++
+ if (i2c_smbus_xfer(client->adapter,client->addr,client->flags,
+ I2C_SMBUS_READ,command,
+ I2C_SMBUS_I2C_BLOCK_DATA,&data))
+ return -1;
+- else {
+- for (i = 1; i <= data.block[0]; i++)
+- values[i-1] = data.block[i];
+- return data.block[0];
+- }
++
++ memcpy(values, &data.block[1], data.block[0]);
++ return data.block[0];
+ }
+
+ s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command,