aboutsummaryrefslogtreecommitdiffstats
path: root/i2c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-03-24 10:03:32 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-24 10:03:32 -0800
commit095f2a2fd796279dd6bee34dc148ebb93fe94d8a (patch)
tree00b1f00cc1f852bb0ce9118ca6f236c222db6881 /i2c
parent67c5ef4280f39c2c36859a1e2c385a0f60461ac8 (diff)
downloadpatches-095f2a2fd796279dd6bee34dc148ebb93fe94d8a.tar.gz
removed i2c patches that went into 2.6.16-git8
Diffstat (limited to 'i2c')
-rw-r--r--i2c/fix-w1_master_ds9490_bridge-dependencies.patch30
-rw-r--r--i2c/hwmon-add-required-idr-locking.patch91
-rw-r--r--i2c/hwmon-allow-sensor-attr-arrays.patch46
-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-f71805f-use-attr-arrays.patch307
-rw-r--r--i2c/hwmon-pc87360-use-attr-arrays.patch567
-rw-r--r--i2c/hwmon-rename-register-parameters.patch139
-rw-r--r--i2c/hwmon-sensor-attr-array-2.patch44
-rw-r--r--i2c/hwmon-vid-pentium-m.patch51
-rw-r--r--i2c/hwmon-w83627ehf-use-attr-arrays.patch324
-rw-r--r--i2c/hwmon-w83627hf-add-w83687thf-support.patch252
-rw-r--r--i2c/hwmon-w83781d-document-alarm-bits.patch47
-rw-r--r--i2c/hwmon-w83781d-no-reset-by-default.patch79
-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-ali1535-drop-redundant-mutex.patch51
-rw-r--r--i2c/i2c-amd756-s4882-mutex-init.patch35
-rw-r--r--i2c/i2c-convert-i2c-to-mutexes.patch270
-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-core-optimize-mutex-use.patch53
-rw-r--r--i2c/i2c-drop-frodo.patch116
-rw-r--r--i2c/i2c-drop-unneeded-i2c-dev-h-includes.patch185
-rw-r--r--i2c/i2c-fix-sx200_acb-build-on-other-arches.patch29
-rw-r--r--i2c/i2c-isp1301_omap-driver-cleanups.patch27
-rw-r--r--i2c/i2c-ite-name-init.patch30
-rw-r--r--i2c/i2c-ixp4xx-hwmon-class.patch30
-rw-r--r--i2c/i2c-piix4-add-ht1000-support.patch84
-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
-rw-r--r--i2c/w1-add-the-ds2482-i2c-to-w1-bridge-driver.patch646
-rw-r--r--i2c/w1-change-the-type-unsigned-long-member-of-struct-w1_bus_master-to-void.patch279
-rw-r--r--i2c/w1-misc-cleanups.patch134
-rw-r--r--i2c/w1-move-w1-bus-master-code-into-w1-masters-and-move-w1-slave-code-into-w1-slaves.patch4373
-rw-r--r--i2c/w1-remove-incorrect-module_alias.patch27
-rw-r--r--i2c/w1-u64-is-not-long-long.patch36
-rw-r--r--i2c/w1-use-kthread-api.patch271
44 files changed, 0 insertions, 16371 deletions
diff --git a/i2c/fix-w1_master_ds9490_bridge-dependencies.patch b/i2c/fix-w1_master_ds9490_bridge-dependencies.patch
deleted file mode 100644
index fb9c10d3f0f73..0000000000000
--- a/i2c/fix-w1_master_ds9490_bridge-dependencies.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From linux-kernel-owner+greg=40kroah.com-S1752514AbWAFRlI@vger.kernel.org Fri Jan 6 09:53:40 2006
-Date: Fri, 6 Jan 2006 18:41:01 +0100
-From: Adrian Bunk <bunk@stusta.de>
-To: <johnpol@2ka.mipt.ru>, <gregkh@suse.de>
-Subject: [-mm patch] fix W1_MASTER_DS9490_BRIDGE dependencies
-Message-ID: <20060106174101.GT12131@stusta.de>
-Content-Disposition: inline
-
-W1_DS9490 was renamed to W1_MASTER_DS9490, but the entry in the
-dependencies of W1_MASTER_DS9490_BRIDGE was forgotten.
-
-
-Signed-off-by: Adrian Bunk <bunk@stusta.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-
----
- drivers/w1/masters/Kconfig | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- gregkh-2.6.orig/drivers/w1/masters/Kconfig
-+++ gregkh-2.6/drivers/w1/masters/Kconfig
-@@ -26,7 +26,7 @@ config W1_MASTER_DS9490
-
- config W1_MASTER_DS9490_BRIDGE
- tristate "DS9490R USB <-> W1 transport layer for 1-wire"
-- depends on W1_DS9490
-+ depends on W1_MASTER_DS9490
- help
- Say Y here if you want to communicate with your 1-wire devices
- using DS9490R USB bridge.
diff --git a/i2c/hwmon-add-required-idr-locking.patch b/i2c/hwmon-add-required-idr-locking.patch
deleted file mode 100644
index c02ba677b67bb..0000000000000
--- a/i2c/hwmon-add-required-idr-locking.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From khali@linux-fr.org Sun Mar 5 14:12:35 2006
-Date: Sun, 5 Mar 2006 23:13:47 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>, L
-Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
-Subject: [PATCH] hwmon: add required idr locking
-Message-Id: <20060305231347.b3893bd9.khali@linux-fr.org>
-
-From: "Mark M. Hoffman" <mhoffman@lightlink.com>
-
-Add required locking around idr_ routines, retry the idr_pre_get/idr_get_new
-pair properly, and sprinkle in some likely/unlikely for good measure.
-
-(Lack of idr locking didn't hurt when all callers were I2C clients, as the
-i2c-core serialized for us anyway. Now that we have non I2C hwmon drivers,
-this is truly necessary.)
-
-Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/hwmon/hwmon.c | 26 ++++++++++++++++++++------
- 1 file changed, 20 insertions(+), 6 deletions(-)
-
---- gregkh-2.6.orig/drivers/hwmon/hwmon.c
-+++ gregkh-2.6/drivers/hwmon/hwmon.c
-@@ -17,6 +17,7 @@
- #include <linux/idr.h>
- #include <linux/hwmon.h>
- #include <linux/gfp.h>
-+#include <linux/spinlock.h>
-
- #define HWMON_ID_PREFIX "hwmon"
- #define HWMON_ID_FORMAT HWMON_ID_PREFIX "%d"
-@@ -24,6 +25,7 @@
- static struct class *hwmon_class;
-
- static DEFINE_IDR(hwmon_idr);
-+static DEFINE_SPINLOCK(idr_lock);
-
- /**
- * hwmon_device_register - register w/ hwmon sysfs class
-@@ -37,20 +39,30 @@ static DEFINE_IDR(hwmon_idr);
- struct class_device *hwmon_device_register(struct device *dev)
- {
- struct class_device *cdev;
-- int id;
-+ int id, err;
-
-- if (idr_pre_get(&hwmon_idr, GFP_KERNEL) == 0)
-+again:
-+ if (unlikely(idr_pre_get(&hwmon_idr, GFP_KERNEL) == 0))
- return ERR_PTR(-ENOMEM);
-
-- if (idr_get_new(&hwmon_idr, NULL, &id) < 0)
-- return ERR_PTR(-ENOMEM);
-+ spin_lock(&idr_lock);
-+ err = idr_get_new(&hwmon_idr, NULL, &id);
-+ spin_unlock(&idr_lock);
-+
-+ if (unlikely(err == -EAGAIN))
-+ goto again;
-+ else if (unlikely(err))
-+ return ERR_PTR(err);
-
- id = id & MAX_ID_MASK;
- cdev = class_device_create(hwmon_class, NULL, MKDEV(0,0), dev,
- HWMON_ID_FORMAT, id);
-
-- if (IS_ERR(cdev))
-+ if (IS_ERR(cdev)) {
-+ spin_lock(&idr_lock);
- idr_remove(&hwmon_idr, id);
-+ spin_unlock(&idr_lock);
-+ }
-
- return cdev;
- }
-@@ -64,9 +76,11 @@ void hwmon_device_unregister(struct clas
- {
- int id;
-
-- if (sscanf(cdev->class_id, HWMON_ID_FORMAT, &id) == 1) {
-+ if (likely(sscanf(cdev->class_id, HWMON_ID_FORMAT, &id) == 1)) {
- class_device_unregister(cdev);
-+ spin_lock(&idr_lock);
- idr_remove(&hwmon_idr, id);
-+ spin_unlock(&idr_lock);
- } else
- dev_dbg(cdev->dev,
- "hwmon_device_unregister() failed: bad class ID!\n");
diff --git a/i2c/hwmon-allow-sensor-attr-arrays.patch b/i2c/hwmon-allow-sensor-attr-arrays.patch
deleted file mode 100644
index 398bd26fa255f..0000000000000
--- a/i2c/hwmon-allow-sensor-attr-arrays.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From khali@linux-fr.org Mon Jan 9 14:27:40 2006
-Date: Mon, 9 Jan 2006 23:22:24 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Cc: Jim Cromie <jim.cromie@gmail.com>
-Subject: hwmon: Allow sensor attributes arrays
-Message-Id: <20060109232224.053ae9ff.khali@linux-fr.org>
-Content-Disposition: inline; filename=hwmon-allow-sensor-attr-arrays.patch
-
-From: Jim Cromie <jim.cromie@gmail.com>
-
-This patch refactors SENSOR_DEVICE_ATTR macro. First it creates a new
-macro SENSOR_ATTR() which expands to an initialization expression, then
-it uses that in SENSOR_DEVICE_ATTR, which declares and initializes a
-struct sensor_device_attribute.
-
-IOW, SENSOR_ATTR() imitates __ATTR() in include/linux/device.h.
-
-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
-@@ -27,11 +27,13 @@ struct sensor_device_attribute{
- #define to_sensor_dev_attr(_dev_attr) \
- container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
-
--#define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index) \
--struct sensor_device_attribute sensor_dev_attr_##_name = { \
-- .dev_attr = __ATTR(_name,_mode,_show,_store), \
-- .index = _index, \
--}
-+#define SENSOR_ATTR(_name, _mode, _show, _store, _index) \
-+ { .dev_attr = __ATTR(_name, _mode, _show, _store), \
-+ .index = _index }
-+
-+#define SENSOR_DEVICE_ATTR(_name, _mode, _show, _store, _index) \
-+struct sensor_device_attribute sensor_dev_attr_##_name \
-+ = SENSOR_ATTR(_name, _mode, _show, _store, _index)
-
- struct sensor_device_attribute_2 {
- struct device_attribute dev_attr;
diff --git a/i2c/hwmon-convert-semaphores-to-mutexes.patch b/i2c/hwmon-convert-semaphores-to-mutexes.patch
deleted file mode 100644
index 901ffade051df..0000000000000
--- a/i2c/hwmon-convert-semaphores-to-mutexes.patch
+++ /dev/null
@@ -1,5044 +0,0 @@
-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"
-
-@@ -226,10 +227,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 */
-
-@@ -311,11 +312,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);
-@@ -381,13 +382,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;
- }
-
-@@ -446,7 +447,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); \
-@@ -458,7 +459,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);
-@@ -571,7 +572,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);
-@@ -592,7 +593,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;
- }
-
-@@ -637,7 +638,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],
-@@ -662,7 +663,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;
- }
-
-@@ -709,10 +710,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;
- }
-
-@@ -725,7 +726,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:
-@@ -742,11 +743,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;
- }
-
-@@ -808,7 +809,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 */
-@@ -841,7 +842,7 @@ store_sensor_reg(struct device *dev, con
- break;
- }
-
-- up(&data->update_lock);
-+ mutex_unlock(&data->update_lock);
- return count;
- }
-
-@@ -1073,7 +1074,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;
-@@ -1178,7 +1179,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)))
-@@ -1325,7 +1326,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))
-@@ -1383,7 +1384,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;
- }
-
-@@ -1394,7 +1395,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))
-@@ -1447,7 +1448,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;
- }
-
-@@ -1533,7 +1534,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) {
-@@ -1641,7 +1642,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
deleted file mode 100644
index 75b71e949d00a..0000000000000
--- a/i2c/hwmon-f71805f-convert-semaphore-to-mutex.patch
+++ /dev/null
@@ -1,216 +0,0 @@
-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-f71805f-use-attr-arrays.patch b/i2c/hwmon-f71805f-use-attr-arrays.patch
deleted file mode 100644
index 92b5908ed71fa..0000000000000
--- a/i2c/hwmon-f71805f-use-attr-arrays.patch
+++ /dev/null
@@ -1,307 +0,0 @@
-From khali@linux-fr.org Mon Jan 9 14:33:39 2006
-Date: Mon, 9 Jan 2006 23:29:11 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: hwmon: Use attribute arrays in f71805f
-Message-Id: <20060109232911.7370e554.khali@linux-fr.org>
-Content-Disposition: inline; filename=hwmon-f71805f-use-attr-arrays.patch
-
-Convert the f71805f driver to use arrays of attributes. This shrinks the
-compiled module from 12.0 kB to 9.6 kB. We certainly should do the same
-for as many hardware monitoring drivers as possible.
-
-This, together with a nice chip design by Fintek, makes this driver
-very small, both in terms of number of lines of code and memory
-consumption.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/hwmon/f71805f.c | 224 ++++++++++++++++++++++--------------------------
- 1 file changed, 106 insertions(+), 118 deletions(-)
-
---- gregkh-2.6.orig/drivers/hwmon/f71805f.c
-+++ gregkh-2.6/drivers/hwmon/f71805f.c
-@@ -384,10 +384,6 @@ static ssize_t set_in0_min(struct device
- return count;
- }
-
--static DEVICE_ATTR(in0_input, S_IRUGO, show_in0, NULL);
--static DEVICE_ATTR(in0_max, S_IRUGO| S_IWUSR, show_in0_max, set_in0_max);
--static DEVICE_ATTR(in0_min, S_IRUGO| S_IWUSR, show_in0_min, set_in0_min);
--
- static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
- char *buf)
- {
-@@ -450,23 +446,6 @@ static ssize_t set_in_min(struct device
- return count;
- }
-
--#define sysfs_in(offset) \
--static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \
-- show_in, NULL, offset); \
--static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
-- show_in_max, set_in_max, offset); \
--static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
-- show_in_min, set_in_min, offset)
--
--sysfs_in(1);
--sysfs_in(2);
--sysfs_in(3);
--sysfs_in(4);
--sysfs_in(5);
--sysfs_in(6);
--sysfs_in(7);
--sysfs_in(8);
--
- static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
- char *buf)
- {
-@@ -503,16 +482,6 @@ static ssize_t set_fan_min(struct device
- return count;
- }
-
--#define sysfs_fan(offset) \
--static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
-- show_fan, NULL, offset - 1); \
--static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
-- show_fan_min, set_fan_min, offset - 1)
--
--sysfs_fan(1);
--sysfs_fan(2);
--sysfs_fan(3);
--
- static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
- char *buf)
- {
-@@ -586,20 +555,6 @@ static ssize_t set_temp_hyst(struct devi
- return count;
- }
-
--#define sysfs_temp(offset) \
--static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
-- show_temp, NULL, offset - 1); \
--static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
-- show_temp_max, set_temp_max, offset - 1); \
--static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, \
-- show_temp_hyst, set_temp_hyst, offset - 1); \
--static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO, \
-- show_temp_type, NULL, offset - 1)
--
--sysfs_temp(1);
--sysfs_temp(2);
--sysfs_temp(3);
--
- static ssize_t show_alarms_in(struct device *dev, struct device_attribute
- *devattr, char *buf)
- {
-@@ -625,10 +580,6 @@ static ssize_t show_alarms_temp(struct d
- return sprintf(buf, "%d\n", (data->alarms[1] >> 3) & 0x07);
- }
-
--static DEVICE_ATTR(alarms_in, S_IRUGO, show_alarms_in, NULL);
--static DEVICE_ATTR(alarms_fan, S_IRUGO, show_alarms_fan, NULL);
--static DEVICE_ATTR(alarms_temp, S_IRUGO, show_alarms_temp, NULL);
--
- static ssize_t show_name(struct device *dev, struct device_attribute
- *devattr, char *buf)
- {
-@@ -637,7 +588,89 @@ static ssize_t show_name(struct device *
- return sprintf(buf, "%s\n", data->name);
- }
-
--static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
-+static struct device_attribute f71805f_dev_attr[] = {
-+ __ATTR(in0_input, S_IRUGO, show_in0, NULL),
-+ __ATTR(in0_max, S_IRUGO| S_IWUSR, show_in0_max, set_in0_max),
-+ __ATTR(in0_min, S_IRUGO| S_IWUSR, show_in0_min, set_in0_min),
-+ __ATTR(alarms_in, S_IRUGO, show_alarms_in, NULL),
-+ __ATTR(alarms_fan, S_IRUGO, show_alarms_fan, NULL),
-+ __ATTR(alarms_temp, S_IRUGO, show_alarms_temp, NULL),
-+ __ATTR(name, S_IRUGO, show_name, NULL),
-+};
-+
-+static struct sensor_device_attribute f71805f_sensor_attr[] = {
-+ SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1),
-+ SENSOR_ATTR(in1_max, S_IRUGO | S_IWUSR,
-+ show_in_max, set_in_max, 1),
-+ SENSOR_ATTR(in1_min, S_IRUGO | S_IWUSR,
-+ show_in_min, set_in_min, 1),
-+ SENSOR_ATTR(in2_input, S_IRUGO, show_in, NULL, 2),
-+ SENSOR_ATTR(in2_max, S_IRUGO | S_IWUSR,
-+ show_in_max, set_in_max, 2),
-+ SENSOR_ATTR(in2_min, S_IRUGO | S_IWUSR,
-+ show_in_min, set_in_min, 2),
-+ SENSOR_ATTR(in3_input, S_IRUGO, show_in, NULL, 3),
-+ SENSOR_ATTR(in3_max, S_IRUGO | S_IWUSR,
-+ show_in_max, set_in_max, 3),
-+ SENSOR_ATTR(in3_min, S_IRUGO | S_IWUSR,
-+ show_in_min, set_in_min, 3),
-+ SENSOR_ATTR(in4_input, S_IRUGO, show_in, NULL, 4),
-+ SENSOR_ATTR(in4_max, S_IRUGO | S_IWUSR,
-+ show_in_max, set_in_max, 4),
-+ SENSOR_ATTR(in4_min, S_IRUGO | S_IWUSR,
-+ show_in_min, set_in_min, 4),
-+ SENSOR_ATTR(in5_input, S_IRUGO, show_in, NULL, 5),
-+ SENSOR_ATTR(in5_max, S_IRUGO | S_IWUSR,
-+ show_in_max, set_in_max, 5),
-+ SENSOR_ATTR(in5_min, S_IRUGO | S_IWUSR,
-+ show_in_min, set_in_min, 5),
-+ SENSOR_ATTR(in6_input, S_IRUGO, show_in, NULL, 6),
-+ SENSOR_ATTR(in6_max, S_IRUGO | S_IWUSR,
-+ show_in_max, set_in_max, 6),
-+ SENSOR_ATTR(in6_min, S_IRUGO | S_IWUSR,
-+ show_in_min, set_in_min, 6),
-+ SENSOR_ATTR(in7_input, S_IRUGO, show_in, NULL, 7),
-+ SENSOR_ATTR(in7_max, S_IRUGO | S_IWUSR,
-+ show_in_max, set_in_max, 7),
-+ SENSOR_ATTR(in7_min, S_IRUGO | S_IWUSR,
-+ show_in_min, set_in_min, 7),
-+ SENSOR_ATTR(in8_input, S_IRUGO, show_in, NULL, 8),
-+ SENSOR_ATTR(in8_max, S_IRUGO | S_IWUSR,
-+ show_in_max, set_in_max, 8),
-+ SENSOR_ATTR(in8_min, S_IRUGO | S_IWUSR,
-+ show_in_min, set_in_min, 8),
-+
-+ SENSOR_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0),
-+ SENSOR_ATTR(temp1_max, S_IRUGO | S_IWUSR,
-+ show_temp_max, set_temp_max, 0),
-+ SENSOR_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR,
-+ show_temp_hyst, set_temp_hyst, 0),
-+ SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0),
-+ SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1),
-+ SENSOR_ATTR(temp2_max, S_IRUGO | S_IWUSR,
-+ show_temp_max, set_temp_max, 1),
-+ SENSOR_ATTR(temp2_max_hyst, S_IRUGO | S_IWUSR,
-+ show_temp_hyst, set_temp_hyst, 1),
-+ SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1),
-+ SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2),
-+ SENSOR_ATTR(temp3_max, S_IRUGO | S_IWUSR,
-+ show_temp_max, set_temp_max, 2),
-+ SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR,
-+ show_temp_hyst, set_temp_hyst, 2),
-+ SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2),
-+};
-+
-+static struct sensor_device_attribute f71805f_fan_attr[] = {
-+ SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0),
-+ SENSOR_ATTR(fan1_min, S_IRUGO | S_IWUSR,
-+ show_fan_min, set_fan_min, 0),
-+ SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1),
-+ SENSOR_ATTR(fan2_min, S_IRUGO | S_IWUSR,
-+ show_fan_min, set_fan_min, 1),
-+ SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2),
-+ SENSOR_ATTR(fan3_min, S_IRUGO | S_IWUSR,
-+ show_fan_min, set_fan_min, 2),
-+};
-
- /*
- * Device registration and initialization
-@@ -668,7 +701,7 @@ static int __devinit f71805f_probe(struc
- {
- struct f71805f_data *data;
- struct resource *res;
-- int err;
-+ int i, err;
-
- if (!(data = kzalloc(sizeof(struct f71805f_data), GFP_KERNEL))) {
- err = -ENOMEM;
-@@ -695,76 +728,31 @@ static int __devinit f71805f_probe(struc
- f71805f_init_device(data);
-
- /* Register sysfs interface files */
-- device_create_file(&pdev->dev, &dev_attr_in0_input);
-- device_create_file(&pdev->dev, &dev_attr_in0_max);
-- device_create_file(&pdev->dev, &dev_attr_in0_min);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in1_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in2_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in3_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in4_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in5_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in6_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in7_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in8_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in1_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in2_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in3_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in4_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in5_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in6_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in7_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in8_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in1_min.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in2_min.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in3_min.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in4_min.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in5_min.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in6_min.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in7_min.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_in8_min.dev_attr);
-- if (data->fan_enabled & (1 << 0)) {
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_fan1_input.dev_attr);
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_fan1_min.dev_attr);
-- }
-- if (data->fan_enabled & (1 << 1)) {
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_fan2_input.dev_attr);
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_fan2_min.dev_attr);
-- }
-- if (data->fan_enabled & (1 << 2)) {
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_fan3_input.dev_attr);
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_fan3_min.dev_attr);
-- }
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_temp1_input.dev_attr);
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_temp2_input.dev_attr);
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_temp3_input.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_temp2_max.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_temp3_max.dev_attr);
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_temp1_max_hyst.dev_attr);
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_temp2_max_hyst.dev_attr);
-- device_create_file(&pdev->dev,
-- &sensor_dev_attr_temp3_max_hyst.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_temp1_type.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_temp2_type.dev_attr);
-- device_create_file(&pdev->dev, &sensor_dev_attr_temp3_type.dev_attr);
-- device_create_file(&pdev->dev, &dev_attr_alarms_in);
-- device_create_file(&pdev->dev, &dev_attr_alarms_fan);
-- device_create_file(&pdev->dev, &dev_attr_alarms_temp);
-- device_create_file(&pdev->dev, &dev_attr_name);
-+ for (i = 0; i < ARRAY_SIZE(f71805f_dev_attr); i++) {
-+ err = device_create_file(&pdev->dev, &f71805f_dev_attr[i]);
-+ if (err)
-+ goto exit_class;
-+ }
-+ for (i = 0; i < ARRAY_SIZE(f71805f_sensor_attr); i++) {
-+ err = device_create_file(&pdev->dev,
-+ &f71805f_sensor_attr[i].dev_attr);
-+ if (err)
-+ goto exit_class;
-+ }
-+ for (i = 0; i < ARRAY_SIZE(f71805f_fan_attr); i++) {
-+ if (!(data->fan_enabled & (1 << (i / 2))))
-+ continue;
-+ err = device_create_file(&pdev->dev,
-+ &f71805f_fan_attr[i].dev_attr);
-+ if (err)
-+ goto exit_class;
-+ }
-
- return 0;
-
-+exit_class:
-+ dev_err(&pdev->dev, "Sysfs interface creation failed\n");
-+ hwmon_device_unregister(data->class_dev);
- exit_free:
- kfree(data);
- exit:
diff --git a/i2c/hwmon-pc87360-use-attr-arrays.patch b/i2c/hwmon-pc87360-use-attr-arrays.patch
deleted file mode 100644
index a964295686bc5..0000000000000
--- a/i2c/hwmon-pc87360-use-attr-arrays.patch
+++ /dev/null
@@ -1,567 +0,0 @@
-From khali@linux-fr.org Mon Jan 9 14:27:54 2006
-Date: Mon, 9 Jan 2006 23:24:41 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Cc: Jim Cromie <jim.cromie@gmail.com>
-Subject: hwmon: Use attribute arrays in pc87360
-Message-Id: <20060109232441.74164f74.khali@linux-fr.org>
-Content-Disposition: inline; filename=hwmon-pc87360-use-attr-arrays.patch
-
-From: Jim Cromie <jim.cromie@gmail.com>
-
-Convert individual sensors to sensor-attr arrays by each sensor type,
-and initialize them in loops instead of long blocks of individual calls.
-
-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>
----
- drivers/hwmon/pc87360.c | 410 +++++++++++++++++++++++-------------------------
- 1 file changed, 202 insertions(+), 208 deletions(-)
-
---- gregkh-2.6.orig/drivers/hwmon/pc87360.c
-+++ gregkh-2.6/drivers/hwmon/pc87360.c
-@@ -305,18 +305,26 @@ static ssize_t set_fan_min(struct device
- return count;
- }
-
--#define show_and_set_fan(offset) \
--static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
-- show_fan_input, NULL, offset-1); \
--static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IWUSR | S_IRUGO, \
-- show_fan_min, set_fan_min, offset-1); \
--static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO, \
-- show_fan_div, NULL, offset-1); \
--static SENSOR_DEVICE_ATTR(fan##offset##_status, S_IRUGO, \
-- show_fan_status, NULL, offset-1);
--show_and_set_fan(1)
--show_and_set_fan(2)
--show_and_set_fan(3)
-+static struct sensor_device_attribute fan_input[] = {
-+ SENSOR_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0),
-+ SENSOR_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1),
-+ SENSOR_ATTR(fan3_input, S_IRUGO, show_fan_input, NULL, 2),
-+};
-+static struct sensor_device_attribute fan_status[] = {
-+ SENSOR_ATTR(fan1_status, S_IRUGO, show_fan_status, NULL, 0),
-+ SENSOR_ATTR(fan2_status, S_IRUGO, show_fan_status, NULL, 1),
-+ SENSOR_ATTR(fan3_status, S_IRUGO, show_fan_status, NULL, 2),
-+};
-+static struct sensor_device_attribute fan_div[] = {
-+ SENSOR_ATTR(fan1_div, S_IRUGO, show_fan_div, NULL, 0),
-+ SENSOR_ATTR(fan2_div, S_IRUGO, show_fan_div, NULL, 1),
-+ SENSOR_ATTR(fan3_div, S_IRUGO, show_fan_div, NULL, 2),
-+};
-+static struct sensor_device_attribute fan_min[] = {
-+ SENSOR_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min, set_fan_min, 0),
-+ SENSOR_ATTR(fan2_min, S_IWUSR | S_IRUGO, show_fan_min, set_fan_min, 1),
-+ SENSOR_ATTR(fan3_min, S_IWUSR | S_IRUGO, show_fan_min, set_fan_min, 2),
-+};
-
- static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, char *buf)
- {
-@@ -344,12 +352,11 @@ static ssize_t set_pwm(struct device *de
- return count;
- }
-
--#define show_and_set_pwm(offset) \
--static SENSOR_DEVICE_ATTR(pwm##offset, S_IWUSR | S_IRUGO, \
-- show_pwm, set_pwm, offset-1);
--show_and_set_pwm(1)
--show_and_set_pwm(2)
--show_and_set_pwm(3)
-+static struct sensor_device_attribute pwm[] = {
-+ SENSOR_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0),
-+ SENSOR_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1),
-+ SENSOR_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2),
-+};
-
- static ssize_t show_in_input(struct device *dev, struct device_attribute *devattr, char *buf)
- {
-@@ -410,26 +417,58 @@ static ssize_t set_in_max(struct device
- return count;
- }
-
--#define show_and_set_in(offset) \
--static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \
-- show_in_input, NULL, offset); \
--static SENSOR_DEVICE_ATTR(in##offset##_min, S_IWUSR | S_IRUGO, \
-- show_in_min, set_in_min, offset); \
--static SENSOR_DEVICE_ATTR(in##offset##_max, S_IWUSR | S_IRUGO, \
-- show_in_max, set_in_max, offset); \
--static SENSOR_DEVICE_ATTR(in##offset##_status, S_IRUGO, \
-- show_in_status, NULL, offset);
--show_and_set_in(0)
--show_and_set_in(1)
--show_and_set_in(2)
--show_and_set_in(3)
--show_and_set_in(4)
--show_and_set_in(5)
--show_and_set_in(6)
--show_and_set_in(7)
--show_and_set_in(8)
--show_and_set_in(9)
--show_and_set_in(10)
-+static struct sensor_device_attribute in_input[] = {
-+ SENSOR_ATTR(in0_input, S_IRUGO, show_in_input, NULL, 0),
-+ SENSOR_ATTR(in1_input, S_IRUGO, show_in_input, NULL, 1),
-+ SENSOR_ATTR(in2_input, S_IRUGO, show_in_input, NULL, 2),
-+ SENSOR_ATTR(in3_input, S_IRUGO, show_in_input, NULL, 3),
-+ SENSOR_ATTR(in4_input, S_IRUGO, show_in_input, NULL, 4),
-+ SENSOR_ATTR(in5_input, S_IRUGO, show_in_input, NULL, 5),
-+ SENSOR_ATTR(in6_input, S_IRUGO, show_in_input, NULL, 6),
-+ SENSOR_ATTR(in7_input, S_IRUGO, show_in_input, NULL, 7),
-+ SENSOR_ATTR(in8_input, S_IRUGO, show_in_input, NULL, 8),
-+ SENSOR_ATTR(in9_input, S_IRUGO, show_in_input, NULL, 9),
-+ SENSOR_ATTR(in10_input, S_IRUGO, show_in_input, NULL, 10),
-+};
-+static struct sensor_device_attribute in_status[] = {
-+ SENSOR_ATTR(in0_status, S_IRUGO, show_in_status, NULL, 0),
-+ SENSOR_ATTR(in1_status, S_IRUGO, show_in_status, NULL, 1),
-+ SENSOR_ATTR(in2_status, S_IRUGO, show_in_status, NULL, 2),
-+ SENSOR_ATTR(in3_status, S_IRUGO, show_in_status, NULL, 3),
-+ SENSOR_ATTR(in4_status, S_IRUGO, show_in_status, NULL, 4),
-+ SENSOR_ATTR(in5_status, S_IRUGO, show_in_status, NULL, 5),
-+ SENSOR_ATTR(in6_status, S_IRUGO, show_in_status, NULL, 6),
-+ SENSOR_ATTR(in7_status, S_IRUGO, show_in_status, NULL, 7),
-+ SENSOR_ATTR(in8_status, S_IRUGO, show_in_status, NULL, 8),
-+ SENSOR_ATTR(in9_status, S_IRUGO, show_in_status, NULL, 9),
-+ SENSOR_ATTR(in10_status, S_IRUGO, show_in_status, NULL, 10),
-+};
-+static struct sensor_device_attribute in_min[] = {
-+ SENSOR_ATTR(in0_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 0),
-+ SENSOR_ATTR(in1_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 1),
-+ SENSOR_ATTR(in2_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 2),
-+ SENSOR_ATTR(in3_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 3),
-+ SENSOR_ATTR(in4_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 4),
-+ SENSOR_ATTR(in5_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 5),
-+ SENSOR_ATTR(in6_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 6),
-+ SENSOR_ATTR(in7_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 7),
-+ SENSOR_ATTR(in8_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 8),
-+ SENSOR_ATTR(in9_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 9),
-+ SENSOR_ATTR(in10_min, S_IWUSR | S_IRUGO, show_in_min, set_in_min, 10),
-+};
-+static struct sensor_device_attribute in_max[] = {
-+ SENSOR_ATTR(in0_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 0),
-+ SENSOR_ATTR(in1_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 1),
-+ SENSOR_ATTR(in2_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 2),
-+ SENSOR_ATTR(in3_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 3),
-+ SENSOR_ATTR(in4_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 4),
-+ SENSOR_ATTR(in5_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 5),
-+ SENSOR_ATTR(in6_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 6),
-+ SENSOR_ATTR(in7_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 7),
-+ SENSOR_ATTR(in8_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 8),
-+ SENSOR_ATTR(in9_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 9),
-+ SENSOR_ATTR(in10_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 10),
-+};
-
- static ssize_t show_therm_input(struct device *dev, struct device_attribute *devattr, char *buf)
- {
-@@ -511,20 +550,43 @@ static ssize_t set_therm_crit(struct dev
- return count;
- }
-
--#define show_and_set_therm(offset) \
--static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
-- show_therm_input, NULL, 11+offset-4); \
--static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \
-- show_therm_min, set_therm_min, 11+offset-4); \
--static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
-- show_therm_max, set_therm_max, 11+offset-4); \
--static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \
-- show_therm_crit, set_therm_crit, 11+offset-4); \
--static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \
-- show_therm_status, NULL, 11+offset-4);
--show_and_set_therm(4)
--show_and_set_therm(5)
--show_and_set_therm(6)
-+/* the +11 term below reflects the fact that VLM units 11,12,13 are
-+ used in the chip to measure voltage across the thermistors
-+*/
-+static struct sensor_device_attribute therm_input[] = {
-+ SENSOR_ATTR(temp4_input, S_IRUGO, show_therm_input, NULL, 0+11),
-+ SENSOR_ATTR(temp5_input, S_IRUGO, show_therm_input, NULL, 1+11),
-+ SENSOR_ATTR(temp6_input, S_IRUGO, show_therm_input, NULL, 2+11),
-+};
-+static struct sensor_device_attribute therm_status[] = {
-+ SENSOR_ATTR(temp4_status, S_IRUGO, show_therm_status, NULL, 0+11),
-+ SENSOR_ATTR(temp5_status, S_IRUGO, show_therm_status, NULL, 1+11),
-+ SENSOR_ATTR(temp6_status, S_IRUGO, show_therm_status, NULL, 2+11),
-+};
-+static struct sensor_device_attribute therm_min[] = {
-+ SENSOR_ATTR(temp4_min, S_IRUGO | S_IWUSR,
-+ show_therm_min, set_therm_min, 0+11),
-+ SENSOR_ATTR(temp5_min, S_IRUGO | S_IWUSR,
-+ show_therm_min, set_therm_min, 1+11),
-+ SENSOR_ATTR(temp6_min, S_IRUGO | S_IWUSR,
-+ show_therm_min, set_therm_min, 2+11),
-+};
-+static struct sensor_device_attribute therm_max[] = {
-+ SENSOR_ATTR(temp4_max, S_IRUGO | S_IWUSR,
-+ show_therm_max, set_therm_max, 0+11),
-+ SENSOR_ATTR(temp5_max, S_IRUGO | S_IWUSR,
-+ show_therm_max, set_therm_max, 1+11),
-+ SENSOR_ATTR(temp6_max, S_IRUGO | S_IWUSR,
-+ show_therm_max, set_therm_max, 2+11),
-+};
-+static struct sensor_device_attribute therm_crit[] = {
-+ SENSOR_ATTR(temp4_crit, S_IRUGO | S_IWUSR,
-+ show_therm_crit, set_therm_crit, 0+11),
-+ SENSOR_ATTR(temp5_crit, S_IRUGO | S_IWUSR,
-+ show_therm_crit, set_therm_crit, 1+11),
-+ SENSOR_ATTR(temp6_crit, S_IRUGO | S_IWUSR,
-+ show_therm_crit, set_therm_crit, 2+11),
-+};
-
- static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
- {
-@@ -630,20 +692,40 @@ static ssize_t set_temp_crit(struct devi
- return count;
- }
-
--#define show_and_set_temp(offset) \
--static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
-- show_temp_input, NULL, offset-1); \
--static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \
-- show_temp_min, set_temp_min, offset-1); \
--static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
-- show_temp_max, set_temp_max, offset-1); \
--static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \
-- show_temp_crit, set_temp_crit, offset-1); \
--static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \
-- show_temp_status, NULL, offset-1);
--show_and_set_temp(1)
--show_and_set_temp(2)
--show_and_set_temp(3)
-+static struct sensor_device_attribute temp_input[] = {
-+ SENSOR_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0),
-+ SENSOR_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1),
-+ SENSOR_ATTR(temp3_input, S_IRUGO, show_temp_input, NULL, 2),
-+};
-+static struct sensor_device_attribute temp_status[] = {
-+ SENSOR_ATTR(temp1_status, S_IRUGO, show_temp_status, NULL, 0),
-+ SENSOR_ATTR(temp2_status, S_IRUGO, show_temp_status, NULL, 1),
-+ SENSOR_ATTR(temp3_status, S_IRUGO, show_temp_status, NULL, 2),
-+};
-+static struct sensor_device_attribute temp_min[] = {
-+ SENSOR_ATTR(temp1_min, S_IRUGO | S_IWUSR,
-+ show_temp_min, set_temp_min, 0),
-+ SENSOR_ATTR(temp2_min, S_IRUGO | S_IWUSR,
-+ show_temp_min, set_temp_min, 1),
-+ SENSOR_ATTR(temp3_min, S_IRUGO | S_IWUSR,
-+ show_temp_min, set_temp_min, 2),
-+};
-+static struct sensor_device_attribute temp_max[] = {
-+ SENSOR_ATTR(temp1_max, S_IRUGO | S_IWUSR,
-+ show_temp_max, set_temp_max, 0),
-+ SENSOR_ATTR(temp2_max, S_IRUGO | S_IWUSR,
-+ show_temp_max, set_temp_max, 1),
-+ SENSOR_ATTR(temp3_max, S_IRUGO | S_IWUSR,
-+ show_temp_max, set_temp_max, 2),
-+};
-+static struct sensor_device_attribute temp_crit[] = {
-+ SENSOR_ATTR(temp1_crit, S_IRUGO | S_IWUSR,
-+ show_temp_crit, set_temp_crit, 0),
-+ SENSOR_ATTR(temp2_crit, S_IRUGO | S_IWUSR,
-+ show_temp_crit, set_temp_crit, 1),
-+ SENSOR_ATTR(temp3_crit, S_IRUGO | S_IWUSR,
-+ show_temp_crit, set_temp_crit, 2),
-+};
-
- static ssize_t show_temp_alarms(struct device *dev, struct device_attribute *attr, char *buf)
- {
-@@ -749,22 +831,24 @@ static int __init pc87360_find(int sioad
- static int pc87360_detect(struct i2c_adapter *adapter)
- {
- int i;
-- struct i2c_client *new_client;
-+ struct i2c_client *client;
- struct pc87360_data *data;
- int err = 0;
- const char *name = "pc87360";
- int use_thermistors = 0;
-+ struct device *dev;
-
- if (!(data = kzalloc(sizeof(struct pc87360_data), GFP_KERNEL)))
- return -ENOMEM;
-
-- new_client = &data->client;
-- i2c_set_clientdata(new_client, data);
-- new_client->addr = address;
-+ client = &data->client;
-+ dev = &client->dev;
-+ i2c_set_clientdata(client, data);
-+ client->addr = address;
- init_MUTEX(&data->lock);
-- new_client->adapter = adapter;
-- new_client->driver = &pc87360_driver;
-- new_client->flags = 0;
-+ client->adapter = adapter;
-+ client->driver = &pc87360_driver;
-+ client->flags = 0;
-
- data->fannr = 2;
- data->innr = 0;
-@@ -792,7 +876,7 @@ static int pc87360_detect(struct i2c_ada
- break;
- }
-
-- strcpy(new_client->name, name);
-+ strlcpy(client->name, name, sizeof(client->name));
- data->valid = 0;
- init_MUTEX(&data->update_lock);
-
-@@ -800,7 +884,7 @@ static int pc87360_detect(struct i2c_ada
- if (((data->address[i] = extra_isa[i]))
- && !request_region(extra_isa[i], PC87360_EXTENT,
- pc87360_driver.driver.name)) {
-- dev_err(&new_client->dev, "Region 0x%x-0x%x already "
-+ dev_err(&client->dev, "Region 0x%x-0x%x already "
- "in use!\n", extra_isa[i],
- extra_isa[i]+PC87360_EXTENT-1);
- for (i--; i >= 0; i--)
-@@ -814,7 +898,7 @@ static int pc87360_detect(struct i2c_ada
- if (data->fannr)
- data->fan_conf = confreg[0] | (confreg[1] << 8);
-
-- if ((err = i2c_attach_client(new_client)))
-+ if ((err = i2c_attach_client(client)))
- goto ERROR2;
-
- /* Use the correct reference voltage
-@@ -828,7 +912,7 @@ static int pc87360_detect(struct i2c_ada
- PC87365_REG_TEMP_CONFIG);
- }
- data->in_vref = (i&0x02) ? 3025 : 2966;
-- dev_dbg(&new_client->dev, "Using %s reference voltage\n",
-+ dev_dbg(&client->dev, "Using %s reference voltage\n",
- (i&0x02) ? "external" : "internal");
-
- data->vid_conf = confreg[3];
-@@ -847,154 +931,64 @@ static int pc87360_detect(struct i2c_ada
- if (devid == 0xe9 && data->address[1]) /* PC87366 */
- use_thermistors = confreg[2] & 0x40;
-
-- pc87360_init_client(new_client, use_thermistors);
-+ pc87360_init_client(client, use_thermistors);
- }
-
- /* Register sysfs hooks */
-- data->class_dev = hwmon_device_register(&new_client->dev);
-+ data->class_dev = hwmon_device_register(&client->dev);
- if (IS_ERR(data->class_dev)) {
- err = PTR_ERR(data->class_dev);
- goto ERROR3;
- }
-
- if (data->innr) {
-- device_create_file(&new_client->dev, &sensor_dev_attr_in0_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in1_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in2_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in3_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in4_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in5_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in6_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in7_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in8_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in9_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in10_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in0_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in1_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in2_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in3_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in4_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in5_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in6_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in7_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in8_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in9_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in10_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in0_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in1_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in2_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in3_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in4_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in5_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in6_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in7_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in8_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in9_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in10_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in0_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in1_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in2_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in3_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in4_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in5_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in6_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in7_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in8_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in9_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_in10_status.dev_attr);
--
-- device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
-- device_create_file(&new_client->dev, &dev_attr_vrm);
-- device_create_file(&new_client->dev, &dev_attr_alarms_in);
-+ for (i = 0; i < 11; i++) {
-+ device_create_file(dev, &in_input[i].dev_attr);
-+ device_create_file(dev, &in_min[i].dev_attr);
-+ device_create_file(dev, &in_max[i].dev_attr);
-+ device_create_file(dev, &in_status[i].dev_attr);
-+ }
-+ device_create_file(dev, &dev_attr_cpu0_vid);
-+ device_create_file(dev, &dev_attr_vrm);
-+ device_create_file(dev, &dev_attr_alarms_in);
- }
-
- if (data->tempnr) {
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp1_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp2_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp1_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp2_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp1_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp2_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp1_crit.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp2_crit.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp1_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp2_status.dev_attr);
--
-- device_create_file(&new_client->dev, &dev_attr_alarms_temp);
-- }
-- if (data->tempnr == 3) {
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp3_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp3_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp3_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp3_crit.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp3_status.dev_attr);
-+ for (i = 0; i < data->tempnr; i++) {
-+ device_create_file(dev, &temp_input[i].dev_attr);
-+ device_create_file(dev, &temp_min[i].dev_attr);
-+ device_create_file(dev, &temp_max[i].dev_attr);
-+ device_create_file(dev, &temp_crit[i].dev_attr);
-+ device_create_file(dev, &temp_status[i].dev_attr);
-+ }
-+ device_create_file(dev, &dev_attr_alarms_temp);
- }
-+
- if (data->innr == 14) {
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp4_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp5_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp6_input.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp4_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp5_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp6_min.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp4_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp5_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp6_max.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp4_crit.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp5_crit.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp6_crit.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp4_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp5_status.dev_attr);
-- device_create_file(&new_client->dev, &sensor_dev_attr_temp6_status.dev_attr);
-- }
--
-- if (data->fannr) {
-- if (FAN_CONFIG_MONITOR(data->fan_conf, 0)) {
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan1_input.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan1_min.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan1_div.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan1_status.dev_attr);
-- }
--
-- if (FAN_CONFIG_MONITOR(data->fan_conf, 1)) {
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan2_input.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan2_min.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan2_div.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan2_status.dev_attr);
-- }
--
-- if (FAN_CONFIG_CONTROL(data->fan_conf, 0))
-- device_create_file(&new_client->dev, &sensor_dev_attr_pwm1.dev_attr);
-- if (FAN_CONFIG_CONTROL(data->fan_conf, 1))
-- device_create_file(&new_client->dev, &sensor_dev_attr_pwm2.dev_attr);
-- }
-- if (data->fannr == 3) {
-- if (FAN_CONFIG_MONITOR(data->fan_conf, 2)) {
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan3_input.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan3_min.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan3_div.dev_attr);
-- device_create_file(&new_client->dev,
-- &sensor_dev_attr_fan3_status.dev_attr);
-+ for (i = 0; i < 3; i++) {
-+ device_create_file(dev, &therm_input[i].dev_attr);
-+ device_create_file(dev, &therm_min[i].dev_attr);
-+ device_create_file(dev, &therm_max[i].dev_attr);
-+ device_create_file(dev, &therm_crit[i].dev_attr);
-+ device_create_file(dev, &therm_status[i].dev_attr);
- }
-+ }
-
-- if (FAN_CONFIG_CONTROL(data->fan_conf, 2))
-- device_create_file(&new_client->dev, &sensor_dev_attr_pwm3.dev_attr);
-+ for (i = 0; i < data->fannr; i++) {
-+ if (FAN_CONFIG_MONITOR(data->fan_conf, i)) {
-+ device_create_file(dev, &fan_input[i].dev_attr);
-+ device_create_file(dev, &fan_min[i].dev_attr);
-+ device_create_file(dev, &fan_div[i].dev_attr);
-+ device_create_file(dev, &fan_status[i].dev_attr);
-+ }
-+ if (FAN_CONFIG_CONTROL(data->fan_conf, i))
-+ device_create_file(dev, &pwm[i].dev_attr);
- }
-
- return 0;
-
- ERROR3:
-- i2c_detach_client(new_client);
-+ i2c_detach_client(client);
- ERROR2:
- for (i = 0; i < 3; i++) {
- if (data->address[i]) {
-@@ -1071,7 +1065,7 @@ static void pc87360_init_client(struct i
- }
-
- nr = data->innr < 11 ? data->innr : 11;
-- for (i=0; i<nr; i++) {
-+ for (i = 0; i < nr; i++) {
- if (init >= init_in[i]) {
- /* Forcibly enable voltage channel */
- reg = pc87360_read_value(data, LD_IN, i,
-@@ -1088,14 +1082,14 @@ static void pc87360_init_client(struct i
-
- /* We can't blindly trust the Super-I/O space configuration bit,
- most BIOS won't set it properly */
-- for (i=11; i<data->innr; i++) {
-+ for (i = 11; i < data->innr; i++) {
- reg = pc87360_read_value(data, LD_IN, i,
- PC87365_REG_TEMP_STATUS);
- use_thermistors = use_thermistors || (reg & 0x01);
- }
-
- i = use_thermistors ? 2 : 0;
-- for (; i<data->tempnr; i++) {
-+ for (; i < data->tempnr; i++) {
- if (init >= init_temp[i]) {
- /* Forcibly enable temperature channel */
- reg = pc87360_read_value(data, LD_TEMP, i,
-@@ -1111,7 +1105,7 @@ static void pc87360_init_client(struct i
- }
-
- if (use_thermistors) {
-- for (i=11; i<data->innr; i++) {
-+ for (i = 11; i < data->innr; i++) {
- if (init >= init_in[i]) {
- /* The pin may already be used by thermal
- diodes */
diff --git a/i2c/hwmon-rename-register-parameters.patch b/i2c/hwmon-rename-register-parameters.patch
deleted file mode 100644
index aa3eb78e494dd..0000000000000
--- a/i2c/hwmon-rename-register-parameters.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From khali@linux-fr.org Mon Feb 27 14:14:04 2006
-Date: Mon, 27 Feb 2006 23:14:58 +0100
-From: Darren Jenkins <darrenrjenkins@gmail.com>
-To: Greg KH <greg@kroah.com>
-Cc: Darren Jenkins <darrenrjenkins@gmail.com>
-Subject: I2C: hwmon: Rename register parameters
-Message-Id: <20060227231458.1870d756.khali@linux-fr.org>
-Content-Disposition: inline; filename=hwmon-rename-register-parameters.patch
-
-From: Darren Jenkins <darrenrjenkins@gmail.com>
-
-"register" is a reserved keyword so using it as a parameter name
-can confuse some compilers, most notably ICC.
-
-The patch below just renames all occurences to reg which fits the actual
-function declarations.
-
-Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/hwmon/adm1026.c | 5 ++---
- drivers/hwmon/fscpos.c | 4 ++--
- drivers/hwmon/it87.c | 5 ++---
- drivers/hwmon/lm78.c | 4 ++--
- drivers/hwmon/lm85.c | 4 ++--
- drivers/hwmon/sis5595.c | 4 ++--
- drivers/hwmon/w83627hf.c | 5 ++---
- drivers/hwmon/w83781d.c | 5 ++---
- 8 files changed, 16 insertions(+), 20 deletions(-)
-
---- gregkh-2.6.orig/drivers/hwmon/adm1026.c
-+++ gregkh-2.6/drivers/hwmon/adm1026.c
-@@ -299,9 +299,8 @@ static int adm1026_attach_adapter(struct
- static int adm1026_detect(struct i2c_adapter *adapter, int address,
- int kind);
- static int adm1026_detach_client(struct i2c_client *client);
--static int adm1026_read_value(struct i2c_client *client, u8 register);
--static int adm1026_write_value(struct i2c_client *client, u8 register,
-- int value);
-+static int adm1026_read_value(struct i2c_client *client, u8 reg);
-+static int adm1026_write_value(struct i2c_client *client, u8 reg, int value);
- static void adm1026_print_gpio(struct i2c_client *client);
- static void adm1026_fixup_gpio(struct i2c_client *client);
- static struct adm1026_data *adm1026_update_device(struct device *dev);
---- gregkh-2.6.orig/drivers/hwmon/fscpos.c
-+++ gregkh-2.6/drivers/hwmon/fscpos.c
-@@ -90,8 +90,8 @@ static int fscpos_attach_adapter(struct
- static int fscpos_detect(struct i2c_adapter *adapter, int address, int kind);
- static int fscpos_detach_client(struct i2c_client *client);
-
--static int fscpos_read_value(struct i2c_client *client, u8 register);
--static int fscpos_write_value(struct i2c_client *client, u8 register, u8 value);
-+static int fscpos_read_value(struct i2c_client *client, u8 reg);
-+static int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value);
- static struct fscpos_data *fscpos_update_device(struct device *dev);
- static void fscpos_init_client(struct i2c_client *client);
-
---- gregkh-2.6.orig/drivers/hwmon/it87.c
-+++ gregkh-2.6/drivers/hwmon/it87.c
-@@ -225,9 +225,8 @@ static int it87_isa_attach_adapter(struc
- static int it87_detect(struct i2c_adapter *adapter, int address, int kind);
- static int it87_detach_client(struct i2c_client *client);
-
--static int it87_read_value(struct i2c_client *client, u8 register);
--static int it87_write_value(struct i2c_client *client, u8 register,
-- u8 value);
-+static int it87_read_value(struct i2c_client *client, u8 reg);
-+static int it87_write_value(struct i2c_client *client, u8 reg, u8 value);
- static struct it87_data *it87_update_device(struct device *dev);
- static int it87_check_pwm(struct i2c_client *client);
- static void it87_init_client(struct i2c_client *client, struct it87_data *data);
---- gregkh-2.6.orig/drivers/hwmon/lm78.c
-+++ gregkh-2.6/drivers/hwmon/lm78.c
-@@ -158,8 +158,8 @@ static int lm78_isa_attach_adapter(struc
- static int lm78_detect(struct i2c_adapter *adapter, int address, int kind);
- static int lm78_detach_client(struct i2c_client *client);
-
--static int lm78_read_value(struct i2c_client *client, u8 register);
--static int lm78_write_value(struct i2c_client *client, u8 register, u8 value);
-+static int lm78_read_value(struct i2c_client *client, u8 reg);
-+static int lm78_write_value(struct i2c_client *client, u8 reg, u8 value);
- static struct lm78_data *lm78_update_device(struct device *dev);
- static void lm78_init_client(struct i2c_client *client);
-
---- gregkh-2.6.orig/drivers/hwmon/lm85.c
-+++ gregkh-2.6/drivers/hwmon/lm85.c
-@@ -374,8 +374,8 @@ static int lm85_detect(struct i2c_adapte
- int kind);
- static int lm85_detach_client(struct i2c_client *client);
-
--static int lm85_read_value(struct i2c_client *client, u8 register);
--static int lm85_write_value(struct i2c_client *client, u8 register, int value);
-+static int lm85_read_value(struct i2c_client *client, u8 reg);
-+static int lm85_write_value(struct i2c_client *client, u8 reg, int value);
- static struct lm85_data *lm85_update_device(struct device *dev);
- static void lm85_init_client(struct i2c_client *client);
-
---- gregkh-2.6.orig/drivers/hwmon/sis5595.c
-+++ gregkh-2.6/drivers/hwmon/sis5595.c
-@@ -193,8 +193,8 @@ static struct pci_dev *s_bridge; /* poin
- static int sis5595_detect(struct i2c_adapter *adapter);
- static int sis5595_detach_client(struct i2c_client *client);
-
--static int sis5595_read_value(struct i2c_client *client, u8 register);
--static int sis5595_write_value(struct i2c_client *client, u8 register, u8 value);
-+static int sis5595_read_value(struct i2c_client *client, u8 reg);
-+static int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value);
- static struct sis5595_data *sis5595_update_device(struct device *dev);
- static void sis5595_init_client(struct i2c_client *client);
-
---- gregkh-2.6.orig/drivers/hwmon/w83627hf.c
-+++ gregkh-2.6/drivers/hwmon/w83627hf.c
-@@ -332,9 +332,8 @@ struct w83627hf_data {
- static int w83627hf_detect(struct i2c_adapter *adapter);
- static int w83627hf_detach_client(struct i2c_client *client);
-
--static int w83627hf_read_value(struct i2c_client *client, u16 register);
--static int w83627hf_write_value(struct i2c_client *client, u16 register,
-- u16 value);
-+static int w83627hf_read_value(struct i2c_client *client, u16 reg);
-+static int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value);
- static struct w83627hf_data *w83627hf_update_device(struct device *dev);
- static void w83627hf_init_client(struct i2c_client *client);
-
---- gregkh-2.6.orig/drivers/hwmon/w83781d.c
-+++ gregkh-2.6/drivers/hwmon/w83781d.c
-@@ -272,9 +272,8 @@ static int w83781d_isa_attach_adapter(st
- static int w83781d_detect(struct i2c_adapter *adapter, int address, int kind);
- static int w83781d_detach_client(struct i2c_client *client);
-
--static int w83781d_read_value(struct i2c_client *client, u16 register);
--static int w83781d_write_value(struct i2c_client *client, u16 register,
-- u16 value);
-+static int w83781d_read_value(struct i2c_client *client, u16 reg);
-+static int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value);
- static struct w83781d_data *w83781d_update_device(struct device *dev);
- static void w83781d_init_client(struct i2c_client *client);
-
diff --git a/i2c/hwmon-sensor-attr-array-2.patch b/i2c/hwmon-sensor-attr-array-2.patch
deleted file mode 100644
index 0ed20ce2dbd0e..0000000000000
--- a/i2c/hwmon-sensor-attr-array-2.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-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-vid-pentium-m.patch b/i2c/hwmon-vid-pentium-m.patch
deleted file mode 100644
index dd1ceece54b82..0000000000000
--- a/i2c/hwmon-vid-pentium-m.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From khali@linux-fr.org Sun Feb 5 14:20:20 2006
-Date: Sun, 5 Feb 2006 23:21:05 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Cc: Rudolf Marek <r.marek@sh.cvut.cz>
-Subject: [PATCH 04/11] hwmon: Support the Pentium M VID code
-Message-Id: <20060205232105.41cbfcac.khali@linux-fr.org>
-Content-Disposition: inline; filename=hwmon-vid-pentium-m.patch
-
-Add support for the Intel Pentium M series to the hwmon-vid driver.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Cc: Rudolf Marek <r.marek@sh.cvut.cz>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/hwmon/hwmon-vid.c | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
---- gregkh-2.6.orig/drivers/hwmon/hwmon-vid.c
-+++ gregkh-2.6/drivers/hwmon/hwmon-vid.c
-@@ -54,6 +54,10 @@
- (IMVP-II). You can find more information in the datasheet of Max1718
- http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452
-
-+ The 13 specification corresponds to the Intel Pentium M series. There
-+ doesn't seem to be any named specification for these. The conversion
-+ tables are detailed directly in the various Pentium M datasheets:
-+ http://www.intel.com/design/intarch/pentiumm/docs_pentiumm.htm
- */
-
- /* vrm is the VRM/VRD document version multiplied by 10.
-@@ -100,6 +104,8 @@ int vid_from_reg(int val, u8 vrm)
- case 17: /* Intel IMVP-II */
- return(val & 0x10 ? 975 - (val & 0xF) * 25 :
- 1750 - val * 50);
-+ case 13:
-+ return(1708 - (val & 0x3f) * 16);
- default: /* report 0 for unknown */
- printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n");
- return 0;
-@@ -129,8 +135,9 @@ struct vrm_model {
- static struct vrm_model vrm_models[] = {
- {X86_VENDOR_AMD, 0x6, ANY, ANY, 90}, /* Athlon Duron etc */
- {X86_VENDOR_AMD, 0xF, ANY, ANY, 24}, /* Athlon 64, Opteron and above VRM 24 */
-- {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 85}, /* 0.13um too */
-+ {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 13}, /* Pentium M (130 nm) */
- {X86_VENDOR_INTEL, 0x6, 0xB, ANY, 85}, /* Tualatin */
-+ {X86_VENDOR_INTEL, 0x6, 0xD, ANY, 13}, /* Pentium M (90 nm) */
- {X86_VENDOR_INTEL, 0x6, ANY, ANY, 82}, /* any P6 */
- {X86_VENDOR_INTEL, 0x7, ANY, ANY, 0}, /* Itanium */
- {X86_VENDOR_INTEL, 0xF, 0x0, ANY, 90}, /* P4 */
diff --git a/i2c/hwmon-w83627ehf-use-attr-arrays.patch b/i2c/hwmon-w83627ehf-use-attr-arrays.patch
deleted file mode 100644
index ff0d7a15b536a..0000000000000
--- a/i2c/hwmon-w83627ehf-use-attr-arrays.patch
+++ /dev/null
@@ -1,324 +0,0 @@
-From khali@linux-fr.org Sun Feb 5 14:23:33 2006
-Date: Sun, 5 Feb 2006 23:24:16 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Cc: Yuan Mu <ymu@winbond.com.tw>
-Subject: [PATCH 05/11] w83627ehf: Refactor the sysfs interface
-Message-Id: <20060205232416.77fe5912.khali@linux-fr.org>
-Content-Disposition: inline; filename=hwmon-w83627ehf-use-attr-arrays.patch
-
-From: Yuan Mu <ymu@winbond.com.tw>
-
-Use dynamic sysfs callbacks and array of attributes to reduce the
-w83627ehf driver size.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/hwmon/w83627ehf.c | 208 +++++++++++++++++-----------------------------
- 1 file changed, 81 insertions(+), 127 deletions(-)
-
---- gregkh-2.6.orig/drivers/hwmon/w83627ehf.c
-+++ gregkh-2.6/drivers/hwmon/w83627ehf.c
-@@ -42,6 +42,7 @@
- #include <linux/i2c.h>
- #include <linux/i2c-isa.h>
- #include <linux/hwmon.h>
-+#include <linux/hwmon-sysfs.h>
- #include <linux/err.h>
- #include <linux/mutex.h>
- #include <asm/io.h>
-@@ -408,9 +409,12 @@ static struct w83627ehf_data *w83627ehf_
-
- #define show_fan_reg(reg) \
- static ssize_t \
--show_##reg(struct device *dev, char *buf, int nr) \
-+show_##reg(struct device *dev, struct device_attribute *attr, \
-+ char *buf) \
- { \
- struct w83627ehf_data *data = w83627ehf_update_device(dev); \
-+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); \
-+ int nr = sensor_attr->index; \
- return sprintf(buf, "%d\n", \
- fan_from_reg(data->reg[nr], \
- div_from_reg(data->fan_div[nr]))); \
-@@ -419,18 +423,23 @@ show_fan_reg(fan);
- show_fan_reg(fan_min);
-
- static ssize_t
--show_fan_div(struct device *dev, char *buf, int nr)
-+show_fan_div(struct device *dev, struct device_attribute *attr,
-+ char *buf)
- {
- struct w83627ehf_data *data = w83627ehf_update_device(dev);
-- return sprintf(buf, "%u\n",
-- div_from_reg(data->fan_div[nr]));
-+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
-+ int nr = sensor_attr->index;
-+ return sprintf(buf, "%u\n", div_from_reg(data->fan_div[nr]));
- }
-
- static ssize_t
--store_fan_min(struct device *dev, const char *buf, size_t count, int nr)
-+store_fan_min(struct device *dev, struct device_attribute *attr,
-+ const char *buf, size_t count)
- {
- struct i2c_client *client = to_i2c_client(dev);
- struct w83627ehf_data *data = i2c_get_clientdata(client);
-+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
-+ int nr = sensor_attr->index;
- unsigned int val = simple_strtoul(buf, NULL, 10);
- unsigned int reg;
- u8 new_div;
-@@ -488,58 +497,41 @@ store_fan_min(struct device *dev, const
- return count;
- }
-
--#define sysfs_fan_offset(offset) \
--static ssize_t \
--show_reg_fan_##offset(struct device *dev, struct device_attribute *attr, \
-- char *buf) \
--{ \
-- return show_fan(dev, buf, offset-1); \
--} \
--static DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
-- show_reg_fan_##offset, NULL);
-+static struct sensor_device_attribute sda_fan_input[] = {
-+ SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0),
-+ SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1),
-+ SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2),
-+ SENSOR_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3),
-+ SENSOR_ATTR(fan5_input, S_IRUGO, show_fan, NULL, 4),
-+};
-
--#define sysfs_fan_min_offset(offset) \
--static ssize_t \
--show_reg_fan##offset##_min(struct device *dev, struct device_attribute *attr, \
-- char *buf) \
--{ \
-- return show_fan_min(dev, buf, offset-1); \
--} \
--static ssize_t \
--store_reg_fan##offset##_min(struct device *dev, struct device_attribute *attr, \
-- const char *buf, size_t count) \
--{ \
-- return store_fan_min(dev, buf, count, offset-1); \
--} \
--static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
-- show_reg_fan##offset##_min, \
-- store_reg_fan##offset##_min);
-+static struct sensor_device_attribute sda_fan_min[] = {
-+ SENSOR_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min,
-+ store_fan_min, 0),
-+ SENSOR_ATTR(fan2_min, S_IWUSR | S_IRUGO, show_fan_min,
-+ store_fan_min, 1),
-+ SENSOR_ATTR(fan3_min, S_IWUSR | S_IRUGO, show_fan_min,
-+ store_fan_min, 2),
-+ SENSOR_ATTR(fan4_min, S_IWUSR | S_IRUGO, show_fan_min,
-+ store_fan_min, 3),
-+ SENSOR_ATTR(fan5_min, S_IWUSR | S_IRUGO, show_fan_min,
-+ store_fan_min, 4),
-+};
-
--#define sysfs_fan_div_offset(offset) \
--static ssize_t \
--show_reg_fan##offset##_div(struct device *dev, struct device_attribute *attr, \
-- char *buf) \
--{ \
-- return show_fan_div(dev, buf, offset - 1); \
--} \
--static DEVICE_ATTR(fan##offset##_div, S_IRUGO, \
-- show_reg_fan##offset##_div, NULL);
--
--sysfs_fan_offset(1);
--sysfs_fan_min_offset(1);
--sysfs_fan_div_offset(1);
--sysfs_fan_offset(2);
--sysfs_fan_min_offset(2);
--sysfs_fan_div_offset(2);
--sysfs_fan_offset(3);
--sysfs_fan_min_offset(3);
--sysfs_fan_div_offset(3);
--sysfs_fan_offset(4);
--sysfs_fan_min_offset(4);
--sysfs_fan_div_offset(4);
--sysfs_fan_offset(5);
--sysfs_fan_min_offset(5);
--sysfs_fan_div_offset(5);
-+static struct sensor_device_attribute sda_fan_div[] = {
-+ SENSOR_ATTR(fan1_div, S_IRUGO, show_fan_div, NULL, 0),
-+ SENSOR_ATTR(fan2_div, S_IRUGO, show_fan_div, NULL, 1),
-+ SENSOR_ATTR(fan3_div, S_IRUGO, show_fan_div, NULL, 2),
-+ SENSOR_ATTR(fan4_div, S_IRUGO, show_fan_div, NULL, 3),
-+ SENSOR_ATTR(fan5_div, S_IRUGO, show_fan_div, NULL, 4),
-+};
-+
-+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);
-+}
-
- #define show_temp1_reg(reg) \
- static ssize_t \
-@@ -572,17 +564,14 @@ store_temp1_##reg(struct device *dev, st
- store_temp1_reg(OVER, max);
- store_temp1_reg(HYST, max_hyst);
-
--static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1, NULL);
--static DEVICE_ATTR(temp1_max, S_IRUGO| S_IWUSR,
-- show_temp1_max, store_temp1_max);
--static DEVICE_ATTR(temp1_max_hyst, S_IRUGO| S_IWUSR,
-- show_temp1_max_hyst, store_temp1_max_hyst);
--
- #define show_temp_reg(reg) \
- static ssize_t \
--show_##reg (struct device *dev, char *buf, int nr) \
-+show_##reg(struct device *dev, struct device_attribute *attr, \
-+ char *buf) \
- { \
- struct w83627ehf_data *data = w83627ehf_update_device(dev); \
-+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); \
-+ int nr = sensor_attr->index; \
- return sprintf(buf, "%d\n", \
- LM75_TEMP_FROM_REG(data->reg[nr])); \
- }
-@@ -592,10 +581,13 @@ show_temp_reg(temp_max_hyst);
-
- #define store_temp_reg(REG, reg) \
- static ssize_t \
--store_##reg (struct device *dev, const char *buf, size_t count, int nr) \
-+store_##reg(struct device *dev, struct device_attribute *attr, \
-+ const char *buf, size_t count) \
- { \
- struct i2c_client *client = to_i2c_client(dev); \
- struct w83627ehf_data *data = i2c_get_clientdata(client); \
-+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); \
-+ int nr = sensor_attr->index; \
- u32 val = simple_strtoul(buf, NULL, 10); \
- \
- mutex_lock(&data->update_lock); \
-@@ -608,39 +600,23 @@ store_##reg (struct device *dev, const c
- store_temp_reg(OVER, temp_max);
- store_temp_reg(HYST, temp_max_hyst);
-
--#define sysfs_temp_offset(offset) \
--static ssize_t \
--show_reg_temp##offset (struct device *dev, struct device_attribute *attr, \
-- char *buf) \
--{ \
-- return show_temp(dev, buf, offset - 2); \
--} \
--static DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
-- show_reg_temp##offset, NULL);
--
--#define sysfs_temp_reg_offset(reg, offset) \
--static ssize_t \
--show_reg_temp##offset##_##reg(struct device *dev, struct device_attribute *attr, \
-- char *buf) \
--{ \
-- return show_temp_##reg(dev, buf, offset - 2); \
--} \
--static ssize_t \
--store_reg_temp##offset##_##reg(struct device *dev, struct device_attribute *attr, \
-- const char *buf, size_t count) \
--{ \
-- return store_temp_##reg(dev, buf, count, offset - 2); \
--} \
--static DEVICE_ATTR(temp##offset##_##reg, S_IRUGO| S_IWUSR, \
-- show_reg_temp##offset##_##reg, \
-- store_reg_temp##offset##_##reg);
--
--sysfs_temp_offset(2);
--sysfs_temp_reg_offset(max, 2);
--sysfs_temp_reg_offset(max_hyst, 2);
--sysfs_temp_offset(3);
--sysfs_temp_reg_offset(max, 3);
--sysfs_temp_reg_offset(max_hyst, 3);
-+static struct sensor_device_attribute sda_temp[] = {
-+ SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0),
-+ SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0),
-+ SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 1),
-+ SENSOR_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp1_max,
-+ store_temp1_max, 0),
-+ SENSOR_ATTR(temp2_max, S_IRUGO | S_IWUSR, show_temp_max,
-+ store_temp_max, 0),
-+ SENSOR_ATTR(temp3_max, S_IRUGO | S_IWUSR, show_temp_max,
-+ store_temp_max, 1),
-+ SENSOR_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp1_max_hyst,
-+ store_temp1_max_hyst, 0),
-+ SENSOR_ATTR(temp2_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst,
-+ store_temp_max_hyst, 0),
-+ SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst,
-+ store_temp_max_hyst, 1),
-+};
-
- /*
- * Driver and client management
-@@ -674,6 +650,7 @@ static int w83627ehf_detect(struct i2c_a
- {
- struct i2c_client *client;
- struct w83627ehf_data *data;
-+ struct device *dev;
- int i, err = 0;
-
- if (!request_region(address + REGION_OFFSET, REGION_LENGTH,
-@@ -694,6 +671,7 @@ static int w83627ehf_detect(struct i2c_a
- client->adapter = adapter;
- client->driver = &w83627ehf_driver;
- client->flags = 0;
-+ dev = &client->dev;
-
- strlcpy(client->name, "w83627ehf", I2C_NAME_SIZE);
- data->valid = 0;
-@@ -721,42 +699,18 @@ static int w83627ehf_detect(struct i2c_a
- data->has_fan |= (1 << 4);
-
- /* Register sysfs hooks */
-- data->class_dev = hwmon_device_register(&client->dev);
-+ data->class_dev = hwmon_device_register(dev);
- if (IS_ERR(data->class_dev)) {
- err = PTR_ERR(data->class_dev);
- goto exit_detach;
- }
-
-- device_create_file(&client->dev, &dev_attr_fan1_input);
-- device_create_file(&client->dev, &dev_attr_fan1_min);
-- device_create_file(&client->dev, &dev_attr_fan1_div);
-- device_create_file(&client->dev, &dev_attr_fan2_input);
-- device_create_file(&client->dev, &dev_attr_fan2_min);
-- device_create_file(&client->dev, &dev_attr_fan2_div);
-- device_create_file(&client->dev, &dev_attr_fan3_input);
-- device_create_file(&client->dev, &dev_attr_fan3_min);
-- device_create_file(&client->dev, &dev_attr_fan3_div);
--
-- if (data->has_fan & (1 << 3)) {
-- device_create_file(&client->dev, &dev_attr_fan4_input);
-- device_create_file(&client->dev, &dev_attr_fan4_min);
-- device_create_file(&client->dev, &dev_attr_fan4_div);
-- }
-- if (data->has_fan & (1 << 4)) {
-- device_create_file(&client->dev, &dev_attr_fan5_input);
-- device_create_file(&client->dev, &dev_attr_fan5_min);
-- device_create_file(&client->dev, &dev_attr_fan5_div);
-- }
--
-- device_create_file(&client->dev, &dev_attr_temp1_input);
-- device_create_file(&client->dev, &dev_attr_temp1_max);
-- device_create_file(&client->dev, &dev_attr_temp1_max_hyst);
-- device_create_file(&client->dev, &dev_attr_temp2_input);
-- device_create_file(&client->dev, &dev_attr_temp2_max);
-- device_create_file(&client->dev, &dev_attr_temp2_max_hyst);
-- device_create_file(&client->dev, &dev_attr_temp3_input);
-- device_create_file(&client->dev, &dev_attr_temp3_max);
-- device_create_file(&client->dev, &dev_attr_temp3_max_hyst);
-+ for (i = 0; i < 5; i++) {
-+ if (data->has_fan & (1 << i))
-+ device_create_file_fan(dev, i);
-+ }
-+ for (i = 0; i < ARRAY_SIZE(sda_temp); i++)
-+ device_create_file(dev, &sda_temp[i].dev_attr);
-
- return 0;
-
diff --git a/i2c/hwmon-w83627hf-add-w83687thf-support.patch b/i2c/hwmon-w83627hf-add-w83687thf-support.patch
deleted file mode 100644
index b376e2b9b5f2a..0000000000000
--- a/i2c/hwmon-w83627hf-add-w83687thf-support.patch
+++ /dev/null
@@ -1,252 +0,0 @@
-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/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.
---- 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] =
diff --git a/i2c/hwmon-w83781d-document-alarm-bits.patch b/i2c/hwmon-w83781d-document-alarm-bits.patch
deleted file mode 100644
index 193a3abed9151..0000000000000
--- a/i2c/hwmon-w83781d-document-alarm-bits.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From khali@linux-fr.org Sun Feb 5 14:24:40 2006
-Date: Sun, 5 Feb 2006 23:25:25 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: [PATCH 06/11] w83781d: Document the alarm and beep bits
-Message-Id: <20060205232525.4a6377e1.khali@linux-fr.org>
-Content-Disposition: inline; filename=hwmon-w83781d-document-alarm-bits.patch
-
-Document the individual alarm and beep bits of the w83781d driver.
-Ideally we would offer a chip-independant interface for them, but
-until it's done, it's only fair that we document the current
-interface.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- Documentation/hwmon/w83781d | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
-
---- gregkh-2.6.orig/Documentation/hwmon/w83781d
-+++ gregkh-2.6/Documentation/hwmon/w83781d
-@@ -123,6 +123,25 @@ When an alarm goes off, you can be warne
- your computer speaker. It is possible to enable all beeping globally,
- or only the beeping for some alarms.
-
-+Individual alarm and beep bits:
-+
-+0x000001: in0
-+0x000002: in1
-+0x000004: in2
-+0x000008: in3
-+0x000010: temp1
-+0x000020: temp2 (+temp3 on W83781D)
-+0x000040: fan1
-+0x000080: fan2
-+0x000100: in4
-+0x000200: in5
-+0x000400: in6
-+0x000800: fan3
-+0x001000: chassis
-+0x002000: temp3 (W83782D and W83627HF only)
-+0x010000: in7 (W83782D and W83627HF only)
-+0x020000: in8 (W83782D and W83627HF only)
-+
- If an alarm triggers, it will remain triggered until the hardware register
- is read at least once. This means that the cause for the alarm may
- already have disappeared! Note that in the current implementation, all
diff --git a/i2c/hwmon-w83781d-no-reset-by-default.patch b/i2c/hwmon-w83781d-no-reset-by-default.patch
deleted file mode 100644
index a4db3f4613204..0000000000000
--- a/i2c/hwmon-w83781d-no-reset-by-default.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From khali@linux-fr.org Sun Feb 5 14:26:07 2006
-Date: Sun, 5 Feb 2006 23:26:51 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: [PATCH 07/11] w83781d: Don't reset the chip by default
-Message-Id: <20060205232651.5a0be1e4.khali@linux-fr.org>
-Content-Disposition: inline; filename=hwmon-w83781d-no-reset-by-default.patch
-
-Stop resetting the chip on load by default, so as to preserve the BIOS
-initializations. Same was done in the w83627hf driver some times ago
-for the same reasons.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- Documentation/hwmon/w83781d | 5 +++++
- drivers/hwmon/w83781d.c | 22 +++++++++++++++++++++-
- 2 files changed, 26 insertions(+), 1 deletion(-)
-
---- gregkh-2.6.orig/Documentation/hwmon/w83781d
-+++ gregkh-2.6/Documentation/hwmon/w83781d
-@@ -36,6 +36,11 @@ Module parameters
- Use 'init=0' to bypass initializing the chip.
- Try this if your computer crashes when you load the module.
-
-+* reset int
-+ (default 0)
-+ The driver used to reset the chip on load, but does no more. Use
-+ 'reset=1' to restore the old behavior. Report if you need to do this.
-+
- force_subclients=bus,caddr,saddr,saddr
- This is used to force the i2c addresses for subclients of
- a certain chip. Typical usage is `force_subclients=0,0x2d,0x4a,0x4b'
---- gregkh-2.6.orig/drivers/hwmon/w83781d.c
-+++ gregkh-2.6/drivers/hwmon/w83781d.c
-@@ -57,6 +57,10 @@ I2C_CLIENT_INSMOD_5(w83781d, w83782d, w8
- I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: "
- "{bus, clientaddr, subclientaddr1, subclientaddr2}");
-
-+static int reset;
-+module_param(reset, bool, 0);
-+MODULE_PARM_DESC(reset, "Set to one to reset chip on load");
-+
- static int init = 1;
- module_param(init, bool, 0);
- MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
-@@ -1460,8 +1464,17 @@ w83781d_init_client(struct i2c_client *c
- int type = data->type;
- u8 tmp;
-
-- if (init && type != as99127f) { /* this resets registers we don't have
-+ if (reset && type != as99127f) { /* this resets registers we don't have
- documentation for on the as99127f */
-+ /* Resetting the chip has been the default for a long time,
-+ but it causes the BIOS initializations (fan clock dividers,
-+ thermal sensor types...) to be lost, so it is now optional.
-+ It might even go away if nobody reports it as being useful,
-+ as I see very little reason why this would be needed at
-+ all. */
-+ dev_info(&client->dev, "If reset=1 solved a problem you were "
-+ "having, please report!\n");
-+
- /* save these registers */
- i = w83781d_read_value(client, W83781D_REG_BEEP_CONFIG);
- p = w83781d_read_value(client, W83781D_REG_PWMCLK12);
-@@ -1478,6 +1491,13 @@ w83781d_init_client(struct i2c_client *c
- w83781d_write_value(client, W83781D_REG_BEEP_INTS2, 0);
- }
-
-+ /* Disable power-on abnormal beep, as advised by the datasheet.
-+ Already done if reset=1. */
-+ if (init && !reset && type != as99127f) {
-+ i = w83781d_read_value(client, W83781D_REG_BEEP_CONFIG);
-+ w83781d_write_value(client, W83781D_REG_BEEP_CONFIG, i | 0x80);
-+ }
-+
- data->vrm = vid_which_vrm();
-
- if ((type != w83781d) && (type != as99127f)) {
diff --git a/i2c/hwmon-w83792d-drop-useless-macros.patch b/i2c/hwmon-w83792d-drop-useless-macros.patch
deleted file mode 100644
index a6a2918c8fc80..0000000000000
--- a/i2c/hwmon-w83792d-drop-useless-macros.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-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
deleted file mode 100644
index 5a4d33b73c9fc..0000000000000
--- a/i2c/hwmon-w83792d-use-attr-arrays.patch
+++ /dev/null
@@ -1,748 +0,0 @@
-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-ali1535-drop-redundant-mutex.patch b/i2c/i2c-ali1535-drop-redundant-mutex.patch
deleted file mode 100644
index 60e10cb29b200..0000000000000
--- a/i2c/i2c-ali1535-drop-redundant-mutex.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From khali@linux-fr.org Mon Feb 27 14:07:24 2006
-Date: Mon, 27 Feb 2006 23:08:18 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: I2C: i2c-ali1535: Drop redundant mutex
-Message-Id: <20060227230818.468ef991.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-ali1535-drop-redundant-mutex.patch
-
-Drop a redundant mutex in driver i2c-ali1535. The struct i2c_adapter
-includes a mutex for the same purpose, operated by i2c-core.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/i2c/busses/i2c-ali1535.c | 4 ----
- 1 file changed, 4 deletions(-)
-
---- gregkh-2.6.orig/drivers/i2c/busses/i2c-ali1535.c
-+++ gregkh-2.6/drivers/i2c/busses/i2c-ali1535.c
-@@ -62,7 +62,6 @@
- #include <linux/ioport.h>
- #include <linux/i2c.h>
- #include <linux/init.h>
--#include <linux/mutex.h>
- #include <asm/io.h>
-
-
-@@ -136,7 +135,6 @@
-
- static struct pci_driver ali1535_driver;
- static unsigned short ali1535_smba;
--static DEFINE_MUTEX(i2c_ali1535_mutex);
-
- /* Detect whether a ALI1535 can be found, and initialize it, where necessary.
- Note the differences between kernels with the old PCI BIOS interface and
-@@ -345,7 +343,6 @@ static s32 ali1535_access(struct i2c_ada
- int timeout;
- s32 result = 0;
-
-- mutex_lock(&i2c_ali1535_mutex);
- /* make sure SMBus is idle */
- temp = inb_p(SMBHSTSTS);
- for (timeout = 0;
-@@ -460,7 +457,6 @@ static s32 ali1535_access(struct i2c_ada
- break;
- }
- EXIT:
-- mutex_unlock(&i2c_ali1535_mutex);
- return result;
- }
-
diff --git a/i2c/i2c-amd756-s4882-mutex-init.patch b/i2c/i2c-amd756-s4882-mutex-init.patch
deleted file mode 100644
index 29a2c1b04bd64..0000000000000
--- a/i2c/i2c-amd756-s4882-mutex-init.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From khali@linux-fr.org Mon Feb 27 14:08:27 2006
-Date: Mon, 27 Feb 2006 23:09:22 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: I2C: i2c-amd756-s4882: Improve static mutex initialization
-Message-Id: <20060227230922.e540201d.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-amd756-s4882-mutex-init.patch
-
-Static mutexes can be initialized at declaration time.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
----
- drivers/i2c/busses/i2c-amd756-s4882.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
---- gregkh-2.6.orig/drivers/i2c/busses/i2c-amd756-s4882.c
-+++ gregkh-2.6/drivers/i2c/busses/i2c-amd756-s4882.c
-@@ -46,7 +46,7 @@ static struct i2c_adapter *s4882_adapter
- static struct i2c_algorithm *s4882_algo;
-
- /* Wrapper access functions for multiplexed SMBus */
--static struct mutex amd756_lock;
-+static DEFINE_MUTEX(amd756_lock);
-
- static s32 amd756_access_virt0(struct i2c_adapter * adap, u16 addr,
- unsigned short flags, char read_write,
-@@ -167,8 +167,6 @@ static int __init amd756_s4882_init(void
- }
-
- printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n");
-- mutex_init(&amd756_lock);
--
- /* Define the 5 virtual adapters and algorithms structures */
- if (!(s4882_adapter = kzalloc(5 * sizeof(struct i2c_adapter),
- GFP_KERNEL))) {
diff --git a/i2c/i2c-convert-i2c-to-mutexes.patch b/i2c/i2c-convert-i2c-to-mutexes.patch
deleted file mode 100644
index c0dd72a46f376..0000000000000
--- a/i2c/i2c-convert-i2c-to-mutexes.patch
+++ /dev/null
@@ -1,270 +0,0 @@
-From SRS0+792853cd028d39ab690f+871+infradead.org+arjan@pentafluge.srs.infradead.org Wed Jan 11 13:12:32 2006
-From: Arjan van de Ven <arjan@infradead.org>
-Subject: I2C: Convert i2c to mutexes
-To: gregkh@kroah.com
-Cc: mingo@elte.hu
-Date: Wed, 11 Jan 2006 10:50:26 +0100
-Message-Id: <1136973027.2929.19.camel@laptopd505.fenrus.org>
-
-The patch below converts a few i2c semaphores to mutexes
-
-Signed-off-by: Arjan van de Ven <arjan@infradead.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-
----
- drivers/i2c/busses/i2c-ali1535.c | 7 ++++---
- drivers/i2c/chips/ds1374.c | 11 ++++++-----
- drivers/i2c/chips/m41t00.c | 11 ++++++-----
- drivers/i2c/i2c-core.c | 23 ++++++++++++-----------
- 4 files changed, 28 insertions(+), 24 deletions(-)
-
---- gregkh-2.6.orig/drivers/i2c/busses/i2c-ali1535.c
-+++ gregkh-2.6/drivers/i2c/busses/i2c-ali1535.c
-@@ -62,6 +62,7 @@
- #include <linux/ioport.h>
- #include <linux/i2c.h>
- #include <linux/init.h>
-+#include <linux/mutex.h>
- #include <asm/io.h>
- #include <asm/semaphore.h>
-
-@@ -136,7 +137,7 @@
-
- static struct pci_driver ali1535_driver;
- static unsigned short ali1535_smba;
--static DECLARE_MUTEX(i2c_ali1535_sem);
-+static DEFINE_MUTEX(i2c_ali1535_mutex);
-
- /* Detect whether a ALI1535 can be found, and initialize it, where necessary.
- Note the differences between kernels with the old PCI BIOS interface and
-@@ -345,7 +346,7 @@ static s32 ali1535_access(struct i2c_ada
- int timeout;
- s32 result = 0;
-
-- down(&i2c_ali1535_sem);
-+ mutex_lock(&i2c_ali1535_mutex);
- /* make sure SMBus is idle */
- temp = inb_p(SMBHSTSTS);
- for (timeout = 0;
-@@ -460,7 +461,7 @@ static s32 ali1535_access(struct i2c_ada
- break;
- }
- EXIT:
-- up(&i2c_ali1535_sem);
-+ mutex_unlock(&i2c_ali1535_mutex);
- return result;
- }
-
---- gregkh-2.6.orig/drivers/i2c/chips/ds1374.c
-+++ gregkh-2.6/drivers/i2c/chips/ds1374.c
-@@ -26,6 +26,7 @@
- #include <linux/i2c.h>
- #include <linux/rtc.h>
- #include <linux/bcd.h>
-+#include <linux/mutex.h>
-
- #define DS1374_REG_TOD0 0x00
- #define DS1374_REG_TOD1 0x01
-@@ -41,7 +42,7 @@
-
- #define DS1374_DRV_NAME "ds1374"
-
--static DECLARE_MUTEX(ds1374_mutex);
-+static DEFINE_MUTEX(ds1374_mutex);
-
- static struct i2c_driver ds1374_driver;
- static struct i2c_client *save_client;
-@@ -114,7 +115,7 @@ ulong ds1374_get_rtc_time(void)
- ulong t1, t2;
- int limit = 10; /* arbitrary retry limit */
-
-- down(&ds1374_mutex);
-+ mutex_lock(&ds1374_mutex);
-
- /*
- * Since the reads are being performed one byte at a time using
-@@ -127,7 +128,7 @@ ulong ds1374_get_rtc_time(void)
- t2 = ds1374_read_rtc();
- } while (t1 != t2 && limit--);
-
-- up(&ds1374_mutex);
-+ mutex_unlock(&ds1374_mutex);
-
- if (t1 != t2) {
- dev_warn(&save_client->dev,
-@@ -145,7 +146,7 @@ static void ds1374_set_tlet(ulong arg)
-
- t1 = *(ulong *) arg;
-
-- down(&ds1374_mutex);
-+ mutex_lock(&ds1374_mutex);
-
- /*
- * Since the writes are being performed one byte at a time using
-@@ -158,7 +159,7 @@ static void ds1374_set_tlet(ulong arg)
- t2 = ds1374_read_rtc();
- } while (t1 != t2 && limit--);
-
-- up(&ds1374_mutex);
-+ mutex_unlock(&ds1374_mutex);
-
- if (t1 != t2)
- dev_warn(&save_client->dev,
---- gregkh-2.6.orig/drivers/i2c/chips/m41t00.c
-+++ gregkh-2.6/drivers/i2c/chips/m41t00.c
-@@ -24,13 +24,14 @@
- #include <linux/i2c.h>
- #include <linux/rtc.h>
- #include <linux/bcd.h>
-+#include <linux/mutex.h>
-
- #include <asm/time.h>
- #include <asm/rtc.h>
-
- #define M41T00_DRV_NAME "m41t00"
-
--static DECLARE_MUTEX(m41t00_mutex);
-+static DEFINE_MUTEX(m41t00_mutex);
-
- static struct i2c_driver m41t00_driver;
- static struct i2c_client *save_client;
-@@ -54,7 +55,7 @@ m41t00_get_rtc_time(void)
- sec = min = hour = day = mon = year = 0;
- sec1 = min1 = hour1 = day1 = mon1 = year1 = 0;
-
-- down(&m41t00_mutex);
-+ mutex_lock(&m41t00_mutex);
- do {
- if (((sec = i2c_smbus_read_byte_data(save_client, 0)) >= 0)
- && ((min = i2c_smbus_read_byte_data(save_client, 1))
-@@ -80,7 +81,7 @@ m41t00_get_rtc_time(void)
- mon1 = mon;
- year1 = year;
- } while (--limit > 0);
-- up(&m41t00_mutex);
-+ mutex_unlock(&m41t00_mutex);
-
- if (limit == 0) {
- dev_warn(&save_client->dev,
-@@ -125,7 +126,7 @@ m41t00_set_tlet(ulong arg)
- BIN_TO_BCD(tm.tm_mday);
- BIN_TO_BCD(tm.tm_year);
-
-- down(&m41t00_mutex);
-+ mutex_lock(&m41t00_mutex);
- if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0)
- || (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f)
- < 0)
-@@ -140,7 +141,7 @@ m41t00_set_tlet(ulong arg)
-
- dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n");
-
-- up(&m41t00_mutex);
-+ mutex_unlock(&m41t00_mutex);
- return;
- }
-
---- gregkh-2.6.orig/drivers/i2c/i2c-core.c
-+++ gregkh-2.6/drivers/i2c/i2c-core.c
-@@ -31,12 +31,13 @@
- #include <linux/idr.h>
- #include <linux/seq_file.h>
- #include <linux/platform_device.h>
-+#include <linux/mutex.h>
- #include <asm/uaccess.h>
-
-
- static LIST_HEAD(adapters);
- static LIST_HEAD(drivers);
--static DECLARE_MUTEX(core_lists);
-+static DEFINE_MUTEX(core_lists);
- static DEFINE_IDR(i2c_adapter_idr);
-
- /* match always succeeds, as we want the probe() to tell if we really accept this match */
-@@ -153,7 +154,7 @@ int i2c_add_adapter(struct i2c_adapter *
- struct list_head *item;
- struct i2c_driver *driver;
-
-- down(&core_lists);
-+ mutex_lock(&core_lists);
-
- if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) {
- res = -ENOMEM;
-@@ -203,7 +204,7 @@ int i2c_add_adapter(struct i2c_adapter *
- }
-
- out_unlock:
-- up(&core_lists);
-+ mutex_unlock(&core_lists);
- return res;
- }
-
-@@ -216,7 +217,7 @@ int i2c_del_adapter(struct i2c_adapter *
- struct i2c_client *client;
- int res = 0;
-
-- down(&core_lists);
-+ mutex_lock(&core_lists);
-
- /* First make sure that this adapter was ever added */
- list_for_each_entry(adap_from_list, &adapters, list) {
-@@ -272,7 +273,7 @@ int i2c_del_adapter(struct i2c_adapter *
- dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
-
- out_unlock:
-- up(&core_lists);
-+ mutex_unlock(&core_lists);
- return res;
- }
-
-@@ -289,7 +290,7 @@ int i2c_register_driver(struct module *o
- struct i2c_adapter *adapter;
- int res = 0;
-
-- down(&core_lists);
-+ mutex_lock(&core_lists);
-
- /* add the driver to the list of i2c drivers in the driver core */
- driver->driver.owner = owner;
-@@ -311,7 +312,7 @@ int i2c_register_driver(struct module *o
- }
-
- out_unlock:
-- up(&core_lists);
-+ mutex_unlock(&core_lists);
- return res;
- }
- EXPORT_SYMBOL(i2c_register_driver);
-@@ -324,7 +325,7 @@ int i2c_del_driver(struct i2c_driver *dr
-
- int res = 0;
-
-- down(&core_lists);
-+ mutex_lock(&core_lists);
-
- /* Have a look at each adapter, if clients of this driver are still
- * attached. If so, detach them to be able to kill the driver
-@@ -363,7 +364,7 @@ int i2c_del_driver(struct i2c_driver *dr
- pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
-
- out_unlock:
-- up(&core_lists);
-+ mutex_unlock(&core_lists);
- return 0;
- }
-
-@@ -779,12 +780,12 @@ struct i2c_adapter* i2c_get_adapter(int
- {
- struct i2c_adapter *adapter;
-
-- down(&core_lists);
-+ mutex_lock(&core_lists);
- adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id);
- if (adapter && !try_module_get(adapter->owner))
- adapter = NULL;
-
-- up(&core_lists);
-+ mutex_unlock(&core_lists);
- return adapter;
- }
-
diff --git a/i2c/i2c-convert-semaphores-to-mutexes-2.patch b/i2c/i2c-convert-semaphores-to-mutexes-2.patch
deleted file mode 100644
index c987677dc04ec..0000000000000
--- a/i2c/i2c-convert-semaphores-to-mutexes-2.patch
+++ /dev/null
@@ -1,596 +0,0 @@
-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
-@@ -125,7 +125,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
deleted file mode 100644
index ff294c3987b2d..0000000000000
--- a/i2c/i2c-convert-semaphores-to-mutexes-3.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-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-core-optimize-mutex-use.patch b/i2c/i2c-core-optimize-mutex-use.patch
deleted file mode 100644
index 7beba551790da..0000000000000
--- a/i2c/i2c-core-optimize-mutex-use.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From khali@linux-fr.org Sun Feb 5 14:27:37 2006
-Date: Sun, 5 Feb 2006 23:28:21 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Cc: Ingo Molnar <mingo@elte.hu>
-Subject: [PATCH 08/11] i2c: Optimize core_lists mutex usage
-Message-Id: <20060205232821.25bd8615.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-core-optimize-mutex-use.patch
-
-Stop holding the core_lists mutex when we don't actually need it.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/i2c/i2c-core.c | 11 +++++------
- 1 file changed, 5 insertions(+), 6 deletions(-)
-
---- gregkh-2.6.orig/drivers/i2c/i2c-core.c
-+++ gregkh-2.6/drivers/i2c/i2c-core.c
-@@ -288,9 +288,7 @@ int i2c_register_driver(struct module *o
- {
- struct list_head *item;
- struct i2c_adapter *adapter;
-- int res = 0;
--
-- mutex_lock(&core_lists);
-+ int res;
-
- /* add the driver to the list of i2c drivers in the driver core */
- driver->driver.owner = owner;
-@@ -298,8 +296,10 @@ int i2c_register_driver(struct module *o
-
- res = driver_register(&driver->driver);
- if (res)
-- goto out_unlock;
-+ return res;
-
-+ mutex_lock(&core_lists);
-+
- list_add_tail(&driver->list,&drivers);
- pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
-
-@@ -311,9 +311,8 @@ int i2c_register_driver(struct module *o
- }
- }
-
-- out_unlock:
- mutex_unlock(&core_lists);
-- return res;
-+ return 0;
- }
- EXPORT_SYMBOL(i2c_register_driver);
-
diff --git a/i2c/i2c-drop-frodo.patch b/i2c/i2c-drop-frodo.patch
deleted file mode 100644
index b4920dad31290..0000000000000
--- a/i2c/i2c-drop-frodo.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From khali@linux-fr.org Sun Feb 5 14:28:34 2006
-Date: Sun, 5 Feb 2006 23:29:18 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: [PATCH 09/11] i2c: Drop the i2c-frodo bus driver
-Message-Id: <20060205232918.3e58e54c.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-drop-frodo.patch
-
-Drop the i2c-frodo bus driver. It isn't referenced by the build
-system, and depends on code which was never included in 2.6 kernels.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/i2c/busses/i2c-frodo.c | 85 -----------------------------------------
- include/linux/i2c-id.h | 1
- 2 files changed, 86 deletions(-)
-
---- gregkh-2.6.orig/drivers/i2c/busses/i2c-frodo.c
-+++ /dev/null
-@@ -1,85 +0,0 @@
--
--/*
-- * linux/drivers/i2c/i2c-frodo.c
-- *
-- * Author: Abraham van der Merwe <abraham@2d3d.co.za>
-- *
-- * An I2C adapter driver for the 2d3D, Inc. StrongARM SA-1110
-- * Development board (Frodo).
-- *
-- * This source code is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU General Public License
-- * version 2 as published by the Free Software Foundation.
-- */
--
--#include <linux/module.h>
--#include <linux/kernel.h>
--#include <linux/init.h>
--#include <linux/delay.h>
--#include <linux/i2c.h>
--#include <linux/i2c-algo-bit.h>
--#include <asm/hardware.h>
--
--
--static void frodo_setsda (void *data,int state)
--{
-- if (state)
-- FRODO_CPLD_I2C |= FRODO_I2C_SDA_OUT;
-- else
-- FRODO_CPLD_I2C &= ~FRODO_I2C_SDA_OUT;
--}
--
--static void frodo_setscl (void *data,int state)
--{
-- if (state)
-- FRODO_CPLD_I2C |= FRODO_I2C_SCL_OUT;
-- else
-- FRODO_CPLD_I2C &= ~FRODO_I2C_SCL_OUT;
--}
--
--static int frodo_getsda (void *data)
--{
-- return ((FRODO_CPLD_I2C & FRODO_I2C_SDA_IN) != 0);
--}
--
--static int frodo_getscl (void *data)
--{
-- return ((FRODO_CPLD_I2C & FRODO_I2C_SCL_IN) != 0);
--}
--
--static struct i2c_algo_bit_data bit_frodo_data = {
-- .setsda = frodo_setsda,
-- .setscl = frodo_setscl,
-- .getsda = frodo_getsda,
-- .getscl = frodo_getscl,
-- .udelay = 80,
-- .mdelay = 80,
-- .timeout = HZ
--};
--
--static struct i2c_adapter frodo_ops = {
-- .owner = THIS_MODULE,
-- .id = I2C_HW_B_FRODO,
-- .algo_data = &bit_frodo_data,
-- .dev = {
-- .name = "Frodo adapter driver",
-- },
--};
--
--static int __init i2c_frodo_init (void)
--{
-- return i2c_bit_add_bus(&frodo_ops);
--}
--
--static void __exit i2c_frodo_exit (void)
--{
-- i2c_bit_del_bus(&frodo_ops);
--}
--
--MODULE_AUTHOR ("Abraham van der Merwe <abraham@2d3d.co.za>");
--MODULE_DESCRIPTION ("I2C-Bus adapter routines for Frodo");
--MODULE_LICENSE ("GPL");
--
--module_init (i2c_frodo_init);
--module_exit (i2c_frodo_exit);
--
---- gregkh-2.6.orig/include/linux/i2c-id.h
-+++ gregkh-2.6/include/linux/i2c-id.h
-@@ -172,7 +172,6 @@
- #define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
- #define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
- #define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */
--#define I2C_HW_B_FRODO 0x010013 /* 2d3D SA-1110 Development Board */
- #define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */
- #define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */
- #define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
diff --git a/i2c/i2c-drop-unneeded-i2c-dev-h-includes.patch b/i2c/i2c-drop-unneeded-i2c-dev-h-includes.patch
deleted file mode 100644
index c75c5a5b2e1d1..0000000000000
--- a/i2c/i2c-drop-unneeded-i2c-dev-h-includes.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From khali@linux-fr.org Mon Feb 27 14:13:02 2006
-Date: Mon, 27 Feb 2006 23:13:53 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: I2C: Drop unneeded i2c-dev.h includes
-Message-Id: <20060227231353.9e7f6cc9.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-drop-unneeded-i2c-dev-h-includes.patch
-
-Several media/video and sound drivers include i2c-dev.h while they
-don't need it at all. Clean it up.
-
-This header file is really only needed by i2c-dev.c and
-compat_ioctl.c, other drivers should never need it.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/media/video/adv7170.c | 1 -
- drivers/media/video/adv7175.c | 1 -
- drivers/media/video/bt819.c | 1 -
- drivers/media/video/bt856.c | 1 -
- drivers/media/video/saa7110.c | 1 -
- drivers/media/video/saa7111.c | 1 -
- drivers/media/video/saa7114.c | 1 -
- drivers/media/video/saa711x.c | 1 -
- drivers/media/video/saa7185.c | 1 -
- drivers/media/video/vpx3220.c | 1 -
- sound/oss/dmasound/dmasound_awacs.c | 2 --
- sound/ppc/daca.c | 1 -
- sound/ppc/keywest.c | 1 -
- sound/ppc/toonie.c | 1 -
- sound/ppc/tumbler.c | 1 -
- 15 files changed, 16 deletions(-)
-
---- gregkh-2.6.orig/drivers/media/video/adv7170.c
-+++ gregkh-2.6/drivers/media/video/adv7170.c
-@@ -53,7 +53,6 @@ MODULE_AUTHOR("Maxim Yevtyushkin");
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(x) (x)->name
-
---- gregkh-2.6.orig/drivers/media/video/adv7175.c
-+++ gregkh-2.6/drivers/media/video/adv7175.c
-@@ -49,7 +49,6 @@ MODULE_AUTHOR("Dave Perks");
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(s) (s)->name
-
---- gregkh-2.6.orig/drivers/media/video/bt819.c
-+++ gregkh-2.6/drivers/media/video/bt819.c
-@@ -53,7 +53,6 @@ MODULE_AUTHOR("Mike Bernson & Dave Perks
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(s) (s)->name
-
---- gregkh-2.6.orig/drivers/media/video/bt856.c
-+++ gregkh-2.6/drivers/media/video/bt856.c
-@@ -53,7 +53,6 @@ MODULE_AUTHOR("Mike Bernson & Dave Perks
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(s) (s)->name
-
---- gregkh-2.6.orig/drivers/media/video/saa7110.c
-+++ gregkh-2.6/drivers/media/video/saa7110.c
-@@ -39,7 +39,6 @@ MODULE_AUTHOR("Pauline Middelink");
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(s) (s)->name
-
---- gregkh-2.6.orig/drivers/media/video/saa7111.c
-+++ gregkh-2.6/drivers/media/video/saa7111.c
-@@ -52,7 +52,6 @@ MODULE_AUTHOR("Dave Perks");
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(s) (s)->name
-
---- gregkh-2.6.orig/drivers/media/video/saa7114.c
-+++ gregkh-2.6/drivers/media/video/saa7114.c
-@@ -55,7 +55,6 @@ MODULE_AUTHOR("Maxim Yevtyushkin");
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(x) (x)->name
-
---- gregkh-2.6.orig/drivers/media/video/saa711x.c
-+++ gregkh-2.6/drivers/media/video/saa711x.c
-@@ -45,7 +45,6 @@ MODULE_AUTHOR("Dave Perks, Jose Ignacio
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(s) (s)->name
-
---- gregkh-2.6.orig/drivers/media/video/saa7185.c
-+++ gregkh-2.6/drivers/media/video/saa7185.c
-@@ -49,7 +49,6 @@ MODULE_AUTHOR("Dave Perks");
- MODULE_LICENSE("GPL");
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(s) (s)->name
-
---- gregkh-2.6.orig/drivers/media/video/vpx3220.c
-+++ gregkh-2.6/drivers/media/video/vpx3220.c
-@@ -30,7 +30,6 @@
- #include <asm/uaccess.h>
-
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
-
- #define I2C_NAME(x) (x)->name
-
---- gregkh-2.6.orig/sound/oss/dmasound/dmasound_awacs.c
-+++ gregkh-2.6/sound/oss/dmasound/dmasound_awacs.c
-@@ -88,8 +88,6 @@
- #include <linux/pmu.h>
- #endif
-
--#include <linux/i2c-dev.h>
--
- #include <asm/uaccess.h>
- #include <asm/prom.h>
- #include <asm/machdep.h>
---- gregkh-2.6.orig/sound/ppc/daca.c
-+++ gregkh-2.6/sound/ppc/daca.c
-@@ -22,7 +22,6 @@
- #include <sound/driver.h>
- #include <linux/init.h>
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
- #include <linux/kmod.h>
- #include <linux/slab.h>
- #include <sound/core.h>
---- gregkh-2.6.orig/sound/ppc/keywest.c
-+++ gregkh-2.6/sound/ppc/keywest.c
-@@ -23,7 +23,6 @@
- #include <linux/init.h>
- #include <linux/i2c.h>
- #include <linux/delay.h>
--#include <linux/i2c-dev.h>
- #include <linux/slab.h>
- #include <sound/core.h>
- #include "pmac.h"
---- gregkh-2.6.orig/sound/ppc/toonie.c
-+++ gregkh-2.6/sound/ppc/toonie.c
-@@ -22,7 +22,6 @@
- #include <linux/init.h>
- #include <linux/delay.h>
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
- #include <linux/kmod.h>
- #include <linux/slab.h>
- #include <linux/interrupt.h>
---- gregkh-2.6.orig/sound/ppc/tumbler.c
-+++ gregkh-2.6/sound/ppc/tumbler.c
-@@ -28,7 +28,6 @@
- #include <linux/init.h>
- #include <linux/delay.h>
- #include <linux/i2c.h>
--#include <linux/i2c-dev.h>
- #include <linux/kmod.h>
- #include <linux/slab.h>
- #include <linux/interrupt.h>
diff --git a/i2c/i2c-fix-sx200_acb-build-on-other-arches.patch b/i2c/i2c-fix-sx200_acb-build-on-other-arches.patch
deleted file mode 100644
index b2ba5cc749725..0000000000000
--- a/i2c/i2c-fix-sx200_acb-build-on-other-arches.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From khali@linux-fr.org Sun Jan 22 03:28:59 2006
-Date: Sun, 22 Jan 2006 12:28:57 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Andrew Morton <akpm@osdl.org>
-Cc: Dave Jones <davej@redhat.com>, Greg KH <greg@kroah.com>, Ben Gardner <bgardner@wabtec.com>
-Subject: I2C: fix sx200_acb build on other arches
-Message-Id: <20060122122857.008a5e61.khali@linux-fr.org>
-
-
-scx200_acb is only useful on a few Geode-based systems, and won't
-compile on non-x86 systems due to the lack of asm/msr.h, as reported
-by Andrew Morton. Thus, we should make that driver depend on X86.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
----
- drivers/i2c/busses/Kconfig | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- gregkh-2.6.orig/drivers/i2c/busses/Kconfig
-+++ gregkh-2.6/drivers/i2c/busses/Kconfig
-@@ -390,7 +390,7 @@ config SCx200_I2C_SDA
-
- config SCx200_ACB
- tristate "Geode ACCESS.bus support"
-- depends on I2C && PCI
-+ depends on X86_32 && I2C && PCI
- help
- Enable the use of the ACCESS.bus controllers on the Geode SCx200 and
- SC1100 processors and the CS5535 and CS5536 Geode companion devices.
diff --git a/i2c/i2c-isp1301_omap-driver-cleanups.patch b/i2c/i2c-isp1301_omap-driver-cleanups.patch
deleted file mode 100644
index da070e9cf0d85..0000000000000
--- a/i2c/i2c-isp1301_omap-driver-cleanups.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From khali@linux-fr.org Sun Feb 5 14:30:40 2006
-Date: Sun, 5 Feb 2006 23:31:25 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: [PATCH 11/11] i2c: Cleanup isp1301_omap
-Message-Id: <20060205233125.5e98e21f.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-isp1301_omap-driver-cleanups.patch
-
-Drop unused rogue i2c driver ID and nonsensical i2c class.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/i2c/chips/isp1301_omap.c | 2 --
- 1 file changed, 2 deletions(-)
-
---- gregkh-2.6.orig/drivers/i2c/chips/isp1301_omap.c
-+++ gregkh-2.6/drivers/i2c/chips/isp1301_omap.c
-@@ -1635,8 +1635,6 @@ static struct i2c_driver isp1301_driver
- .driver = {
- .name = "isp1301_omap",
- },
-- .id = 1301, /* FIXME "official", i2c-ids.h */
-- .class = I2C_CLASS_HWMON,
- .attach_adapter = isp1301_scan_bus,
- .detach_client = isp1301_detach_client,
- };
diff --git a/i2c/i2c-ite-name-init.patch b/i2c/i2c-ite-name-init.patch
deleted file mode 100644
index d419a13967927..0000000000000
--- a/i2c/i2c-ite-name-init.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From khali@linux-fr.org Sun Feb 5 14:29:43 2006
-Date: Sun, 5 Feb 2006 23:30:26 +0100
-From: Jean Delvare <khali@linux-fr.org>
-To: Greg KH <greg@kroah.com>
-Subject: [PATCH 10/11] i2c: Fix i2c-ite name initialization
-Message-Id: <20060205233026.58d9fea4.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-ite-name-init.patch
-
-Properly set the name member of the i2c_adapter structure of the ite
-i2c adapter driver.
-
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/i2c/busses/i2c-ite.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
---- gregkh-2.6.orig/drivers/i2c/busses/i2c-ite.c
-+++ gregkh-2.6/drivers/i2c/busses/i2c-ite.c
-@@ -200,9 +200,7 @@ static struct i2c_adapter iic_ite_ops =
- .owner = THIS_MODULE,
- .id = I2C_HW_I_IIC,
- .algo_data = &iic_ite_data,
-- .dev = {
-- .name = "ITE IIC adapter",
-- },
-+ .name = "ITE IIC adapter",
- };
-
- /* Called when the module is loaded. This function starts the
diff --git a/i2c/i2c-ixp4xx-hwmon-class.patch b/i2c/i2c-ixp4xx-hwmon-class.patch
deleted file mode 100644
index 17ffc0e2dcee1..0000000000000
--- a/i2c/i2c-ixp4xx-hwmon-class.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From khali@linux-fr.org Mon Feb 27 14:12:07 2006
-Date: Mon, 27 Feb 2006 23:12:58 +0100
-From: Alessandro Zummo <a.zummo@towertech.it>
-To: Greg KH <greg@kroah.com>
-Cc: Alessandro Zummo <a.zummo@towertech.it>
-Subject: I2C: i2c-ixp4xx: Add hwmon class
-Message-Id: <20060227231258.cebdda2f.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-ixp4xx-hwmon-class.patch
-
-From: Alessandro Zummo <a.zummo@towertech.it>
-
-This patch adds I2C_CLASS_HWMON to the ixp4xx bus driver.
-
-Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/i2c/busses/i2c-ixp4xx.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- gregkh-2.6.orig/drivers/i2c/busses/i2c-ixp4xx.c
-+++ gregkh-2.6/drivers/i2c/busses/i2c-ixp4xx.c
-@@ -126,6 +126,7 @@ static int ixp4xx_i2c_probe(struct platf
- drv_data->algo_data.timeout = 100;
-
- drv_data->adapter.id = I2C_HW_B_IXP4XX;
-+ drv_data->adapter.class = I2C_CLASS_HWMON;
- strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
- I2C_NAME_SIZE);
- drv_data->adapter.algo_data = &drv_data->algo_data;
diff --git a/i2c/i2c-piix4-add-ht1000-support.patch b/i2c/i2c-piix4-add-ht1000-support.patch
deleted file mode 100644
index e7aee50160938..0000000000000
--- a/i2c/i2c-piix4-add-ht1000-support.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From khali@linux-fr.org Mon Feb 27 14:10:55 2006
-Date: Mon, 27 Feb 2006 23:11:45 +0100
-From: Martin Devera <devik@cdi.cz>
-To: Greg KH <greg@kroah.com>
-Cc: Martin Devera <devik@cdi.cz>
-Subject: I2C: i2c-piix4: Add Broadcom HT-1000 support
-Message-Id: <20060227231145.6e298d84.khali@linux-fr.org>
-Content-Disposition: inline; filename=i2c-piix4-add-ht1000-support.patch
-
-From: Martin Devera <devik@cdi.cz>
-
-Add Broadcom HT-1000 south bridge's PCI ID to i2c-piix driver. Note
-that at least on Supermicro H8SSL it uses non-standard SMBHSTCFG = 3
-and standard values like 0 or 9 causes hangup.
-
-Signed-off-by: Martin Devera <devik@cdi.cz>
-Signed-off-by: Jean Delvare <khali@linux-fr.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- Documentation/i2c/busses/i2c-piix4 | 2 +-
- drivers/i2c/busses/Kconfig | 4 +++-
- drivers/i2c/busses/i2c-piix4.c | 4 +++-
- include/linux/pci_ids.h | 1 +
- 4 files changed, 8 insertions(+), 3 deletions(-)
-
---- gregkh-2.6.orig/Documentation/i2c/busses/i2c-piix4
-+++ gregkh-2.6/Documentation/i2c/busses/i2c-piix4
-@@ -4,7 +4,7 @@ Supported adapters:
- * Intel 82371AB PIIX4 and PIIX4E
- * Intel 82443MX (440MX)
- Datasheet: Publicly available at the Intel website
-- * ServerWorks OSB4, CSB5 and CSB6 southbridges
-+ * ServerWorks OSB4, CSB5, CSB6 and HT-1000 southbridges
- Datasheet: Only available via NDA from ServerWorks
- * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge
- Datasheet: Publicly available at the SMSC website http://www.smsc.com
---- gregkh-2.6.orig/drivers/i2c/busses/Kconfig
-+++ gregkh-2.6/drivers/i2c/busses/Kconfig
-@@ -168,12 +168,14 @@ config I2C_PIIX4
- help
- If you say yes to this option, support will be included for the Intel
- PIIX4 family of mainboard I2C interfaces. Specifically, the following
-- versions of the chipset are supported:
-+ versions of the chipset are supported (note that Serverworks is part
-+ of Broadcom):
- Intel PIIX4
- Intel 440MX
- Serverworks OSB4
- Serverworks CSB5
- Serverworks CSB6
-+ Serverworks HT-1000
- SMSC Victory66
-
- This driver can also be built as a module. If so, the module
---- gregkh-2.6.orig/drivers/i2c/busses/i2c-piix4.c
-+++ gregkh-2.6/drivers/i2c/busses/i2c-piix4.c
-@@ -22,7 +22,7 @@
- /*
- Supports:
- Intel PIIX4, 440MX
-- Serverworks OSB4, CSB5, CSB6
-+ Serverworks OSB4, CSB5, CSB6, HT-1000
- SMSC Victory66
-
- Note: we assume there can only be one device, with one SMBus interface.
-@@ -419,6 +419,8 @@ static struct pci_device_id piix4_ids[]
- .driver_data = 0 },
- { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6),
- .driver_data = 0 },
-+ { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000SB),
-+ .driver_data = 0 },
- { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3),
- .driver_data = 3 },
- { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_3),
---- gregkh-2.6.orig/include/linux/pci_ids.h
-+++ gregkh-2.6/include/linux/pci_ids.h
-@@ -1371,6 +1371,7 @@
- #define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
- #define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
- #define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203
-+#define PCI_DEVICE_ID_SERVERWORKS_HT1000SB 0x0205
- #define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211
- #define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212
- #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213
diff --git a/i2c/i2c-scx200_acb-01-whitespace.patch b/i2c/i2c-scx200_acb-01-whitespace.patch
deleted file mode 100644
index 8b6433f647bd0..0000000000000
--- a/i2c/i2c-scx200_acb-01-whitespace.patch
+++ /dev/null
@@ -1,259 +0,0 @@
-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
deleted file mode 100644
index fa642187ffc5c..0000000000000
--- a/i2c/i2c-scx200_acb-02-debug.patch
+++ /dev/null
@@ -1,145 +0,0 @@
-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
deleted file mode 100644
index 65b42d1a5b3d8..0000000000000
--- a/i2c/i2c-scx200_acb-03-refactor.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-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
deleted file mode 100644
index 76034ed3daba9..0000000000000
--- a/i2c/i2c-scx200_acb-04-lock_kernel.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-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
deleted file mode 100644
index 4f9c4305c8a97..0000000000000
--- a/i2c/i2c-scx200_acb-05-cs5535.patch
+++ /dev/null
@@ -1,128 +0,0 @@
-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
deleted file mode 100644
index 6932ffb317080..0000000000000
--- a/i2c/i2c-scx200_acb-06-poll.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-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
deleted file mode 100644
index 06cb598253b12..0000000000000
--- a/i2c/i2c-scx200_acb-07-docs.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-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
deleted file mode 100644
index d256e2e6a5d1a..0000000000000
--- a/i2c/i2c-speedup-block-transfers.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-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,
diff --git a/i2c/w1-add-the-ds2482-i2c-to-w1-bridge-driver.patch b/i2c/w1-add-the-ds2482-i2c-to-w1-bridge-driver.patch
deleted file mode 100644
index 46d0abf0b347c..0000000000000
--- a/i2c/w1-add-the-ds2482-i2c-to-w1-bridge-driver.patch
+++ /dev/null
@@ -1,646 +0,0 @@
-From johnpol@2ka.mipt.ru Tue Dec 6 02:32:28 2005
-From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Cc: Ben Gardner <gardner.ben@gmail.com>, Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Subject: W1: Add the DS2482 I2C-to-w1 bridge driver.
-Date: Tue, 6 Dec 2005 13:38:28 +0300
-Message-Id: <11338655082568@2ka.mipt.ru>
-To: GregKH <greg@kroah.com>
-
-
-Signed-off-by: Ben Gardner <bgardner@wabtec.com>
-Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- Documentation/w1/masters/ds2482 | 31 ++
- drivers/w1/masters/Kconfig | 10
- drivers/w1/masters/Makefile | 2
- drivers/w1/masters/ds2482.c | 564 ++++++++++++++++++++++++++++++++++++++++
- 4 files changed, 607 insertions(+)
-
---- /dev/null
-+++ gregkh-2.6/Documentation/w1/masters/ds2482
-@@ -0,0 +1,31 @@
-+Kernel driver ds2482
-+====================
-+
-+Supported chips:
-+ * Maxim DS2482-100, Maxim DS2482-800
-+ Prefix: 'ds2482'
-+ Addresses scanned: None
-+ Datasheets:
-+ http://pdfserv.maxim-ic.com/en/ds/DS2482-100-DS2482S-100.pdf
-+ http://pdfserv.maxim-ic.com/en/ds/DS2482-800-DS2482S-800.pdf
-+
-+Author: Ben Gardner <bgardner@wabtec.com>
-+
-+
-+Description
-+-----------
-+
-+The Maixm/Dallas Semiconductor DS2482 is a I2C device that provides
-+one (DS2482-100) or eight (DS2482-800) 1-wire busses.
-+
-+
-+General Remarks
-+---------------
-+
-+Valid addresses are 0x18, 0x19, 0x1a, and 0x1b.
-+However, the device cannot be detected without writing to the i2c bus, so no
-+detection is done.
-+You should force the device address.
-+
-+$ modprobe ds2482 force=0,0x18
-+
---- gregkh-2.6.orig/drivers/w1/masters/Kconfig
-+++ gregkh-2.6/drivers/w1/masters/Kconfig
-@@ -34,5 +34,15 @@ config W1_MASTER_DS9490_BRIDGE
- This support is also available as a module. If so, the module
- will be called ds_w1_bridge.ko.
-
-+config W1_MASTER_DS2482
-+ tristate "Maxim DS2482 I2C to 1-Wire bridge"
-+ depends on I2C && W1 && EXPERIMENTAL
-+ help
-+ If you say yes here you get support for the Maxim DS2482
-+ I2C to 1-Wire bridge.
-+
-+ This driver can also be built as a module. If so, the module
-+ will be called ds2482.
-+
- endmenu
-
---- gregkh-2.6.orig/drivers/w1/masters/Makefile
-+++ gregkh-2.6/drivers/w1/masters/Makefile
-@@ -9,3 +9,5 @@ ds9490r-objs := dscore.o
-
- obj-$(CONFIG_W1_MASTER_DS9490_BRIDGE) += ds_w1_bridge.o
-
-+obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
-+
---- /dev/null
-+++ gregkh-2.6/drivers/w1/masters/ds2482.c
-@@ -0,0 +1,564 @@
-+/**
-+ * ds2482.c - provides i2c to w1-master bridge(s)
-+ * Copyright (C) 2005 Ben Gardner <bgardner@wabtec.com>
-+ *
-+ * The DS2482 is a sensor chip made by Dallas Semiconductor (Maxim).
-+ * It is a I2C to 1-wire bridge.
-+ * There are two variations: -100 and -800, which have 1 or 8 1-wire ports.
-+ * The complete datasheet can be obtained from MAXIM's website at:
-+ * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4382
-+ *
-+ * 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; version 2 of the License.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/i2c.h>
-+#include <linux/delay.h>
-+#include <asm/delay.h>
-+
-+#include "../w1.h"
-+#include "../w1_int.h"
-+
-+/**
-+ * Address is selected using 2 pins, resulting in 4 possible addresses.
-+ * 0x18, 0x19, 0x1a, 0x1b
-+ * However, the chip cannot be detected without doing an i2c write,
-+ * so use the force module parameter.
-+ */
-+static unsigned short normal_i2c[] = {I2C_CLIENT_END};
-+
-+/**
-+ * Insmod parameters
-+ */
-+I2C_CLIENT_INSMOD_1(ds2482);
-+
-+/**
-+ * The DS2482 registers - there are 3 registers that are addressed by a read
-+ * pointer. The read pointer is set by the last command executed.
-+ *
-+ * To read the data, issue a register read for any address
-+ */
-+#define DS2482_CMD_RESET 0xF0 /* No param */
-+#define DS2482_CMD_SET_READ_PTR 0xE1 /* Param: DS2482_PTR_CODE_xxx */
-+#define DS2482_CMD_CHANNEL_SELECT 0xC3 /* Param: Channel byte - DS2482-800 only */
-+#define DS2482_CMD_WRITE_CONFIG 0xD2 /* Param: Config byte */
-+#define DS2482_CMD_1WIRE_RESET 0xB4 /* Param: None */
-+#define DS2482_CMD_1WIRE_SINGLE_BIT 0x87 /* Param: Bit byte (bit7) */
-+#define DS2482_CMD_1WIRE_WRITE_BYTE 0xA5 /* Param: Data byte */
-+#define DS2482_CMD_1WIRE_READ_BYTE 0x96 /* Param: None */
-+/* Note to read the byte, Set the ReadPtr to Data then read (any addr) */
-+#define DS2482_CMD_1WIRE_TRIPLET 0x78 /* Param: Dir byte (bit7) */
-+
-+/* Values for DS2482_CMD_SET_READ_PTR */
-+#define DS2482_PTR_CODE_STATUS 0xF0
-+#define DS2482_PTR_CODE_DATA 0xE1
-+#define DS2482_PTR_CODE_CHANNEL 0xD2 /* DS2482-800 only */
-+#define DS2482_PTR_CODE_CONFIG 0xC3
-+
-+/**
-+ * Configure Register bit definitions
-+ * The top 4 bits always read 0.
-+ * To write, the top nibble must be the 1's compl. of the low nibble.
-+ */
-+#define DS2482_REG_CFG_1WS 0x08
-+#define DS2482_REG_CFG_SPU 0x04
-+#define DS2482_REG_CFG_PPM 0x02
-+#define DS2482_REG_CFG_APU 0x01
-+
-+
-+/**
-+ * Write and verify codes for the CHANNEL_SELECT command (DS2482-800 only).
-+ * To set the channel, write the value at the index of the channel.
-+ * Read and compare against the corresponding value to verify the change.
-+ */
-+static const u8 ds2482_chan_wr[8] =
-+ { 0xF0, 0xE1, 0xD2, 0xC3, 0xB4, 0xA5, 0x96, 0x87 };
-+static const u8 ds2482_chan_rd[8] =
-+ { 0xB8, 0xB1, 0xAA, 0xA3, 0x9C, 0x95, 0x8E, 0x87 };
-+
-+
-+/**
-+ * Status Register bit definitions (read only)
-+ */
-+#define DS2482_REG_STS_DIR 0x80
-+#define DS2482_REG_STS_TSB 0x40
-+#define DS2482_REG_STS_SBR 0x20
-+#define DS2482_REG_STS_RST 0x10
-+#define DS2482_REG_STS_LL 0x08
-+#define DS2482_REG_STS_SD 0x04
-+#define DS2482_REG_STS_PPD 0x02
-+#define DS2482_REG_STS_1WB 0x01
-+
-+
-+static int ds2482_attach_adapter(struct i2c_adapter *adapter);
-+static int ds2482_detect(struct i2c_adapter *adapter, int address, int kind);
-+static int ds2482_detach_client(struct i2c_client *client);
-+
-+
-+/**
-+ * Driver data (common to all clients)
-+ */
-+static struct i2c_driver ds2482_driver = {
-+ .driver = {
-+ .owner = THIS_MODULE,
-+ .name = "ds2482",
-+ },
-+ .attach_adapter = ds2482_attach_adapter,
-+ .detach_client = ds2482_detach_client,
-+};
-+
-+/*
-+ * Client data (each client gets its own)
-+ */
-+
-+struct ds2482_data;
-+
-+struct ds2482_w1_chan {
-+ struct ds2482_data *pdev;
-+ u8 channel;
-+ struct w1_bus_master w1_bm;
-+};
-+
-+struct ds2482_data {
-+ struct i2c_client client;
-+ struct semaphore access_lock;
-+
-+ /* 1-wire interface(s) */
-+ int w1_count; /* 1 or 8 */
-+ struct ds2482_w1_chan w1_ch[8];
-+
-+ /* per-device values */
-+ u8 channel;
-+ u8 read_prt; /* see DS2482_PTR_CODE_xxx */
-+ u8 reg_config;
-+};
-+
-+
-+/**
-+ * Sets the read pointer.
-+ * @param pdev The ds2482 client pointer
-+ * @param read_ptr see DS2482_PTR_CODE_xxx above
-+ * @return -1 on failure, 0 on success
-+ */
-+static inline int ds2482_select_register(struct ds2482_data *pdev, u8 read_ptr)
-+{
-+ if (pdev->read_prt != read_ptr) {
-+ if (i2c_smbus_write_byte_data(&pdev->client,
-+ DS2482_CMD_SET_READ_PTR,
-+ read_ptr) < 0)
-+ return -1;
-+
-+ pdev->read_prt = read_ptr;
-+ }
-+ return 0;
-+}
-+
-+/**
-+ * Sends a command without a parameter
-+ * @param pdev The ds2482 client pointer
-+ * @param cmd DS2482_CMD_RESET,
-+ * DS2482_CMD_1WIRE_RESET,
-+ * DS2482_CMD_1WIRE_READ_BYTE
-+ * @return -1 on failure, 0 on success
-+ */
-+static inline int ds2482_send_cmd(struct ds2482_data *pdev, u8 cmd)
-+{
-+ if (i2c_smbus_write_byte(&pdev->client, cmd) < 0)
-+ return -1;
-+
-+ pdev->read_prt = DS2482_PTR_CODE_STATUS;
-+ return 0;
-+}
-+
-+/**
-+ * Sends a command with a parameter
-+ * @param pdev The ds2482 client pointer
-+ * @param cmd DS2482_CMD_WRITE_CONFIG,
-+ * DS2482_CMD_1WIRE_SINGLE_BIT,
-+ * DS2482_CMD_1WIRE_WRITE_BYTE,
-+ * DS2482_CMD_1WIRE_TRIPLET
-+ * @param byte The data to send
-+ * @return -1 on failure, 0 on success
-+ */
-+static inline int ds2482_send_cmd_data(struct ds2482_data *pdev,
-+ u8 cmd, u8 byte)
-+{
-+ if (i2c_smbus_write_byte_data(&pdev->client, cmd, byte) < 0)
-+ return -1;
-+
-+ /* all cmds leave in STATUS, except CONFIG */
-+ pdev->read_prt = (cmd != DS2482_CMD_WRITE_CONFIG) ?
-+ DS2482_PTR_CODE_STATUS : DS2482_PTR_CODE_CONFIG;
-+ return 0;
-+}
-+
-+
-+/*
-+ * 1-Wire interface code
-+ */
-+
-+#define DS2482_WAIT_IDLE_TIMEOUT 100
-+
-+/**
-+ * Waits until the 1-wire interface is idle (not busy)
-+ *
-+ * @param pdev Pointer to the device structure
-+ * @return the last value read from status or -1 (failure)
-+ */
-+static int ds2482_wait_1wire_idle(struct ds2482_data *pdev)
-+{
-+ int temp = -1;
-+ int retries = 0;
-+
-+ if (!ds2482_select_register(pdev, DS2482_PTR_CODE_STATUS)) {
-+ do {
-+ temp = i2c_smbus_read_byte(&pdev->client);
-+ } while ((temp >= 0) && (temp & DS2482_REG_STS_1WB) &&
-+ (++retries > DS2482_WAIT_IDLE_TIMEOUT));
-+ }
-+
-+ if (retries > DS2482_WAIT_IDLE_TIMEOUT)
-+ printk(KERN_ERR "%s: timeout on channel %d\n",
-+ __func__, pdev->channel);
-+
-+ return temp;
-+}
-+
-+/**
-+ * Selects a w1 channel.
-+ * The 1-wire interface must be idle before calling this function.
-+ *
-+ * @param pdev The ds2482 client pointer
-+ * @param channel 0-7
-+ * @return -1 (failure) or 0 (success)
-+ */
-+static int ds2482_set_channel(struct ds2482_data *pdev, u8 channel)
-+{
-+ if (i2c_smbus_write_byte_data(&pdev->client, DS2482_CMD_CHANNEL_SELECT,
-+ ds2482_chan_wr[channel]) < 0)
-+ return -1;
-+
-+ pdev->read_prt = DS2482_PTR_CODE_CHANNEL;
-+ pdev->channel = -1;
-+ if (i2c_smbus_read_byte(&pdev->client) == ds2482_chan_rd[channel]) {
-+ pdev->channel = channel;
-+ return 0;
-+ }
-+ return -1;
-+}
-+
-+
-+/**
-+ * Performs the touch-bit function, which writes a 0 or 1 and reads the level.
-+ *
-+ * @param data The ds2482 channel pointer
-+ * @param bit The level to write: 0 or non-zero
-+ * @return The level read: 0 or 1
-+ */
-+static u8 ds2482_w1_touch_bit(void *data, u8 bit)
-+{
-+ struct ds2482_w1_chan *pchan = data;
-+ struct ds2482_data *pdev = pchan->pdev;
-+ int status = -1;
-+
-+ down(&pdev->access_lock);
-+
-+ /* Select the channel */
-+ ds2482_wait_1wire_idle(pdev);
-+ if (pdev->w1_count > 1)
-+ ds2482_set_channel(pdev, pchan->channel);
-+
-+ /* Send the touch command, wait until 1WB == 0, return the status */
-+ if (!ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_SINGLE_BIT,
-+ bit ? 0xFF : 0))
-+ status = ds2482_wait_1wire_idle(pdev);
-+
-+ up(&pdev->access_lock);
-+
-+ return (status & DS2482_REG_STS_SBR) ? 1 : 0;
-+}
-+
-+/**
-+ * Performs the triplet function, which reads two bits and writes a bit.
-+ * The bit written is determined by the two reads:
-+ * 00 => dbit, 01 => 0, 10 => 1
-+ *
-+ * @param data The ds2482 channel pointer
-+ * @param dbit The direction to choose if both branches are valid
-+ * @return b0=read1 b1=read2 b3=bit written
-+ */
-+static u8 ds2482_w1_triplet(void *data, u8 dbit)
-+{
-+ struct ds2482_w1_chan *pchan = data;
-+ struct ds2482_data *pdev = pchan->pdev;
-+ int status = (3 << 5);
-+
-+ down(&pdev->access_lock);
-+
-+ /* Select the channel */
-+ ds2482_wait_1wire_idle(pdev);
-+ if (pdev->w1_count > 1)
-+ ds2482_set_channel(pdev, pchan->channel);
-+
-+ /* Send the triplet command, wait until 1WB == 0, return the status */
-+ if (!ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_TRIPLET,
-+ dbit ? 0xFF : 0))
-+ status = ds2482_wait_1wire_idle(pdev);
-+
-+ up(&pdev->access_lock);
-+
-+ /* Decode the status */
-+ return (status >> 5);
-+}
-+
-+/**
-+ * Performs the write byte function.
-+ *
-+ * @param data The ds2482 channel pointer
-+ * @param byte The value to write
-+ */
-+static void ds2482_w1_write_byte(void *data, u8 byte)
-+{
-+ struct ds2482_w1_chan *pchan = data;
-+ struct ds2482_data *pdev = pchan->pdev;
-+
-+ down(&pdev->access_lock);
-+
-+ /* Select the channel */
-+ ds2482_wait_1wire_idle(pdev);
-+ if (pdev->w1_count > 1)
-+ ds2482_set_channel(pdev, pchan->channel);
-+
-+ /* Send the write byte command */
-+ ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_WRITE_BYTE, byte);
-+
-+ up(&pdev->access_lock);
-+}
-+
-+/**
-+ * Performs the read byte function.
-+ *
-+ * @param data The ds2482 channel pointer
-+ * @return The value read
-+ */
-+static u8 ds2482_w1_read_byte(void *data)
-+{
-+ struct ds2482_w1_chan *pchan = data;
-+ struct ds2482_data *pdev = pchan->pdev;
-+ int result;
-+
-+ down(&pdev->access_lock);
-+
-+ /* Select the channel */
-+ ds2482_wait_1wire_idle(pdev);
-+ if (pdev->w1_count > 1)
-+ ds2482_set_channel(pdev, pchan->channel);
-+
-+ /* Send the read byte command */
-+ ds2482_send_cmd(pdev, DS2482_CMD_1WIRE_READ_BYTE);
-+
-+ /* Wait until 1WB == 0 */
-+ ds2482_wait_1wire_idle(pdev);
-+
-+ /* Select the data register */
-+ ds2482_select_register(pdev, DS2482_PTR_CODE_DATA);
-+
-+ /* Read the data byte */
-+ result = i2c_smbus_read_byte(&pdev->client);
-+
-+ up(&pdev->access_lock);
-+
-+ return result;
-+}
-+
-+
-+/**
-+ * Sends a reset on the 1-wire interface
-+ *
-+ * @param data The ds2482 channel pointer
-+ * @return 0=Device present, 1=No device present or error
-+ */
-+static u8 ds2482_w1_reset_bus(void *data)
-+{
-+ struct ds2482_w1_chan *pchan = data;
-+ struct ds2482_data *pdev = pchan->pdev;
-+ int err;
-+ u8 retval = 1;
-+
-+ down(&pdev->access_lock);
-+
-+ /* Select the channel */
-+ ds2482_wait_1wire_idle(pdev);
-+ if (pdev->w1_count > 1)
-+ ds2482_set_channel(pdev, pchan->channel);
-+
-+ /* Send the reset command */
-+ err = ds2482_send_cmd(pdev, DS2482_CMD_1WIRE_RESET);
-+ if (err >= 0) {
-+ /* Wait until the reset is complete */
-+ err = ds2482_wait_1wire_idle(pdev);
-+ retval = !(err & DS2482_REG_STS_PPD);
-+
-+ /* If the chip did reset since detect, re-config it */
-+ if (err & DS2482_REG_STS_RST)
-+ ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG,
-+ 0xF0);
-+ }
-+
-+ up(&pdev->access_lock);
-+
-+ return retval;
-+}
-+
-+
-+/**
-+ * Called to see if the device exists on an i2c bus.
-+ */
-+static int ds2482_attach_adapter(struct i2c_adapter *adapter)
-+{
-+ return i2c_probe(adapter, &addr_data, ds2482_detect);
-+}
-+
-+
-+/*
-+ * The following function does more than just detection. If detection
-+ * succeeds, it also registers the new chip.
-+ */
-+static int ds2482_detect(struct i2c_adapter *adapter, int address, int kind)
-+{
-+ struct ds2482_data *data;
-+ struct i2c_client *new_client;
-+ int err = 0;
-+ int temp1;
-+ int idx;
-+
-+ if (!i2c_check_functionality(adapter,
-+ I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
-+ I2C_FUNC_SMBUS_BYTE))
-+ goto exit;
-+
-+ if (!(data = kzalloc(sizeof(struct ds2482_data), GFP_KERNEL))) {
-+ err = -ENOMEM;
-+ goto exit;
-+ }
-+
-+ new_client = &data->client;
-+ i2c_set_clientdata(new_client, data);
-+ new_client->addr = address;
-+ new_client->driver = &ds2482_driver;
-+ new_client->adapter = adapter;
-+
-+ /* Reset the device (sets the read_ptr to status) */
-+ if (ds2482_send_cmd(data, DS2482_CMD_RESET) < 0) {
-+ dev_dbg(&adapter->dev, "DS2482 reset failed at 0x%02x.\n",
-+ address);
-+ goto exit_free;
-+ }
-+
-+ /* Sleep at least 525ns to allow the reset to complete */
-+ ndelay(525);
-+
-+ /* Read the status byte - only reset bit and line should be set */
-+ temp1 = i2c_smbus_read_byte(new_client);
-+ if (temp1 != (DS2482_REG_STS_LL | DS2482_REG_STS_RST)) {
-+ dev_dbg(&adapter->dev, "DS2482 (0x%02x) reset status "
-+ "0x%02X - not a DS2482\n", address, temp1);
-+ goto exit_free;
-+ }
-+
-+ /* Detect the 8-port version */
-+ data->w1_count = 1;
-+ if (ds2482_set_channel(data, 7) == 0)
-+ data->w1_count = 8;
-+
-+ /* Set all config items to 0 (off) */
-+ ds2482_send_cmd_data(data, DS2482_CMD_WRITE_CONFIG, 0xF0);
-+
-+ /* We can fill in the remaining client fields */
-+ snprintf(new_client->name, sizeof(new_client->name), "ds2482-%d00",
-+ data->w1_count);
-+
-+ init_MUTEX(&data->access_lock);
-+
-+ /* Tell the I2C layer a new client has arrived */
-+ if ((err = i2c_attach_client(new_client)))
-+ goto exit_free;
-+
-+ /* Register 1-wire interface(s) */
-+ for (idx = 0; idx < data->w1_count; idx++) {
-+ data->w1_ch[idx].pdev = data;
-+ data->w1_ch[idx].channel = idx;
-+
-+ /* Populate all the w1 bus master stuff */
-+ data->w1_ch[idx].w1_bm.data = &data->w1_ch[idx];
-+ data->w1_ch[idx].w1_bm.read_byte = ds2482_w1_read_byte;
-+ data->w1_ch[idx].w1_bm.write_byte = ds2482_w1_write_byte;
-+ data->w1_ch[idx].w1_bm.touch_bit = ds2482_w1_touch_bit;
-+ data->w1_ch[idx].w1_bm.triplet = ds2482_w1_triplet;
-+ data->w1_ch[idx].w1_bm.reset_bus = ds2482_w1_reset_bus;
-+
-+ err = w1_add_master_device(&data->w1_ch[idx].w1_bm);
-+ if (err) {
-+ data->w1_ch[idx].pdev = NULL;
-+ goto exit_w1_remove;
-+ }
-+ }
-+
-+ return 0;
-+
-+exit_w1_remove:
-+ i2c_detach_client(new_client);
-+
-+ for (idx = 0; idx < data->w1_count; idx++) {
-+ if (data->w1_ch[idx].pdev != NULL)
-+ w1_remove_master_device(&data->w1_ch[idx].w1_bm);
-+ }
-+exit_free:
-+ kfree(data);
-+exit:
-+ return err;
-+}
-+
-+static int ds2482_detach_client(struct i2c_client *client)
-+{
-+ struct ds2482_data *data = i2c_get_clientdata(client);
-+ int err, idx;
-+
-+ /* Unregister the 1-wire bridge(s) */
-+ for (idx = 0; idx < data->w1_count; idx++) {
-+ if (data->w1_ch[idx].pdev != NULL)
-+ w1_remove_master_device(&data->w1_ch[idx].w1_bm);
-+ }
-+
-+ /* Detach the i2c device */
-+ if ((err = i2c_detach_client(client))) {
-+ dev_err(&client->dev,
-+ "Deregistration failed, client not detached.\n");
-+ return err;
-+ }
-+
-+ /* Free the memory */
-+ kfree(data);
-+ return 0;
-+}
-+
-+static int __init sensors_ds2482_init(void)
-+{
-+ return i2c_add_driver(&ds2482_driver);
-+}
-+
-+static void __exit sensors_ds2482_exit(void)
-+{
-+ i2c_del_driver(&ds2482_driver);
-+}
-+
-+MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>");
-+MODULE_DESCRIPTION("DS2482 driver");
-+MODULE_LICENSE("GPL");
-+
-+module_init(sensors_ds2482_init);
-+module_exit(sensors_ds2482_exit);
diff --git a/i2c/w1-change-the-type-unsigned-long-member-of-struct-w1_bus_master-to-void.patch b/i2c/w1-change-the-type-unsigned-long-member-of-struct-w1_bus_master-to-void.patch
deleted file mode 100644
index f55d626d39dc9..0000000000000
--- a/i2c/w1-change-the-type-unsigned-long-member-of-struct-w1_bus_master-to-void.patch
+++ /dev/null
@@ -1,279 +0,0 @@
-From johnpol@2ka.mipt.ru Tue Dec 6 02:32:24 2005
-From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Cc: Ben Gardner <gardner.ben@gmail.com>, Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Subject: W1: Change the type 'unsigned long' member of 'struct w1_bus_master' to 'void *'.
-Date: Tue, 6 Dec 2005 13:38:27 +0300
-Message-Id: <11338655072468@2ka.mipt.ru>
-To: GregKH <greg@kroah.com>
-
-
-Signed-off-by: Ben Gardner <bgardner@wabtec.com>
-Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/w1/ds_w1_bridge.c | 34 +++++++++++++++++-----------------
- drivers/w1/matrox_w1.c | 14 +++++++-------
- drivers/w1/w1.c | 8 ++++----
- drivers/w1/w1.h | 24 ++++++++++++------------
- 4 files changed, 40 insertions(+), 40 deletions(-)
-
---- gregkh-2.6.orig/drivers/w1/ds_w1_bridge.c
-+++ gregkh-2.6/drivers/w1/ds_w1_bridge.c
-@@ -29,10 +29,10 @@
- static struct ds_device *ds_dev;
- static struct w1_bus_master *ds_bus_master;
-
--static u8 ds9490r_touch_bit(unsigned long data, u8 bit)
-+static u8 ds9490r_touch_bit(void *data, u8 bit)
- {
- u8 ret;
-- struct ds_device *dev = (struct ds_device *)data;
-+ struct ds_device *dev = data;
-
- if (ds_touch_bit(dev, bit, &ret))
- return 0;
-@@ -40,23 +40,23 @@ static u8 ds9490r_touch_bit(unsigned lon
- return ret;
- }
-
--static void ds9490r_write_bit(unsigned long data, u8 bit)
-+static void ds9490r_write_bit(void *data, u8 bit)
- {
-- struct ds_device *dev = (struct ds_device *)data;
-+ struct ds_device *dev = data;
-
- ds_write_bit(dev, bit);
- }
-
--static void ds9490r_write_byte(unsigned long data, u8 byte)
-+static void ds9490r_write_byte(void *data, u8 byte)
- {
-- struct ds_device *dev = (struct ds_device *)data;
-+ struct ds_device *dev = data;
-
- ds_write_byte(dev, byte);
- }
-
--static u8 ds9490r_read_bit(unsigned long data)
-+static u8 ds9490r_read_bit(void *data)
- {
-- struct ds_device *dev = (struct ds_device *)data;
-+ struct ds_device *dev = data;
- int err;
- u8 bit = 0;
-
-@@ -70,9 +70,9 @@ static u8 ds9490r_read_bit(unsigned long
- return bit & 1;
- }
-
--static u8 ds9490r_read_byte(unsigned long data)
-+static u8 ds9490r_read_byte(void *data)
- {
-- struct ds_device *dev = (struct ds_device *)data;
-+ struct ds_device *dev = data;
- int err;
- u8 byte = 0;
-
-@@ -83,16 +83,16 @@ static u8 ds9490r_read_byte(unsigned lon
- return byte;
- }
-
--static void ds9490r_write_block(unsigned long data, const u8 *buf, int len)
-+static void ds9490r_write_block(void *data, const u8 *buf, int len)
- {
-- struct ds_device *dev = (struct ds_device *)data;
-+ struct ds_device *dev = data;
-
- ds_write_block(dev, (u8 *)buf, len);
- }
-
--static u8 ds9490r_read_block(unsigned long data, u8 *buf, int len)
-+static u8 ds9490r_read_block(void *data, u8 *buf, int len)
- {
-- struct ds_device *dev = (struct ds_device *)data;
-+ struct ds_device *dev = data;
- int err;
-
- err = ds_read_block(dev, buf, len);
-@@ -102,9 +102,9 @@ static u8 ds9490r_read_block(unsigned lo
- return len;
- }
-
--static u8 ds9490r_reset(unsigned long data)
-+static u8 ds9490r_reset(void *data)
- {
-- struct ds_device *dev = (struct ds_device *)data;
-+ struct ds_device *dev = data;
- struct ds_status st;
- int err;
-
-@@ -136,7 +136,7 @@ static int __devinit ds_w1_init(void)
-
- memset(ds_bus_master, 0, sizeof(*ds_bus_master));
-
-- ds_bus_master->data = (unsigned long)ds_dev;
-+ ds_bus_master->data = ds_dev;
- ds_bus_master->touch_bit = &ds9490r_touch_bit;
- ds_bus_master->read_bit = &ds9490r_read_bit;
- ds_bus_master->write_bit = &ds9490r_write_bit;
---- gregkh-2.6.orig/drivers/w1/matrox_w1.c
-+++ gregkh-2.6/drivers/w1/matrox_w1.c
-@@ -90,8 +90,8 @@ struct matrox_device
- struct w1_bus_master *bus_master;
- };
-
--static u8 matrox_w1_read_ddc_bit(unsigned long);
--static void matrox_w1_write_ddc_bit(unsigned long, u8);
-+static u8 matrox_w1_read_ddc_bit(void *);
-+static void matrox_w1_write_ddc_bit(void *, u8);
-
- /*
- * These functions read and write DDC Data bit.
-@@ -122,10 +122,10 @@ static __inline__ void matrox_w1_write_r
- wmb();
- }
-
--static void matrox_w1_write_ddc_bit(unsigned long data, u8 bit)
-+static void matrox_w1_write_ddc_bit(void *data, u8 bit)
- {
- u8 ret;
-- struct matrox_device *dev = (struct matrox_device *) data;
-+ struct matrox_device *dev = data;
-
- if (bit)
- bit = 0;
-@@ -137,10 +137,10 @@ static void matrox_w1_write_ddc_bit(unsi
- matrox_w1_write_reg(dev, MATROX_GET_DATA, 0x00);
- }
-
--static u8 matrox_w1_read_ddc_bit(unsigned long data)
-+static u8 matrox_w1_read_ddc_bit(void *data)
- {
- u8 ret;
-- struct matrox_device *dev = (struct matrox_device *) data;
-+ struct matrox_device *dev = data;
-
- ret = matrox_w1_read_reg(dev, MATROX_GET_DATA);
-
-@@ -198,7 +198,7 @@ static int __devinit matrox_w1_probe(str
-
- matrox_w1_hw_init(dev);
-
-- dev->bus_master->data = (unsigned long) dev;
-+ dev->bus_master->data = dev;
- dev->bus_master->read_bit = &matrox_w1_read_ddc_bit;
- dev->bus_master->write_bit = &matrox_w1_write_ddc_bit;
-
---- gregkh-2.6.orig/drivers/w1/w1.c
-+++ gregkh-2.6/drivers/w1/w1.c
-@@ -552,7 +552,7 @@ static void w1_slave_detach(struct w1_sl
- kfree(sl);
- }
-
--static struct w1_master *w1_search_master(unsigned long data)
-+static struct w1_master *w1_search_master(void *data)
- {
- struct w1_master *dev;
- int found = 0;
-@@ -583,7 +583,7 @@ void w1_reconnect_slaves(struct w1_famil
- spin_unlock_bh(&w1_mlock);
- }
-
--static void w1_slave_found(unsigned long data, u64 rn)
-+static void w1_slave_found(void *data, u64 rn)
- {
- int slave_count;
- struct w1_slave *sl;
-@@ -595,8 +595,8 @@ static void w1_slave_found(unsigned long
-
- dev = w1_search_master(data);
- if (!dev) {
-- printk(KERN_ERR "Failed to find w1 master device for data %08lx, it is impossible.\n",
-- data);
-+ printk(KERN_ERR "Failed to find w1 master device for data %p, "
-+ "it is impossible.\n", data);
- return;
- }
-
---- gregkh-2.6.orig/drivers/w1/w1.h
-+++ gregkh-2.6/drivers/w1/w1.h
-@@ -80,7 +80,7 @@ struct w1_slave
- struct completion released;
- };
-
--typedef void (* w1_slave_found_callback)(unsigned long, u64);
-+typedef void (* w1_slave_found_callback)(void *, u64);
-
-
- /**
-@@ -93,16 +93,16 @@ typedef void (* w1_slave_found_callback)
- struct w1_bus_master
- {
- /** the first parameter in all the functions below */
-- unsigned long data;
-+ void *data;
-
- /**
- * Sample the line level
- * @return the level read (0 or 1)
- */
-- u8 (*read_bit)(unsigned long);
-+ u8 (*read_bit)(void *);
-
- /** Sets the line level */
-- void (*write_bit)(unsigned long, u8);
-+ void (*write_bit)(void *, u8);
-
- /**
- * touch_bit is the lowest-level function for devices that really
-@@ -111,42 +111,42 @@ struct w1_bus_master
- * touch_bit(1) = write-1 / read cycle
- * @return the bit read (0 or 1)
- */
-- u8 (*touch_bit)(unsigned long, u8);
-+ u8 (*touch_bit)(void *, u8);
-
- /**
- * Reads a bytes. Same as 8 touch_bit(1) calls.
- * @return the byte read
- */
-- u8 (*read_byte)(unsigned long);
-+ u8 (*read_byte)(void *);
-
- /**
- * Writes a byte. Same as 8 touch_bit(x) calls.
- */
-- void (*write_byte)(unsigned long, u8);
-+ void (*write_byte)(void *, u8);
-
- /**
- * Same as a series of read_byte() calls
- * @return the number of bytes read
- */
-- u8 (*read_block)(unsigned long, u8 *, int);
-+ u8 (*read_block)(void *, u8 *, int);
-
- /** Same as a series of write_byte() calls */
-- void (*write_block)(unsigned long, const u8 *, int);
-+ void (*write_block)(void *, const u8 *, int);
-
- /**
- * Combines two reads and a smart write for ROM searches
- * @return bit0=Id bit1=comp_id bit2=dir_taken
- */
-- u8 (*triplet)(unsigned long, u8);
-+ u8 (*triplet)(void *, u8);
-
- /**
- * long write-0 with a read for the presence pulse detection
- * @return -1=Error, 0=Device present, 1=No device present
- */
-- u8 (*reset_bus)(unsigned long);
-+ u8 (*reset_bus)(void *);
-
- /** Really nice hardware can handles the ROM searches */
-- void (*search)(unsigned long, w1_slave_found_callback);
-+ void (*search)(void *, w1_slave_found_callback);
- };
-
- #define W1_MASTER_NEED_EXIT 0
diff --git a/i2c/w1-misc-cleanups.patch b/i2c/w1-misc-cleanups.patch
deleted file mode 100644
index 01abfea4c7888..0000000000000
--- a/i2c/w1-misc-cleanups.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From akpm@osdl.org Tue Dec 13 14:08:53 2005
-Message-Id: <200512132204.jBDM4lvu012521@shell0.pdx.osdl.net>
-From: Adrian Bunk <bunk@stusta.de>
-Subject: w1: misc cleanups
-To: bunk@stusta.de, greg@kroah.com, johnpol@2ka.mipt.ru, mm-commits@vger.kernel.org
-Date: Tue, 13 Dec 2005 14:04:33 -0800
-
-
-This patch contains the following cleanups:
-- make needlessly global code static
-- declarations for global code belong into header files
-- w1.c: #if 0 the unused struct w1_slave_device
-
-Signed-off-by: Adrian Bunk <bunk@stusta.de>
-Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Signed-off-by: Andrew Morton <akpm@osdl.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/w1/w1.c | 6 ++++--
- drivers/w1/w1.h | 10 ++++++++++
- drivers/w1/w1_family.c | 2 +-
- drivers/w1/w1_int.c | 13 ++-----------
- drivers/w1/w1_io.c | 2 +-
- 5 files changed, 18 insertions(+), 15 deletions(-)
-
---- gregkh-2.6.orig/drivers/w1/w1.c
-+++ gregkh-2.6/drivers/w1/w1.c
-@@ -164,11 +164,12 @@ struct device w1_master_device = {
- .release = &w1_master_release
- };
-
--struct device_driver w1_slave_driver = {
-+static struct device_driver w1_slave_driver = {
- .name = "w1_slave_driver",
- .bus = &w1_bus_type,
- };
-
-+#if 0
- struct device w1_slave_device = {
- .parent = NULL,
- .bus = &w1_bus_type,
-@@ -176,6 +177,7 @@ struct device w1_slave_device = {
- .driver = &w1_slave_driver,
- .release = &w1_slave_release
- };
-+#endif /* 0 */
-
- static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf)
- {
-@@ -355,7 +357,7 @@ int w1_create_master_attributes(struct w
- return sysfs_create_group(&master->dev.kobj, &w1_master_defattr_group);
- }
-
--void w1_destroy_master_attributes(struct w1_master *master)
-+static void w1_destroy_master_attributes(struct w1_master *master)
- {
- sysfs_remove_group(&master->dev.kobj, &w1_master_defattr_group);
- }
---- gregkh-2.6.orig/drivers/w1/w1.h
-+++ gregkh-2.6/drivers/w1/w1.h
-@@ -203,6 +203,16 @@ static inline struct w1_master* dev_to_w
- return container_of(dev, struct w1_master, dev);
- }
-
-+extern int w1_max_slave_count;
-+extern int w1_max_slave_ttl;
-+extern spinlock_t w1_mlock;
-+extern struct list_head w1_masters;
-+extern struct device_driver w1_master_driver;
-+extern struct device w1_master_device;
-+
-+int w1_process(void *data);
-+void w1_reconnect_slaves(struct w1_family *f);
-+
- #endif /* __KERNEL__ */
-
- #endif /* __W1_H */
---- gregkh-2.6.orig/drivers/w1/w1_family.c
-+++ gregkh-2.6/drivers/w1/w1_family.c
-@@ -25,10 +25,10 @@
- #include <linux/delay.h>
-
- #include "w1_family.h"
-+#include "w1.h"
-
- DEFINE_SPINLOCK(w1_flock);
- static LIST_HEAD(w1_families);
--extern void w1_reconnect_slaves(struct w1_family *f);
-
- int w1_register_family(struct w1_family *newf)
- {
---- gregkh-2.6.orig/drivers/w1/w1_int.c
-+++ gregkh-2.6/drivers/w1/w1_int.c
-@@ -26,19 +26,10 @@
- #include "w1.h"
- #include "w1_log.h"
- #include "w1_netlink.h"
-+#include "w1_int.h"
-
- static u32 w1_ids = 1;
-
--extern struct device_driver w1_master_driver;
--extern struct bus_type w1_bus_type;
--extern struct device w1_master_device;
--extern int w1_max_slave_count;
--extern int w1_max_slave_ttl;
--extern struct list_head w1_masters;
--extern spinlock_t w1_mlock;
--
--extern int w1_process(void *);
--
- static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
- struct device_driver *driver,
- struct device *device)
-@@ -103,7 +94,7 @@ static struct w1_master * w1_alloc_dev(u
- return dev;
- }
-
--void w1_free_dev(struct w1_master *dev)
-+static void w1_free_dev(struct w1_master *dev)
- {
- device_unregister(&dev->dev);
- }
---- gregkh-2.6.orig/drivers/w1/w1_io.c
-+++ gregkh-2.6/drivers/w1/w1_io.c
-@@ -28,7 +28,7 @@
- #include "w1_log.h"
- #include "w1_io.h"
-
--int w1_delay_parm = 1;
-+static int w1_delay_parm = 1;
- module_param_named(delay_coef, w1_delay_parm, int, 0);
-
- static u8 w1_crc8_table[] = {
diff --git a/i2c/w1-move-w1-bus-master-code-into-w1-masters-and-move-w1-slave-code-into-w1-slaves.patch b/i2c/w1-move-w1-bus-master-code-into-w1-masters-and-move-w1-slave-code-into-w1-slaves.patch
deleted file mode 100644
index 42492d3d4508b..0000000000000
--- a/i2c/w1-move-w1-bus-master-code-into-w1-masters-and-move-w1-slave-code-into-w1-slaves.patch
+++ /dev/null
@@ -1,4373 +0,0 @@
-From johnpol@2ka.mipt.ru Tue Dec 6 02:32:34 2005
-From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Subject: W1: Move w1 bus master code into 'w1/masters' and move w1 slave code into 'w1/slaves'
-Date: Tue, 6 Dec 2005 13:38:28 +0300
-Message-Id: <11338655084139@2ka.mipt.ru>
-To: GregKH <greg@kroah.com>
-Cc: Ben Gardner <gardner.ben@gmail.com>, Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-
-
-Signed-off-by: Ben Gardner <bgardner@wabtec.com>
-Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/w1/Kconfig | 60 --
- drivers/w1/Makefile | 10
- drivers/w1/ds_w1_bridge.c | 174 --------
- drivers/w1/dscore.c | 795 --------------------------------------
- drivers/w1/dscore.h | 166 -------
- drivers/w1/masters/Kconfig | 38 +
- drivers/w1/masters/Makefile | 11
- drivers/w1/masters/ds_w1_bridge.c | 174 ++++++++
- drivers/w1/masters/dscore.c | 795 ++++++++++++++++++++++++++++++++++++++
- drivers/w1/masters/dscore.h | 166 +++++++
- drivers/w1/masters/matrox_w1.c | 247 +++++++++++
- drivers/w1/matrox_w1.c | 247 -----------
- drivers/w1/slaves/Kconfig | 38 +
- drivers/w1/slaves/Makefile | 12
- drivers/w1/slaves/w1_ds2433.c | 329 +++++++++++++++
- drivers/w1/slaves/w1_smem.c | 71 +++
- drivers/w1/slaves/w1_therm.c | 268 ++++++++++++
- drivers/w1/w1_ds2433.c | 329 ---------------
- drivers/w1/w1_smem.c | 71 ---
- drivers/w1/w1_therm.c | 268 ------------
- 20 files changed, 2152 insertions(+), 2117 deletions(-)
-
---- gregkh-2.6.orig/drivers/w1/Kconfig
-+++ gregkh-2.6/drivers/w1/Kconfig
-@@ -11,63 +11,7 @@ config W1
- This W1 support can also be built as a module. If so, the module
- will be called wire.ko.
-
--config W1_MATROX
-- tristate "Matrox G400 transport layer for 1-wire"
-- depends on W1 && PCI
-- help
-- Say Y here if you want to communicate with your 1-wire devices
-- using Matrox's G400 GPIO pins.
--
-- This support is also available as a module. If so, the module
-- will be called matrox_w1.ko.
--
--config W1_DS9490
-- tristate "DS9490R transport layer driver"
-- depends on W1 && USB
-- help
-- Say Y here if you want to have a driver for DS9490R UWB <-> W1 bridge.
--
-- This support is also available as a module. If so, the module
-- will be called ds9490r.ko.
--
--config W1_DS9490_BRIDGE
-- tristate "DS9490R USB <-> W1 transport layer for 1-wire"
-- depends on W1_DS9490
-- help
-- Say Y here if you want to communicate with your 1-wire devices
-- using DS9490R USB bridge.
--
-- This support is also available as a module. If so, the module
-- will be called ds_w1_bridge.ko.
--
--config W1_THERM
-- tristate "Thermal family implementation"
-- depends on W1
-- help
-- Say Y here if you want to connect 1-wire thermal sensors to you
-- wire.
--
--config W1_SMEM
-- tristate "Simple 64bit memory family implementation"
-- depends on W1
-- help
-- Say Y here if you want to connect 1-wire
-- simple 64bit memory rom(ds2401/ds2411/ds1990*) to you wire.
--
--config W1_DS2433
-- tristate "4kb EEPROM family support (DS2433)"
-- depends on W1
-- help
-- Say Y here if you want to use a 1-wire
-- 4kb EEPROM family device (DS2433).
--
--config W1_DS2433_CRC
-- bool "Protect DS2433 data with a CRC16"
-- depends on W1_DS2433
-- select CRC16
-- help
-- Say Y here to protect DS2433 data with a CRC16.
-- Each block has 30 bytes of data and a two byte CRC16.
-- Full block writes are only allowed if the CRC is valid.
-+source drivers/w1/masters/Kconfig
-+source drivers/w1/slaves/Kconfig
-
- endmenu
---- gregkh-2.6.orig/drivers/w1/Makefile
-+++ gregkh-2.6/drivers/w1/Makefile
-@@ -13,13 +13,5 @@ endif
- obj-$(CONFIG_W1) += wire.o
- wire-objs := w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
-
--obj-$(CONFIG_W1_MATROX) += matrox_w1.o
--obj-$(CONFIG_W1_THERM) += w1_therm.o
--obj-$(CONFIG_W1_SMEM) += w1_smem.o
-+obj-y += masters/ slaves/
-
--obj-$(CONFIG_W1_DS9490) += ds9490r.o
--ds9490r-objs := dscore.o
--
--obj-$(CONFIG_W1_DS9490_BRIDGE) += ds_w1_bridge.o
--
--obj-$(CONFIG_W1_DS2433) += w1_ds2433.o
---- gregkh-2.6.orig/drivers/w1/ds_w1_bridge.c
-+++ /dev/null
-@@ -1,174 +0,0 @@
--/*
-- * ds_w1_bridge.c
-- *
-- * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-- *
-- *
-- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--#include <linux/module.h>
--#include <linux/types.h>
--
--#include "../w1/w1.h"
--#include "../w1/w1_int.h"
--#include "dscore.h"
--
--static struct ds_device *ds_dev;
--static struct w1_bus_master *ds_bus_master;
--
--static u8 ds9490r_touch_bit(void *data, u8 bit)
--{
-- u8 ret;
-- struct ds_device *dev = data;
--
-- if (ds_touch_bit(dev, bit, &ret))
-- return 0;
--
-- return ret;
--}
--
--static void ds9490r_write_bit(void *data, u8 bit)
--{
-- struct ds_device *dev = data;
--
-- ds_write_bit(dev, bit);
--}
--
--static void ds9490r_write_byte(void *data, u8 byte)
--{
-- struct ds_device *dev = data;
--
-- ds_write_byte(dev, byte);
--}
--
--static u8 ds9490r_read_bit(void *data)
--{
-- struct ds_device *dev = data;
-- int err;
-- u8 bit = 0;
--
-- err = ds_touch_bit(dev, 1, &bit);
-- if (err)
-- return 0;
-- //err = ds_read_bit(dev, &bit);
-- //if (err)
-- // return 0;
--
-- return bit & 1;
--}
--
--static u8 ds9490r_read_byte(void *data)
--{
-- struct ds_device *dev = data;
-- int err;
-- u8 byte = 0;
--
-- err = ds_read_byte(dev, &byte);
-- if (err)
-- return 0;
--
-- return byte;
--}
--
--static void ds9490r_write_block(void *data, const u8 *buf, int len)
--{
-- struct ds_device *dev = data;
--
-- ds_write_block(dev, (u8 *)buf, len);
--}
--
--static u8 ds9490r_read_block(void *data, u8 *buf, int len)
--{
-- struct ds_device *dev = data;
-- int err;
--
-- err = ds_read_block(dev, buf, len);
-- if (err < 0)
-- return 0;
--
-- return len;
--}
--
--static u8 ds9490r_reset(void *data)
--{
-- struct ds_device *dev = data;
-- struct ds_status st;
-- int err;
--
-- memset(&st, 0, sizeof(st));
--
-- err = ds_reset(dev, &st);
-- if (err)
-- return 1;
--
-- return 0;
--}
--
--static int __devinit ds_w1_init(void)
--{
-- int err;
--
-- ds_bus_master = kmalloc(sizeof(*ds_bus_master), GFP_KERNEL);
-- if (!ds_bus_master) {
-- printk(KERN_ERR "Failed to allocate DS9490R USB<->W1 bus_master structure.\n");
-- return -ENOMEM;
-- }
--
-- ds_dev = ds_get_device();
-- if (!ds_dev) {
-- printk(KERN_ERR "DS9490R is not registered.\n");
-- err = -ENODEV;
-- goto err_out_free_bus_master;
-- }
--
-- memset(ds_bus_master, 0, sizeof(*ds_bus_master));
--
-- ds_bus_master->data = ds_dev;
-- ds_bus_master->touch_bit = &ds9490r_touch_bit;
-- ds_bus_master->read_bit = &ds9490r_read_bit;
-- ds_bus_master->write_bit = &ds9490r_write_bit;
-- ds_bus_master->read_byte = &ds9490r_read_byte;
-- ds_bus_master->write_byte = &ds9490r_write_byte;
-- ds_bus_master->read_block = &ds9490r_read_block;
-- ds_bus_master->write_block = &ds9490r_write_block;
-- ds_bus_master->reset_bus = &ds9490r_reset;
--
-- err = w1_add_master_device(ds_bus_master);
-- if (err)
-- goto err_out_put_device;
--
-- return 0;
--
--err_out_put_device:
-- ds_put_device(ds_dev);
--err_out_free_bus_master:
-- kfree(ds_bus_master);
--
-- return err;
--}
--
--static void __devexit ds_w1_fini(void)
--{
-- w1_remove_master_device(ds_bus_master);
-- ds_put_device(ds_dev);
-- kfree(ds_bus_master);
--}
--
--module_init(ds_w1_init);
--module_exit(ds_w1_fini);
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
---- gregkh-2.6.orig/drivers/w1/dscore.c
-+++ /dev/null
-@@ -1,795 +0,0 @@
--/*
-- * dscore.c
-- *
-- * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-- *
-- *
-- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--#include <linux/module.h>
--#include <linux/kernel.h>
--#include <linux/mod_devicetable.h>
--#include <linux/usb.h>
--
--#include "dscore.h"
--
--static struct usb_device_id ds_id_table [] = {
-- { USB_DEVICE(0x04fa, 0x2490) },
-- { },
--};
--MODULE_DEVICE_TABLE(usb, ds_id_table);
--
--static int ds_probe(struct usb_interface *, const struct usb_device_id *);
--static void ds_disconnect(struct usb_interface *);
--
--int ds_touch_bit(struct ds_device *, u8, u8 *);
--int ds_read_byte(struct ds_device *, u8 *);
--int ds_read_bit(struct ds_device *, u8 *);
--int ds_write_byte(struct ds_device *, u8);
--int ds_write_bit(struct ds_device *, u8);
--static int ds_start_pulse(struct ds_device *, int);
--int ds_reset(struct ds_device *, struct ds_status *);
--struct ds_device * ds_get_device(void);
--void ds_put_device(struct ds_device *);
--
--static inline void ds_dump_status(unsigned char *, unsigned char *, int);
--static int ds_send_control(struct ds_device *, u16, u16);
--static int ds_send_control_mode(struct ds_device *, u16, u16);
--static int ds_send_control_cmd(struct ds_device *, u16, u16);
--
--
--static struct usb_driver ds_driver = {
-- .name = "DS9490R",
-- .probe = ds_probe,
-- .disconnect = ds_disconnect,
-- .id_table = ds_id_table,
--};
--
--static struct ds_device *ds_dev;
--
--struct ds_device * ds_get_device(void)
--{
-- if (ds_dev)
-- atomic_inc(&ds_dev->refcnt);
-- return ds_dev;
--}
--
--void ds_put_device(struct ds_device *dev)
--{
-- atomic_dec(&dev->refcnt);
--}
--
--static int ds_send_control_cmd(struct ds_device *dev, u16 value, u16 index)
--{
-- int err;
--
-- err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
-- CONTROL_CMD, 0x40, value, index, NULL, 0, 1000);
-- if (err < 0) {
-- printk(KERN_ERR "Failed to send command control message %x.%x: err=%d.\n",
-- value, index, err);
-- return err;
-- }
--
-- return err;
--}
--
--static int ds_send_control_mode(struct ds_device *dev, u16 value, u16 index)
--{
-- int err;
--
-- err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
-- MODE_CMD, 0x40, value, index, NULL, 0, 1000);
-- if (err < 0) {
-- printk(KERN_ERR "Failed to send mode control message %x.%x: err=%d.\n",
-- value, index, err);
-- return err;
-- }
--
-- return err;
--}
--
--static int ds_send_control(struct ds_device *dev, u16 value, u16 index)
--{
-- int err;
--
-- err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
-- COMM_CMD, 0x40, value, index, NULL, 0, 1000);
-- if (err < 0) {
-- printk(KERN_ERR "Failed to send control message %x.%x: err=%d.\n",
-- value, index, err);
-- return err;
-- }
--
-- return err;
--}
--
--static inline void ds_dump_status(unsigned char *buf, unsigned char *str, int off)
--{
-- printk("%45s: %8x\n", str, buf[off]);
--}
--
--static int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st,
-- unsigned char *buf, int size)
--{
-- int count, err;
--
-- memset(st, 0, sizeof(st));
--
-- count = 0;
-- err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_STATUS]), buf, size, &count, 100);
-- if (err < 0) {
-- printk(KERN_ERR "Failed to read 1-wire data from 0x%x: err=%d.\n", dev->ep[EP_STATUS], err);
-- return err;
-- }
--
-- if (count >= sizeof(*st))
-- memcpy(st, buf, sizeof(*st));
--
-- return count;
--}
--
--static int ds_recv_status(struct ds_device *dev, struct ds_status *st)
--{
-- unsigned char buf[64];
-- int count, err = 0, i;
--
-- memcpy(st, buf, sizeof(*st));
--
-- count = ds_recv_status_nodump(dev, st, buf, sizeof(buf));
-- if (count < 0)
-- return err;
--
-- printk("0x%x: count=%d, status: ", dev->ep[EP_STATUS], count);
-- for (i=0; i<count; ++i)
-- printk("%02x ", buf[i]);
-- printk("\n");
--
-- if (count >= 16) {
-- ds_dump_status(buf, "enable flag", 0);
-- ds_dump_status(buf, "1-wire speed", 1);
-- ds_dump_status(buf, "strong pullup duration", 2);
-- ds_dump_status(buf, "programming pulse duration", 3);
-- ds_dump_status(buf, "pulldown slew rate control", 4);
-- ds_dump_status(buf, "write-1 low time", 5);
-- ds_dump_status(buf, "data sample offset/write-0 recovery time", 6);
-- ds_dump_status(buf, "reserved (test register)", 7);
-- ds_dump_status(buf, "device status flags", 8);
-- ds_dump_status(buf, "communication command byte 1", 9);
-- ds_dump_status(buf, "communication command byte 2", 10);
-- ds_dump_status(buf, "communication command buffer status", 11);
-- ds_dump_status(buf, "1-wire data output buffer status", 12);
-- ds_dump_status(buf, "1-wire data input buffer status", 13);
-- ds_dump_status(buf, "reserved", 14);
-- ds_dump_status(buf, "reserved", 15);
-- }
--
-- memcpy(st, buf, sizeof(*st));
--
-- if (st->status & ST_EPOF) {
-- printk(KERN_INFO "Resetting device after ST_EPOF.\n");
-- err = ds_send_control_cmd(dev, CTL_RESET_DEVICE, 0);
-- if (err)
-- return err;
-- count = ds_recv_status_nodump(dev, st, buf, sizeof(buf));
-- if (count < 0)
-- return err;
-- }
--#if 0
-- if (st->status & ST_IDLE) {
-- printk(KERN_INFO "Resetting pulse after ST_IDLE.\n");
-- err = ds_start_pulse(dev, PULLUP_PULSE_DURATION);
-- if (err)
-- return err;
-- }
--#endif
--
-- return err;
--}
--
--static int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size)
--{
-- int count, err;
-- struct ds_status st;
--
-- count = 0;
-- err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_DATA_IN]),
-- buf, size, &count, 1000);
-- if (err < 0) {
-- printk(KERN_INFO "Clearing ep0x%x.\n", dev->ep[EP_DATA_IN]);
-- usb_clear_halt(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_DATA_IN]));
-- ds_recv_status(dev, &st);
-- return err;
-- }
--
--#if 0
-- {
-- int i;
--
-- printk("%s: count=%d: ", __func__, count);
-- for (i=0; i<count; ++i)
-- printk("%02x ", buf[i]);
-- printk("\n");
-- }
--#endif
-- return count;
--}
--
--static int ds_send_data(struct ds_device *dev, unsigned char *buf, int len)
--{
-- int count, err;
--
-- count = 0;
-- err = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, dev->ep[EP_DATA_OUT]), buf, len, &count, 1000);
-- if (err < 0) {
-- printk(KERN_ERR "Failed to read 1-wire data from 0x02: err=%d.\n", err);
-- return err;
-- }
--
-- return err;
--}
--
--#if 0
--
--int ds_stop_pulse(struct ds_device *dev, int limit)
--{
-- struct ds_status st;
-- int count = 0, err = 0;
-- u8 buf[0x20];
--
-- do {
-- err = ds_send_control(dev, CTL_HALT_EXE_IDLE, 0);
-- if (err)
-- break;
-- err = ds_send_control(dev, CTL_RESUME_EXE, 0);
-- if (err)
-- break;
-- err = ds_recv_status_nodump(dev, &st, buf, sizeof(buf));
-- if (err)
-- break;
--
-- if ((st.status & ST_SPUA) == 0) {
-- err = ds_send_control_mode(dev, MOD_PULSE_EN, 0);
-- if (err)
-- break;
-- }
-- } while(++count < limit);
--
-- return err;
--}
--
--int ds_detect(struct ds_device *dev, struct ds_status *st)
--{
-- int err;
--
-- err = ds_send_control_cmd(dev, CTL_RESET_DEVICE, 0);
-- if (err)
-- return err;
--
-- err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM, 0);
-- if (err)
-- return err;
--
-- err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM | COMM_TYPE, 0x40);
-- if (err)
-- return err;
--
-- err = ds_send_control_mode(dev, MOD_PULSE_EN, PULSE_PROG);
-- if (err)
-- return err;
--
-- err = ds_recv_status(dev, st);
--
-- return err;
--}
--
--#endif /* 0 */
--
--static int ds_wait_status(struct ds_device *dev, struct ds_status *st)
--{
-- u8 buf[0x20];
-- int err, count = 0;
--
-- do {
-- err = ds_recv_status_nodump(dev, st, buf, sizeof(buf));
--#if 0
-- if (err >= 0) {
-- int i;
-- printk("0x%x: count=%d, status: ", dev->ep[EP_STATUS], err);
-- for (i=0; i<err; ++i)
-- printk("%02x ", buf[i]);
-- printk("\n");
-- }
--#endif
-- } while(!(buf[0x08] & 0x20) && !(err < 0) && ++count < 100);
--
--
-- if (((err > 16) && (buf[0x10] & 0x01)) || count >= 100 || err < 0) {
-- ds_recv_status(dev, st);
-- return -1;
-- } else
-- return 0;
--}
--
--int ds_reset(struct ds_device *dev, struct ds_status *st)
--{
-- int err;
--
-- //err = ds_send_control(dev, COMM_1_WIRE_RESET | COMM_F | COMM_IM | COMM_SE, SPEED_FLEXIBLE);
-- err = ds_send_control(dev, 0x43, SPEED_NORMAL);
-- if (err)
-- return err;
--
-- ds_wait_status(dev, st);
--#if 0
-- if (st->command_buffer_status) {
-- printk(KERN_INFO "Short circuit.\n");
-- return -EIO;
-- }
--#endif
--
-- return 0;
--}
--
--#if 0
--int ds_set_speed(struct ds_device *dev, int speed)
--{
-- int err;
--
-- if (speed != SPEED_NORMAL && speed != SPEED_FLEXIBLE && speed != SPEED_OVERDRIVE)
-- return -EINVAL;
--
-- if (speed != SPEED_OVERDRIVE)
-- speed = SPEED_FLEXIBLE;
--
-- speed &= 0xff;
--
-- err = ds_send_control_mode(dev, MOD_1WIRE_SPEED, speed);
-- if (err)
-- return err;
--
-- return err;
--}
--#endif /* 0 */
--
--static int ds_start_pulse(struct ds_device *dev, int delay)
--{
-- int err;
-- u8 del = 1 + (u8)(delay >> 4);
-- struct ds_status st;
--
--#if 0
-- err = ds_stop_pulse(dev, 10);
-- if (err)
-- return err;
--
-- err = ds_send_control_mode(dev, MOD_PULSE_EN, PULSE_SPUE);
-- if (err)
-- return err;
--#endif
-- err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM, del);
-- if (err)
-- return err;
--
-- err = ds_send_control(dev, COMM_PULSE | COMM_IM | COMM_F, 0);
-- if (err)
-- return err;
--
-- mdelay(delay);
--
-- ds_wait_status(dev, &st);
--
-- return err;
--}
--
--int ds_touch_bit(struct ds_device *dev, u8 bit, u8 *tbit)
--{
-- int err, count;
-- struct ds_status st;
-- u16 value = (COMM_BIT_IO | COMM_IM) | ((bit) ? COMM_D : 0);
-- u16 cmd;
--
-- err = ds_send_control(dev, value, 0);
-- if (err)
-- return err;
--
-- count = 0;
-- do {
-- err = ds_wait_status(dev, &st);
-- if (err)
-- return err;
--
-- cmd = st.command0 | (st.command1 << 8);
-- } while (cmd != value && ++count < 10);
--
-- if (err < 0 || count >= 10) {
-- printk(KERN_ERR "Failed to obtain status.\n");
-- return -EINVAL;
-- }
--
-- err = ds_recv_data(dev, tbit, sizeof(*tbit));
-- if (err < 0)
-- return err;
--
-- return 0;
--}
--
--int ds_write_bit(struct ds_device *dev, u8 bit)
--{
-- int err;
-- struct ds_status st;
--
-- err = ds_send_control(dev, COMM_BIT_IO | COMM_IM | (bit) ? COMM_D : 0, 0);
-- if (err)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- return 0;
--}
--
--int ds_write_byte(struct ds_device *dev, u8 byte)
--{
-- int err;
-- struct ds_status st;
-- u8 rbyte;
--
-- err = ds_send_control(dev, COMM_BYTE_IO | COMM_IM | COMM_SPU, byte);
-- if (err)
-- return err;
--
-- err = ds_wait_status(dev, &st);
-- if (err)
-- return err;
--
-- err = ds_recv_data(dev, &rbyte, sizeof(rbyte));
-- if (err < 0)
-- return err;
--
-- ds_start_pulse(dev, PULLUP_PULSE_DURATION);
--
-- return !(byte == rbyte);
--}
--
--int ds_read_bit(struct ds_device *dev, u8 *bit)
--{
-- int err;
--
-- err = ds_send_control_mode(dev, MOD_PULSE_EN, PULSE_SPUE);
-- if (err)
-- return err;
--
-- err = ds_send_control(dev, COMM_BIT_IO | COMM_IM | COMM_SPU | COMM_D, 0);
-- if (err)
-- return err;
--
-- err = ds_recv_data(dev, bit, sizeof(*bit));
-- if (err < 0)
-- return err;
--
-- return 0;
--}
--
--int ds_read_byte(struct ds_device *dev, u8 *byte)
--{
-- int err;
-- struct ds_status st;
--
-- err = ds_send_control(dev, COMM_BYTE_IO | COMM_IM , 0xff);
-- if (err)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- err = ds_recv_data(dev, byte, sizeof(*byte));
-- if (err < 0)
-- return err;
--
-- return 0;
--}
--
--int ds_read_block(struct ds_device *dev, u8 *buf, int len)
--{
-- struct ds_status st;
-- int err;
--
-- if (len > 64*1024)
-- return -E2BIG;
--
-- memset(buf, 0xFF, len);
--
-- err = ds_send_data(dev, buf, len);
-- if (err < 0)
-- return err;
--
-- err = ds_send_control(dev, COMM_BLOCK_IO | COMM_IM | COMM_SPU, len);
-- if (err)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- memset(buf, 0x00, len);
-- err = ds_recv_data(dev, buf, len);
--
-- return err;
--}
--
--int ds_write_block(struct ds_device *dev, u8 *buf, int len)
--{
-- int err;
-- struct ds_status st;
--
-- err = ds_send_data(dev, buf, len);
-- if (err < 0)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- err = ds_send_control(dev, COMM_BLOCK_IO | COMM_IM | COMM_SPU, len);
-- if (err)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- err = ds_recv_data(dev, buf, len);
-- if (err < 0)
-- return err;
--
-- ds_start_pulse(dev, PULLUP_PULSE_DURATION);
--
-- return !(err == len);
--}
--
--#if 0
--
--int ds_search(struct ds_device *dev, u64 init, u64 *buf, u8 id_number, int conditional_search)
--{
-- int err;
-- u16 value, index;
-- struct ds_status st;
--
-- memset(buf, 0, sizeof(buf));
--
-- err = ds_send_data(ds_dev, (unsigned char *)&init, 8);
-- if (err)
-- return err;
--
-- ds_wait_status(ds_dev, &st);
--
-- value = COMM_SEARCH_ACCESS | COMM_IM | COMM_SM | COMM_F | COMM_RTS;
-- index = (conditional_search ? 0xEC : 0xF0) | (id_number << 8);
-- err = ds_send_control(ds_dev, value, index);
-- if (err)
-- return err;
--
-- ds_wait_status(ds_dev, &st);
--
-- err = ds_recv_data(ds_dev, (unsigned char *)buf, 8*id_number);
-- if (err < 0)
-- return err;
--
-- return err/8;
--}
--
--int ds_match_access(struct ds_device *dev, u64 init)
--{
-- int err;
-- struct ds_status st;
--
-- err = ds_send_data(dev, (unsigned char *)&init, sizeof(init));
-- if (err)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- err = ds_send_control(dev, COMM_MATCH_ACCESS | COMM_IM | COMM_RST, 0x0055);
-- if (err)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- return 0;
--}
--
--int ds_set_path(struct ds_device *dev, u64 init)
--{
-- int err;
-- struct ds_status st;
-- u8 buf[9];
--
-- memcpy(buf, &init, 8);
-- buf[8] = BRANCH_MAIN;
--
-- err = ds_send_data(dev, buf, sizeof(buf));
-- if (err)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- err = ds_send_control(dev, COMM_SET_PATH | COMM_IM | COMM_RST, 0);
-- if (err)
-- return err;
--
-- ds_wait_status(dev, &st);
--
-- return 0;
--}
--
--#endif /* 0 */
--
--static int ds_probe(struct usb_interface *intf,
-- const struct usb_device_id *udev_id)
--{
-- struct usb_device *udev = interface_to_usbdev(intf);
-- struct usb_endpoint_descriptor *endpoint;
-- struct usb_host_interface *iface_desc;
-- int i, err;
--
-- ds_dev = kmalloc(sizeof(struct ds_device), GFP_KERNEL);
-- if (!ds_dev) {
-- printk(KERN_INFO "Failed to allocate new DS9490R structure.\n");
-- return -ENOMEM;
-- }
--
-- ds_dev->udev = usb_get_dev(udev);
-- usb_set_intfdata(intf, ds_dev);
--
-- err = usb_set_interface(ds_dev->udev, intf->altsetting[0].desc.bInterfaceNumber, 3);
-- if (err) {
-- printk(KERN_ERR "Failed to set alternative setting 3 for %d interface: err=%d.\n",
-- intf->altsetting[0].desc.bInterfaceNumber, err);
-- return err;
-- }
--
-- err = usb_reset_configuration(ds_dev->udev);
-- if (err) {
-- printk(KERN_ERR "Failed to reset configuration: err=%d.\n", err);
-- return err;
-- }
--
-- iface_desc = &intf->altsetting[0];
-- if (iface_desc->desc.bNumEndpoints != NUM_EP-1) {
-- printk(KERN_INFO "Num endpoints=%d. It is not DS9490R.\n", iface_desc->desc.bNumEndpoints);
-- return -ENODEV;
-- }
--
-- atomic_set(&ds_dev->refcnt, 0);
-- memset(ds_dev->ep, 0, sizeof(ds_dev->ep));
--
-- /*
-- * This loop doesn'd show control 0 endpoint,
-- * so we will fill only 1-3 endpoints entry.
-- */
-- for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-- endpoint = &iface_desc->endpoint[i].desc;
--
-- ds_dev->ep[i+1] = endpoint->bEndpointAddress;
--
-- printk("%d: addr=%x, size=%d, dir=%s, type=%x\n",
-- i, endpoint->bEndpointAddress, le16_to_cpu(endpoint->wMaxPacketSize),
-- (endpoint->bEndpointAddress & USB_DIR_IN)?"IN":"OUT",
-- endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK);
-- }
--
--#if 0
-- {
-- int err, i;
-- u64 buf[3];
-- u64 init=0xb30000002078ee81ull;
-- struct ds_status st;
--
-- ds_reset(ds_dev, &st);
-- err = ds_search(ds_dev, init, buf, 3, 0);
-- if (err < 0)
-- return err;
-- for (i=0; i<err; ++i)
-- printk("%d: %llx\n", i, buf[i]);
--
-- printk("Resetting...\n");
-- ds_reset(ds_dev, &st);
-- printk("Setting path for %llx.\n", init);
-- err = ds_set_path(ds_dev, init);
-- if (err)
-- return err;
-- printk("Calling MATCH_ACCESS.\n");
-- err = ds_match_access(ds_dev, init);
-- if (err)
-- return err;
--
-- printk("Searching the bus...\n");
-- err = ds_search(ds_dev, init, buf, 3, 0);
--
-- printk("ds_search() returned %d\n", err);
--
-- if (err < 0)
-- return err;
-- for (i=0; i<err; ++i)
-- printk("%d: %llx\n", i, buf[i]);
--
-- return 0;
-- }
--#endif
--
-- return 0;
--}
--
--static void ds_disconnect(struct usb_interface *intf)
--{
-- struct ds_device *dev;
--
-- dev = usb_get_intfdata(intf);
-- usb_set_intfdata(intf, NULL);
--
-- while (atomic_read(&dev->refcnt)) {
-- printk(KERN_INFO "Waiting for DS to become free: refcnt=%d.\n",
-- atomic_read(&dev->refcnt));
--
-- if (msleep_interruptible(1000))
-- flush_signals(current);
-- }
--
-- usb_put_dev(dev->udev);
-- kfree(dev);
-- ds_dev = NULL;
--}
--
--static int ds_init(void)
--{
-- int err;
--
-- err = usb_register(&ds_driver);
-- if (err) {
-- printk(KERN_INFO "Failed to register DS9490R USB device: err=%d.\n", err);
-- return err;
-- }
--
-- return 0;
--}
--
--static void ds_fini(void)
--{
-- usb_deregister(&ds_driver);
--}
--
--module_init(ds_init);
--module_exit(ds_fini);
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
--
--EXPORT_SYMBOL(ds_touch_bit);
--EXPORT_SYMBOL(ds_read_byte);
--EXPORT_SYMBOL(ds_read_bit);
--EXPORT_SYMBOL(ds_read_block);
--EXPORT_SYMBOL(ds_write_byte);
--EXPORT_SYMBOL(ds_write_bit);
--EXPORT_SYMBOL(ds_write_block);
--EXPORT_SYMBOL(ds_reset);
--EXPORT_SYMBOL(ds_get_device);
--EXPORT_SYMBOL(ds_put_device);
--
--/*
-- * This functions can be used for EEPROM programming,
-- * when driver will be included into mainline this will
-- * require uncommenting.
-- */
--#if 0
--EXPORT_SYMBOL(ds_start_pulse);
--EXPORT_SYMBOL(ds_set_speed);
--EXPORT_SYMBOL(ds_detect);
--EXPORT_SYMBOL(ds_stop_pulse);
--EXPORT_SYMBOL(ds_search);
--#endif
---- gregkh-2.6.orig/drivers/w1/dscore.h
-+++ /dev/null
-@@ -1,166 +0,0 @@
--/*
-- * dscore.h
-- *
-- * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-- *
-- *
-- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--#ifndef __DSCORE_H
--#define __DSCORE_H
--
--#include <linux/usb.h>
--#include <asm/atomic.h>
--
--/* COMMAND TYPE CODES */
--#define CONTROL_CMD 0x00
--#define COMM_CMD 0x01
--#define MODE_CMD 0x02
--
--/* CONTROL COMMAND CODES */
--#define CTL_RESET_DEVICE 0x0000
--#define CTL_START_EXE 0x0001
--#define CTL_RESUME_EXE 0x0002
--#define CTL_HALT_EXE_IDLE 0x0003
--#define CTL_HALT_EXE_DONE 0x0004
--#define CTL_FLUSH_COMM_CMDS 0x0007
--#define CTL_FLUSH_RCV_BUFFER 0x0008
--#define CTL_FLUSH_XMT_BUFFER 0x0009
--#define CTL_GET_COMM_CMDS 0x000A
--
--/* MODE COMMAND CODES */
--#define MOD_PULSE_EN 0x0000
--#define MOD_SPEED_CHANGE_EN 0x0001
--#define MOD_1WIRE_SPEED 0x0002
--#define MOD_STRONG_PU_DURATION 0x0003
--#define MOD_PULLDOWN_SLEWRATE 0x0004
--#define MOD_PROG_PULSE_DURATION 0x0005
--#define MOD_WRITE1_LOWTIME 0x0006
--#define MOD_DSOW0_TREC 0x0007
--
--/* COMMUNICATION COMMAND CODES */
--#define COMM_ERROR_ESCAPE 0x0601
--#define COMM_SET_DURATION 0x0012
--#define COMM_BIT_IO 0x0020
--#define COMM_PULSE 0x0030
--#define COMM_1_WIRE_RESET 0x0042
--#define COMM_BYTE_IO 0x0052
--#define COMM_MATCH_ACCESS 0x0064
--#define COMM_BLOCK_IO 0x0074
--#define COMM_READ_STRAIGHT 0x0080
--#define COMM_DO_RELEASE 0x6092
--#define COMM_SET_PATH 0x00A2
--#define COMM_WRITE_SRAM_PAGE 0x00B2
--#define COMM_WRITE_EPROM 0x00C4
--#define COMM_READ_CRC_PROT_PAGE 0x00D4
--#define COMM_READ_REDIRECT_PAGE_CRC 0x21E4
--#define COMM_SEARCH_ACCESS 0x00F4
--
--/* Communication command bits */
--#define COMM_TYPE 0x0008
--#define COMM_SE 0x0008
--#define COMM_D 0x0008
--#define COMM_Z 0x0008
--#define COMM_CH 0x0008
--#define COMM_SM 0x0008
--#define COMM_R 0x0008
--#define COMM_IM 0x0001
--
--#define COMM_PS 0x4000
--#define COMM_PST 0x4000
--#define COMM_CIB 0x4000
--#define COMM_RTS 0x4000
--#define COMM_DT 0x2000
--#define COMM_SPU 0x1000
--#define COMM_F 0x0800
--#define COMM_NTP 0x0400
--#define COMM_ICP 0x0200
--#define COMM_RST 0x0100
--
--#define PULSE_PROG 0x01
--#define PULSE_SPUE 0x02
--
--#define BRANCH_MAIN 0xCC
--#define BRANCH_AUX 0x33
--
--/*
-- * Duration of the strong pull-up pulse in milliseconds.
-- */
--#define PULLUP_PULSE_DURATION 750
--
--/* Status flags */
--#define ST_SPUA 0x01 /* Strong Pull-up is active */
--#define ST_PRGA 0x02 /* 12V programming pulse is being generated */
--#define ST_12VP 0x04 /* external 12V programming voltage is present */
--#define ST_PMOD 0x08 /* DS2490 powered from USB and external sources */
--#define ST_HALT 0x10 /* DS2490 is currently halted */
--#define ST_IDLE 0x20 /* DS2490 is currently idle */
--#define ST_EPOF 0x80
--
--#define SPEED_NORMAL 0x00
--#define SPEED_FLEXIBLE 0x01
--#define SPEED_OVERDRIVE 0x02
--
--#define NUM_EP 4
--#define EP_CONTROL 0
--#define EP_STATUS 1
--#define EP_DATA_OUT 2
--#define EP_DATA_IN 3
--
--struct ds_device
--{
-- struct usb_device *udev;
-- struct usb_interface *intf;
--
-- int ep[NUM_EP];
--
-- atomic_t refcnt;
--};
--
--struct ds_status
--{
-- u8 enable;
-- u8 speed;
-- u8 pullup_dur;
-- u8 ppuls_dur;
-- u8 pulldown_slew;
-- u8 write1_time;
-- u8 write0_time;
-- u8 reserved0;
-- u8 status;
-- u8 command0;
-- u8 command1;
-- u8 command_buffer_status;
-- u8 data_out_buffer_status;
-- u8 data_in_buffer_status;
-- u8 reserved1;
-- u8 reserved2;
--
--};
--
--int ds_touch_bit(struct ds_device *, u8, u8 *);
--int ds_read_byte(struct ds_device *, u8 *);
--int ds_read_bit(struct ds_device *, u8 *);
--int ds_write_byte(struct ds_device *, u8);
--int ds_write_bit(struct ds_device *, u8);
--int ds_reset(struct ds_device *, struct ds_status *);
--struct ds_device * ds_get_device(void);
--void ds_put_device(struct ds_device *);
--int ds_write_block(struct ds_device *, u8 *, int);
--int ds_read_block(struct ds_device *, u8 *, int);
--
--#endif /* __DSCORE_H */
--
---- /dev/null
-+++ gregkh-2.6/drivers/w1/masters/Kconfig
-@@ -0,0 +1,38 @@
-+#
-+# 1-wire bus master configuration
-+#
-+
-+menu "1-wire Bus Masters"
-+ depends on W1
-+
-+config W1_MASTER_MATROX
-+ tristate "Matrox G400 transport layer for 1-wire"
-+ depends on W1 && PCI
-+ help
-+ Say Y here if you want to communicate with your 1-wire devices
-+ using Matrox's G400 GPIO pins.
-+
-+ This support is also available as a module. If so, the module
-+ will be called matrox_w1.ko.
-+
-+config W1_MASTER_DS9490
-+ tristate "DS9490R transport layer driver"
-+ depends on W1 && USB
-+ help
-+ Say Y here if you want to have a driver for DS9490R UWB <-> W1 bridge.
-+
-+ This support is also available as a module. If so, the module
-+ will be called ds9490r.ko.
-+
-+config W1_MASTER_DS9490_BRIDGE
-+ tristate "DS9490R USB <-> W1 transport layer for 1-wire"
-+ depends on W1_DS9490
-+ help
-+ Say Y here if you want to communicate with your 1-wire devices
-+ using DS9490R USB bridge.
-+
-+ This support is also available as a module. If so, the module
-+ will be called ds_w1_bridge.ko.
-+
-+endmenu
-+
---- /dev/null
-+++ gregkh-2.6/drivers/w1/masters/Makefile
-@@ -0,0 +1,11 @@
-+#
-+# Makefile for 1-wire bus master drivers.
-+#
-+
-+obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.o
-+
-+obj-$(CONFIG_W1_MASTER_DS9490) += ds9490r.o
-+ds9490r-objs := dscore.o
-+
-+obj-$(CONFIG_W1_MASTER_DS9490_BRIDGE) += ds_w1_bridge.o
-+
---- /dev/null
-+++ gregkh-2.6/drivers/w1/masters/ds_w1_bridge.c
-@@ -0,0 +1,174 @@
-+/*
-+ * ds_w1_bridge.c
-+ *
-+ * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-+ *
-+ *
-+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/types.h>
-+
-+#include "../w1.h"
-+#include "../w1_int.h"
-+#include "dscore.h"
-+
-+static struct ds_device *ds_dev;
-+static struct w1_bus_master *ds_bus_master;
-+
-+static u8 ds9490r_touch_bit(void *data, u8 bit)
-+{
-+ u8 ret;
-+ struct ds_device *dev = data;
-+
-+ if (ds_touch_bit(dev, bit, &ret))
-+ return 0;
-+
-+ return ret;
-+}
-+
-+static void ds9490r_write_bit(void *data, u8 bit)
-+{
-+ struct ds_device *dev = data;
-+
-+ ds_write_bit(dev, bit);
-+}
-+
-+static void ds9490r_write_byte(void *data, u8 byte)
-+{
-+ struct ds_device *dev = data;
-+
-+ ds_write_byte(dev, byte);
-+}
-+
-+static u8 ds9490r_read_bit(void *data)
-+{
-+ struct ds_device *dev = data;
-+ int err;
-+ u8 bit = 0;
-+
-+ err = ds_touch_bit(dev, 1, &bit);
-+ if (err)
-+ return 0;
-+ //err = ds_read_bit(dev, &bit);
-+ //if (err)
-+ // return 0;
-+
-+ return bit & 1;
-+}
-+
-+static u8 ds9490r_read_byte(void *data)
-+{
-+ struct ds_device *dev = data;
-+ int err;
-+ u8 byte = 0;
-+
-+ err = ds_read_byte(dev, &byte);
-+ if (err)
-+ return 0;
-+
-+ return byte;
-+}
-+
-+static void ds9490r_write_block(void *data, const u8 *buf, int len)
-+{
-+ struct ds_device *dev = data;
-+
-+ ds_write_block(dev, (u8 *)buf, len);
-+}
-+
-+static u8 ds9490r_read_block(void *data, u8 *buf, int len)
-+{
-+ struct ds_device *dev = data;
-+ int err;
-+
-+ err = ds_read_block(dev, buf, len);
-+ if (err < 0)
-+ return 0;
-+
-+ return len;
-+}
-+
-+static u8 ds9490r_reset(void *data)
-+{
-+ struct ds_device *dev = data;
-+ struct ds_status st;
-+ int err;
-+
-+ memset(&st, 0, sizeof(st));
-+
-+ err = ds_reset(dev, &st);
-+ if (err)
-+ return 1;
-+
-+ return 0;
-+}
-+
-+static int __devinit ds_w1_init(void)
-+{
-+ int err;
-+
-+ ds_bus_master = kmalloc(sizeof(*ds_bus_master), GFP_KERNEL);
-+ if (!ds_bus_master) {
-+ printk(KERN_ERR "Failed to allocate DS9490R USB<->W1 bus_master structure.\n");
-+ return -ENOMEM;
-+ }
-+
-+ ds_dev = ds_get_device();
-+ if (!ds_dev) {
-+ printk(KERN_ERR "DS9490R is not registered.\n");
-+ err = -ENODEV;
-+ goto err_out_free_bus_master;
-+ }
-+
-+ memset(ds_bus_master, 0, sizeof(*ds_bus_master));
-+
-+ ds_bus_master->data = ds_dev;
-+ ds_bus_master->touch_bit = &ds9490r_touch_bit;
-+ ds_bus_master->read_bit = &ds9490r_read_bit;
-+ ds_bus_master->write_bit = &ds9490r_write_bit;
-+ ds_bus_master->read_byte = &ds9490r_read_byte;
-+ ds_bus_master->write_byte = &ds9490r_write_byte;
-+ ds_bus_master->read_block = &ds9490r_read_block;
-+ ds_bus_master->write_block = &ds9490r_write_block;
-+ ds_bus_master->reset_bus = &ds9490r_reset;
-+
-+ err = w1_add_master_device(ds_bus_master);
-+ if (err)
-+ goto err_out_put_device;
-+
-+ return 0;
-+
-+err_out_put_device:
-+ ds_put_device(ds_dev);
-+err_out_free_bus_master:
-+ kfree(ds_bus_master);
-+
-+ return err;
-+}
-+
-+static void __devexit ds_w1_fini(void)
-+{
-+ w1_remove_master_device(ds_bus_master);
-+ ds_put_device(ds_dev);
-+ kfree(ds_bus_master);
-+}
-+
-+module_init(ds_w1_init);
-+module_exit(ds_w1_fini);
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
---- /dev/null
-+++ gregkh-2.6/drivers/w1/masters/dscore.c
-@@ -0,0 +1,795 @@
-+/*
-+ * dscore.c
-+ *
-+ * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-+ *
-+ *
-+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/kernel.h>
-+#include <linux/mod_devicetable.h>
-+#include <linux/usb.h>
-+
-+#include "dscore.h"
-+
-+static struct usb_device_id ds_id_table [] = {
-+ { USB_DEVICE(0x04fa, 0x2490) },
-+ { },
-+};
-+MODULE_DEVICE_TABLE(usb, ds_id_table);
-+
-+static int ds_probe(struct usb_interface *, const struct usb_device_id *);
-+static void ds_disconnect(struct usb_interface *);
-+
-+int ds_touch_bit(struct ds_device *, u8, u8 *);
-+int ds_read_byte(struct ds_device *, u8 *);
-+int ds_read_bit(struct ds_device *, u8 *);
-+int ds_write_byte(struct ds_device *, u8);
-+int ds_write_bit(struct ds_device *, u8);
-+static int ds_start_pulse(struct ds_device *, int);
-+int ds_reset(struct ds_device *, struct ds_status *);
-+struct ds_device * ds_get_device(void);
-+void ds_put_device(struct ds_device *);
-+
-+static inline void ds_dump_status(unsigned char *, unsigned char *, int);
-+static int ds_send_control(struct ds_device *, u16, u16);
-+static int ds_send_control_mode(struct ds_device *, u16, u16);
-+static int ds_send_control_cmd(struct ds_device *, u16, u16);
-+
-+
-+static struct usb_driver ds_driver = {
-+ .name = "DS9490R",
-+ .probe = ds_probe,
-+ .disconnect = ds_disconnect,
-+ .id_table = ds_id_table,
-+};
-+
-+static struct ds_device *ds_dev;
-+
-+struct ds_device * ds_get_device(void)
-+{
-+ if (ds_dev)
-+ atomic_inc(&ds_dev->refcnt);
-+ return ds_dev;
-+}
-+
-+void ds_put_device(struct ds_device *dev)
-+{
-+ atomic_dec(&dev->refcnt);
-+}
-+
-+static int ds_send_control_cmd(struct ds_device *dev, u16 value, u16 index)
-+{
-+ int err;
-+
-+ err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
-+ CONTROL_CMD, 0x40, value, index, NULL, 0, 1000);
-+ if (err < 0) {
-+ printk(KERN_ERR "Failed to send command control message %x.%x: err=%d.\n",
-+ value, index, err);
-+ return err;
-+ }
-+
-+ return err;
-+}
-+
-+static int ds_send_control_mode(struct ds_device *dev, u16 value, u16 index)
-+{
-+ int err;
-+
-+ err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
-+ MODE_CMD, 0x40, value, index, NULL, 0, 1000);
-+ if (err < 0) {
-+ printk(KERN_ERR "Failed to send mode control message %x.%x: err=%d.\n",
-+ value, index, err);
-+ return err;
-+ }
-+
-+ return err;
-+}
-+
-+static int ds_send_control(struct ds_device *dev, u16 value, u16 index)
-+{
-+ int err;
-+
-+ err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
-+ COMM_CMD, 0x40, value, index, NULL, 0, 1000);
-+ if (err < 0) {
-+ printk(KERN_ERR "Failed to send control message %x.%x: err=%d.\n",
-+ value, index, err);
-+ return err;
-+ }
-+
-+ return err;
-+}
-+
-+static inline void ds_dump_status(unsigned char *buf, unsigned char *str, int off)
-+{
-+ printk("%45s: %8x\n", str, buf[off]);
-+}
-+
-+static int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st,
-+ unsigned char *buf, int size)
-+{
-+ int count, err;
-+
-+ memset(st, 0, sizeof(st));
-+
-+ count = 0;
-+ err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_STATUS]), buf, size, &count, 100);
-+ if (err < 0) {
-+ printk(KERN_ERR "Failed to read 1-wire data from 0x%x: err=%d.\n", dev->ep[EP_STATUS], err);
-+ return err;
-+ }
-+
-+ if (count >= sizeof(*st))
-+ memcpy(st, buf, sizeof(*st));
-+
-+ return count;
-+}
-+
-+static int ds_recv_status(struct ds_device *dev, struct ds_status *st)
-+{
-+ unsigned char buf[64];
-+ int count, err = 0, i;
-+
-+ memcpy(st, buf, sizeof(*st));
-+
-+ count = ds_recv_status_nodump(dev, st, buf, sizeof(buf));
-+ if (count < 0)
-+ return err;
-+
-+ printk("0x%x: count=%d, status: ", dev->ep[EP_STATUS], count);
-+ for (i=0; i<count; ++i)
-+ printk("%02x ", buf[i]);
-+ printk("\n");
-+
-+ if (count >= 16) {
-+ ds_dump_status(buf, "enable flag", 0);
-+ ds_dump_status(buf, "1-wire speed", 1);
-+ ds_dump_status(buf, "strong pullup duration", 2);
-+ ds_dump_status(buf, "programming pulse duration", 3);
-+ ds_dump_status(buf, "pulldown slew rate control", 4);
-+ ds_dump_status(buf, "write-1 low time", 5);
-+ ds_dump_status(buf, "data sample offset/write-0 recovery time", 6);
-+ ds_dump_status(buf, "reserved (test register)", 7);
-+ ds_dump_status(buf, "device status flags", 8);
-+ ds_dump_status(buf, "communication command byte 1", 9);
-+ ds_dump_status(buf, "communication command byte 2", 10);
-+ ds_dump_status(buf, "communication command buffer status", 11);
-+ ds_dump_status(buf, "1-wire data output buffer status", 12);
-+ ds_dump_status(buf, "1-wire data input buffer status", 13);
-+ ds_dump_status(buf, "reserved", 14);
-+ ds_dump_status(buf, "reserved", 15);
-+ }
-+
-+ memcpy(st, buf, sizeof(*st));
-+
-+ if (st->status & ST_EPOF) {
-+ printk(KERN_INFO "Resetting device after ST_EPOF.\n");
-+ err = ds_send_control_cmd(dev, CTL_RESET_DEVICE, 0);
-+ if (err)
-+ return err;
-+ count = ds_recv_status_nodump(dev, st, buf, sizeof(buf));
-+ if (count < 0)
-+ return err;
-+ }
-+#if 0
-+ if (st->status & ST_IDLE) {
-+ printk(KERN_INFO "Resetting pulse after ST_IDLE.\n");
-+ err = ds_start_pulse(dev, PULLUP_PULSE_DURATION);
-+ if (err)
-+ return err;
-+ }
-+#endif
-+
-+ return err;
-+}
-+
-+static int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size)
-+{
-+ int count, err;
-+ struct ds_status st;
-+
-+ count = 0;
-+ err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_DATA_IN]),
-+ buf, size, &count, 1000);
-+ if (err < 0) {
-+ printk(KERN_INFO "Clearing ep0x%x.\n", dev->ep[EP_DATA_IN]);
-+ usb_clear_halt(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_DATA_IN]));
-+ ds_recv_status(dev, &st);
-+ return err;
-+ }
-+
-+#if 0
-+ {
-+ int i;
-+
-+ printk("%s: count=%d: ", __func__, count);
-+ for (i=0; i<count; ++i)
-+ printk("%02x ", buf[i]);
-+ printk("\n");
-+ }
-+#endif
-+ return count;
-+}
-+
-+static int ds_send_data(struct ds_device *dev, unsigned char *buf, int len)
-+{
-+ int count, err;
-+
-+ count = 0;
-+ err = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, dev->ep[EP_DATA_OUT]), buf, len, &count, 1000);
-+ if (err < 0) {
-+ printk(KERN_ERR "Failed to read 1-wire data from 0x02: err=%d.\n", err);
-+ return err;
-+ }
-+
-+ return err;
-+}
-+
-+#if 0
-+
-+int ds_stop_pulse(struct ds_device *dev, int limit)
-+{
-+ struct ds_status st;
-+ int count = 0, err = 0;
-+ u8 buf[0x20];
-+
-+ do {
-+ err = ds_send_control(dev, CTL_HALT_EXE_IDLE, 0);
-+ if (err)
-+ break;
-+ err = ds_send_control(dev, CTL_RESUME_EXE, 0);
-+ if (err)
-+ break;
-+ err = ds_recv_status_nodump(dev, &st, buf, sizeof(buf));
-+ if (err)
-+ break;
-+
-+ if ((st.status & ST_SPUA) == 0) {
-+ err = ds_send_control_mode(dev, MOD_PULSE_EN, 0);
-+ if (err)
-+ break;
-+ }
-+ } while(++count < limit);
-+
-+ return err;
-+}
-+
-+int ds_detect(struct ds_device *dev, struct ds_status *st)
-+{
-+ int err;
-+
-+ err = ds_send_control_cmd(dev, CTL_RESET_DEVICE, 0);
-+ if (err)
-+ return err;
-+
-+ err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM, 0);
-+ if (err)
-+ return err;
-+
-+ err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM | COMM_TYPE, 0x40);
-+ if (err)
-+ return err;
-+
-+ err = ds_send_control_mode(dev, MOD_PULSE_EN, PULSE_PROG);
-+ if (err)
-+ return err;
-+
-+ err = ds_recv_status(dev, st);
-+
-+ return err;
-+}
-+
-+#endif /* 0 */
-+
-+static int ds_wait_status(struct ds_device *dev, struct ds_status *st)
-+{
-+ u8 buf[0x20];
-+ int err, count = 0;
-+
-+ do {
-+ err = ds_recv_status_nodump(dev, st, buf, sizeof(buf));
-+#if 0
-+ if (err >= 0) {
-+ int i;
-+ printk("0x%x: count=%d, status: ", dev->ep[EP_STATUS], err);
-+ for (i=0; i<err; ++i)
-+ printk("%02x ", buf[i]);
-+ printk("\n");
-+ }
-+#endif
-+ } while(!(buf[0x08] & 0x20) && !(err < 0) && ++count < 100);
-+
-+
-+ if (((err > 16) && (buf[0x10] & 0x01)) || count >= 100 || err < 0) {
-+ ds_recv_status(dev, st);
-+ return -1;
-+ } else
-+ return 0;
-+}
-+
-+int ds_reset(struct ds_device *dev, struct ds_status *st)
-+{
-+ int err;
-+
-+ //err = ds_send_control(dev, COMM_1_WIRE_RESET | COMM_F | COMM_IM | COMM_SE, SPEED_FLEXIBLE);
-+ err = ds_send_control(dev, 0x43, SPEED_NORMAL);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, st);
-+#if 0
-+ if (st->command_buffer_status) {
-+ printk(KERN_INFO "Short circuit.\n");
-+ return -EIO;
-+ }
-+#endif
-+
-+ return 0;
-+}
-+
-+#if 0
-+int ds_set_speed(struct ds_device *dev, int speed)
-+{
-+ int err;
-+
-+ if (speed != SPEED_NORMAL && speed != SPEED_FLEXIBLE && speed != SPEED_OVERDRIVE)
-+ return -EINVAL;
-+
-+ if (speed != SPEED_OVERDRIVE)
-+ speed = SPEED_FLEXIBLE;
-+
-+ speed &= 0xff;
-+
-+ err = ds_send_control_mode(dev, MOD_1WIRE_SPEED, speed);
-+ if (err)
-+ return err;
-+
-+ return err;
-+}
-+#endif /* 0 */
-+
-+static int ds_start_pulse(struct ds_device *dev, int delay)
-+{
-+ int err;
-+ u8 del = 1 + (u8)(delay >> 4);
-+ struct ds_status st;
-+
-+#if 0
-+ err = ds_stop_pulse(dev, 10);
-+ if (err)
-+ return err;
-+
-+ err = ds_send_control_mode(dev, MOD_PULSE_EN, PULSE_SPUE);
-+ if (err)
-+ return err;
-+#endif
-+ err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM, del);
-+ if (err)
-+ return err;
-+
-+ err = ds_send_control(dev, COMM_PULSE | COMM_IM | COMM_F, 0);
-+ if (err)
-+ return err;
-+
-+ mdelay(delay);
-+
-+ ds_wait_status(dev, &st);
-+
-+ return err;
-+}
-+
-+int ds_touch_bit(struct ds_device *dev, u8 bit, u8 *tbit)
-+{
-+ int err, count;
-+ struct ds_status st;
-+ u16 value = (COMM_BIT_IO | COMM_IM) | ((bit) ? COMM_D : 0);
-+ u16 cmd;
-+
-+ err = ds_send_control(dev, value, 0);
-+ if (err)
-+ return err;
-+
-+ count = 0;
-+ do {
-+ err = ds_wait_status(dev, &st);
-+ if (err)
-+ return err;
-+
-+ cmd = st.command0 | (st.command1 << 8);
-+ } while (cmd != value && ++count < 10);
-+
-+ if (err < 0 || count >= 10) {
-+ printk(KERN_ERR "Failed to obtain status.\n");
-+ return -EINVAL;
-+ }
-+
-+ err = ds_recv_data(dev, tbit, sizeof(*tbit));
-+ if (err < 0)
-+ return err;
-+
-+ return 0;
-+}
-+
-+int ds_write_bit(struct ds_device *dev, u8 bit)
-+{
-+ int err;
-+ struct ds_status st;
-+
-+ err = ds_send_control(dev, COMM_BIT_IO | COMM_IM | (bit) ? COMM_D : 0, 0);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ return 0;
-+}
-+
-+int ds_write_byte(struct ds_device *dev, u8 byte)
-+{
-+ int err;
-+ struct ds_status st;
-+ u8 rbyte;
-+
-+ err = ds_send_control(dev, COMM_BYTE_IO | COMM_IM | COMM_SPU, byte);
-+ if (err)
-+ return err;
-+
-+ err = ds_wait_status(dev, &st);
-+ if (err)
-+ return err;
-+
-+ err = ds_recv_data(dev, &rbyte, sizeof(rbyte));
-+ if (err < 0)
-+ return err;
-+
-+ ds_start_pulse(dev, PULLUP_PULSE_DURATION);
-+
-+ return !(byte == rbyte);
-+}
-+
-+int ds_read_bit(struct ds_device *dev, u8 *bit)
-+{
-+ int err;
-+
-+ err = ds_send_control_mode(dev, MOD_PULSE_EN, PULSE_SPUE);
-+ if (err)
-+ return err;
-+
-+ err = ds_send_control(dev, COMM_BIT_IO | COMM_IM | COMM_SPU | COMM_D, 0);
-+ if (err)
-+ return err;
-+
-+ err = ds_recv_data(dev, bit, sizeof(*bit));
-+ if (err < 0)
-+ return err;
-+
-+ return 0;
-+}
-+
-+int ds_read_byte(struct ds_device *dev, u8 *byte)
-+{
-+ int err;
-+ struct ds_status st;
-+
-+ err = ds_send_control(dev, COMM_BYTE_IO | COMM_IM , 0xff);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ err = ds_recv_data(dev, byte, sizeof(*byte));
-+ if (err < 0)
-+ return err;
-+
-+ return 0;
-+}
-+
-+int ds_read_block(struct ds_device *dev, u8 *buf, int len)
-+{
-+ struct ds_status st;
-+ int err;
-+
-+ if (len > 64*1024)
-+ return -E2BIG;
-+
-+ memset(buf, 0xFF, len);
-+
-+ err = ds_send_data(dev, buf, len);
-+ if (err < 0)
-+ return err;
-+
-+ err = ds_send_control(dev, COMM_BLOCK_IO | COMM_IM | COMM_SPU, len);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ memset(buf, 0x00, len);
-+ err = ds_recv_data(dev, buf, len);
-+
-+ return err;
-+}
-+
-+int ds_write_block(struct ds_device *dev, u8 *buf, int len)
-+{
-+ int err;
-+ struct ds_status st;
-+
-+ err = ds_send_data(dev, buf, len);
-+ if (err < 0)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ err = ds_send_control(dev, COMM_BLOCK_IO | COMM_IM | COMM_SPU, len);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ err = ds_recv_data(dev, buf, len);
-+ if (err < 0)
-+ return err;
-+
-+ ds_start_pulse(dev, PULLUP_PULSE_DURATION);
-+
-+ return !(err == len);
-+}
-+
-+#if 0
-+
-+int ds_search(struct ds_device *dev, u64 init, u64 *buf, u8 id_number, int conditional_search)
-+{
-+ int err;
-+ u16 value, index;
-+ struct ds_status st;
-+
-+ memset(buf, 0, sizeof(buf));
-+
-+ err = ds_send_data(ds_dev, (unsigned char *)&init, 8);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(ds_dev, &st);
-+
-+ value = COMM_SEARCH_ACCESS | COMM_IM | COMM_SM | COMM_F | COMM_RTS;
-+ index = (conditional_search ? 0xEC : 0xF0) | (id_number << 8);
-+ err = ds_send_control(ds_dev, value, index);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(ds_dev, &st);
-+
-+ err = ds_recv_data(ds_dev, (unsigned char *)buf, 8*id_number);
-+ if (err < 0)
-+ return err;
-+
-+ return err/8;
-+}
-+
-+int ds_match_access(struct ds_device *dev, u64 init)
-+{
-+ int err;
-+ struct ds_status st;
-+
-+ err = ds_send_data(dev, (unsigned char *)&init, sizeof(init));
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ err = ds_send_control(dev, COMM_MATCH_ACCESS | COMM_IM | COMM_RST, 0x0055);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ return 0;
-+}
-+
-+int ds_set_path(struct ds_device *dev, u64 init)
-+{
-+ int err;
-+ struct ds_status st;
-+ u8 buf[9];
-+
-+ memcpy(buf, &init, 8);
-+ buf[8] = BRANCH_MAIN;
-+
-+ err = ds_send_data(dev, buf, sizeof(buf));
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ err = ds_send_control(dev, COMM_SET_PATH | COMM_IM | COMM_RST, 0);
-+ if (err)
-+ return err;
-+
-+ ds_wait_status(dev, &st);
-+
-+ return 0;
-+}
-+
-+#endif /* 0 */
-+
-+static int ds_probe(struct usb_interface *intf,
-+ const struct usb_device_id *udev_id)
-+{
-+ struct usb_device *udev = interface_to_usbdev(intf);
-+ struct usb_endpoint_descriptor *endpoint;
-+ struct usb_host_interface *iface_desc;
-+ int i, err;
-+
-+ ds_dev = kmalloc(sizeof(struct ds_device), GFP_KERNEL);
-+ if (!ds_dev) {
-+ printk(KERN_INFO "Failed to allocate new DS9490R structure.\n");
-+ return -ENOMEM;
-+ }
-+
-+ ds_dev->udev = usb_get_dev(udev);
-+ usb_set_intfdata(intf, ds_dev);
-+
-+ err = usb_set_interface(ds_dev->udev, intf->altsetting[0].desc.bInterfaceNumber, 3);
-+ if (err) {
-+ printk(KERN_ERR "Failed to set alternative setting 3 for %d interface: err=%d.\n",
-+ intf->altsetting[0].desc.bInterfaceNumber, err);
-+ return err;
-+ }
-+
-+ err = usb_reset_configuration(ds_dev->udev);
-+ if (err) {
-+ printk(KERN_ERR "Failed to reset configuration: err=%d.\n", err);
-+ return err;
-+ }
-+
-+ iface_desc = &intf->altsetting[0];
-+ if (iface_desc->desc.bNumEndpoints != NUM_EP-1) {
-+ printk(KERN_INFO "Num endpoints=%d. It is not DS9490R.\n", iface_desc->desc.bNumEndpoints);
-+ return -ENODEV;
-+ }
-+
-+ atomic_set(&ds_dev->refcnt, 0);
-+ memset(ds_dev->ep, 0, sizeof(ds_dev->ep));
-+
-+ /*
-+ * This loop doesn'd show control 0 endpoint,
-+ * so we will fill only 1-3 endpoints entry.
-+ */
-+ for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-+ endpoint = &iface_desc->endpoint[i].desc;
-+
-+ ds_dev->ep[i+1] = endpoint->bEndpointAddress;
-+
-+ printk("%d: addr=%x, size=%d, dir=%s, type=%x\n",
-+ i, endpoint->bEndpointAddress, le16_to_cpu(endpoint->wMaxPacketSize),
-+ (endpoint->bEndpointAddress & USB_DIR_IN)?"IN":"OUT",
-+ endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK);
-+ }
-+
-+#if 0
-+ {
-+ int err, i;
-+ u64 buf[3];
-+ u64 init=0xb30000002078ee81ull;
-+ struct ds_status st;
-+
-+ ds_reset(ds_dev, &st);
-+ err = ds_search(ds_dev, init, buf, 3, 0);
-+ if (err < 0)
-+ return err;
-+ for (i=0; i<err; ++i)
-+ printk("%d: %llx\n", i, buf[i]);
-+
-+ printk("Resetting...\n");
-+ ds_reset(ds_dev, &st);
-+ printk("Setting path for %llx.\n", init);
-+ err = ds_set_path(ds_dev, init);
-+ if (err)
-+ return err;
-+ printk("Calling MATCH_ACCESS.\n");
-+ err = ds_match_access(ds_dev, init);
-+ if (err)
-+ return err;
-+
-+ printk("Searching the bus...\n");
-+ err = ds_search(ds_dev, init, buf, 3, 0);
-+
-+ printk("ds_search() returned %d\n", err);
-+
-+ if (err < 0)
-+ return err;
-+ for (i=0; i<err; ++i)
-+ printk("%d: %llx\n", i, buf[i]);
-+
-+ return 0;
-+ }
-+#endif
-+
-+ return 0;
-+}
-+
-+static void ds_disconnect(struct usb_interface *intf)
-+{
-+ struct ds_device *dev;
-+
-+ dev = usb_get_intfdata(intf);
-+ usb_set_intfdata(intf, NULL);
-+
-+ while (atomic_read(&dev->refcnt)) {
-+ printk(KERN_INFO "Waiting for DS to become free: refcnt=%d.\n",
-+ atomic_read(&dev->refcnt));
-+
-+ if (msleep_interruptible(1000))
-+ flush_signals(current);
-+ }
-+
-+ usb_put_dev(dev->udev);
-+ kfree(dev);
-+ ds_dev = NULL;
-+}
-+
-+static int ds_init(void)
-+{
-+ int err;
-+
-+ err = usb_register(&ds_driver);
-+ if (err) {
-+ printk(KERN_INFO "Failed to register DS9490R USB device: err=%d.\n", err);
-+ return err;
-+ }
-+
-+ return 0;
-+}
-+
-+static void ds_fini(void)
-+{
-+ usb_deregister(&ds_driver);
-+}
-+
-+module_init(ds_init);
-+module_exit(ds_fini);
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
-+
-+EXPORT_SYMBOL(ds_touch_bit);
-+EXPORT_SYMBOL(ds_read_byte);
-+EXPORT_SYMBOL(ds_read_bit);
-+EXPORT_SYMBOL(ds_read_block);
-+EXPORT_SYMBOL(ds_write_byte);
-+EXPORT_SYMBOL(ds_write_bit);
-+EXPORT_SYMBOL(ds_write_block);
-+EXPORT_SYMBOL(ds_reset);
-+EXPORT_SYMBOL(ds_get_device);
-+EXPORT_SYMBOL(ds_put_device);
-+
-+/*
-+ * This functions can be used for EEPROM programming,
-+ * when driver will be included into mainline this will
-+ * require uncommenting.
-+ */
-+#if 0
-+EXPORT_SYMBOL(ds_start_pulse);
-+EXPORT_SYMBOL(ds_set_speed);
-+EXPORT_SYMBOL(ds_detect);
-+EXPORT_SYMBOL(ds_stop_pulse);
-+EXPORT_SYMBOL(ds_search);
-+#endif
---- /dev/null
-+++ gregkh-2.6/drivers/w1/masters/dscore.h
-@@ -0,0 +1,166 @@
-+/*
-+ * dscore.h
-+ *
-+ * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-+ *
-+ *
-+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#ifndef __DSCORE_H
-+#define __DSCORE_H
-+
-+#include <linux/usb.h>
-+#include <asm/atomic.h>
-+
-+/* COMMAND TYPE CODES */
-+#define CONTROL_CMD 0x00
-+#define COMM_CMD 0x01
-+#define MODE_CMD 0x02
-+
-+/* CONTROL COMMAND CODES */
-+#define CTL_RESET_DEVICE 0x0000
-+#define CTL_START_EXE 0x0001
-+#define CTL_RESUME_EXE 0x0002
-+#define CTL_HALT_EXE_IDLE 0x0003
-+#define CTL_HALT_EXE_DONE 0x0004
-+#define CTL_FLUSH_COMM_CMDS 0x0007
-+#define CTL_FLUSH_RCV_BUFFER 0x0008
-+#define CTL_FLUSH_XMT_BUFFER 0x0009
-+#define CTL_GET_COMM_CMDS 0x000A
-+
-+/* MODE COMMAND CODES */
-+#define MOD_PULSE_EN 0x0000
-+#define MOD_SPEED_CHANGE_EN 0x0001
-+#define MOD_1WIRE_SPEED 0x0002
-+#define MOD_STRONG_PU_DURATION 0x0003
-+#define MOD_PULLDOWN_SLEWRATE 0x0004
-+#define MOD_PROG_PULSE_DURATION 0x0005
-+#define MOD_WRITE1_LOWTIME 0x0006
-+#define MOD_DSOW0_TREC 0x0007
-+
-+/* COMMUNICATION COMMAND CODES */
-+#define COMM_ERROR_ESCAPE 0x0601
-+#define COMM_SET_DURATION 0x0012
-+#define COMM_BIT_IO 0x0020
-+#define COMM_PULSE 0x0030
-+#define COMM_1_WIRE_RESET 0x0042
-+#define COMM_BYTE_IO 0x0052
-+#define COMM_MATCH_ACCESS 0x0064
-+#define COMM_BLOCK_IO 0x0074
-+#define COMM_READ_STRAIGHT 0x0080
-+#define COMM_DO_RELEASE 0x6092
-+#define COMM_SET_PATH 0x00A2
-+#define COMM_WRITE_SRAM_PAGE 0x00B2
-+#define COMM_WRITE_EPROM 0x00C4
-+#define COMM_READ_CRC_PROT_PAGE 0x00D4
-+#define COMM_READ_REDIRECT_PAGE_CRC 0x21E4
-+#define COMM_SEARCH_ACCESS 0x00F4
-+
-+/* Communication command bits */
-+#define COMM_TYPE 0x0008
-+#define COMM_SE 0x0008
-+#define COMM_D 0x0008
-+#define COMM_Z 0x0008
-+#define COMM_CH 0x0008
-+#define COMM_SM 0x0008
-+#define COMM_R 0x0008
-+#define COMM_IM 0x0001
-+
-+#define COMM_PS 0x4000
-+#define COMM_PST 0x4000
-+#define COMM_CIB 0x4000
-+#define COMM_RTS 0x4000
-+#define COMM_DT 0x2000
-+#define COMM_SPU 0x1000
-+#define COMM_F 0x0800
-+#define COMM_NTP 0x0400
-+#define COMM_ICP 0x0200
-+#define COMM_RST 0x0100
-+
-+#define PULSE_PROG 0x01
-+#define PULSE_SPUE 0x02
-+
-+#define BRANCH_MAIN 0xCC
-+#define BRANCH_AUX 0x33
-+
-+/*
-+ * Duration of the strong pull-up pulse in milliseconds.
-+ */
-+#define PULLUP_PULSE_DURATION 750
-+
-+/* Status flags */
-+#define ST_SPUA 0x01 /* Strong Pull-up is active */
-+#define ST_PRGA 0x02 /* 12V programming pulse is being generated */
-+#define ST_12VP 0x04 /* external 12V programming voltage is present */
-+#define ST_PMOD 0x08 /* DS2490 powered from USB and external sources */
-+#define ST_HALT 0x10 /* DS2490 is currently halted */
-+#define ST_IDLE 0x20 /* DS2490 is currently idle */
-+#define ST_EPOF 0x80
-+
-+#define SPEED_NORMAL 0x00
-+#define SPEED_FLEXIBLE 0x01
-+#define SPEED_OVERDRIVE 0x02
-+
-+#define NUM_EP 4
-+#define EP_CONTROL 0
-+#define EP_STATUS 1
-+#define EP_DATA_OUT 2
-+#define EP_DATA_IN 3
-+
-+struct ds_device
-+{
-+ struct usb_device *udev;
-+ struct usb_interface *intf;
-+
-+ int ep[NUM_EP];
-+
-+ atomic_t refcnt;
-+};
-+
-+struct ds_status
-+{
-+ u8 enable;
-+ u8 speed;
-+ u8 pullup_dur;
-+ u8 ppuls_dur;
-+ u8 pulldown_slew;
-+ u8 write1_time;
-+ u8 write0_time;
-+ u8 reserved0;
-+ u8 status;
-+ u8 command0;
-+ u8 command1;
-+ u8 command_buffer_status;
-+ u8 data_out_buffer_status;
-+ u8 data_in_buffer_status;
-+ u8 reserved1;
-+ u8 reserved2;
-+
-+};
-+
-+int ds_touch_bit(struct ds_device *, u8, u8 *);
-+int ds_read_byte(struct ds_device *, u8 *);
-+int ds_read_bit(struct ds_device *, u8 *);
-+int ds_write_byte(struct ds_device *, u8);
-+int ds_write_bit(struct ds_device *, u8);
-+int ds_reset(struct ds_device *, struct ds_status *);
-+struct ds_device * ds_get_device(void);
-+void ds_put_device(struct ds_device *);
-+int ds_write_block(struct ds_device *, u8 *, int);
-+int ds_read_block(struct ds_device *, u8 *, int);
-+
-+#endif /* __DSCORE_H */
-+
---- /dev/null
-+++ gregkh-2.6/drivers/w1/masters/matrox_w1.c
-@@ -0,0 +1,247 @@
-+/*
-+ * matrox_w1.c
-+ *
-+ * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-+ *
-+ *
-+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <asm/types.h>
-+#include <asm/atomic.h>
-+#include <asm/io.h>
-+
-+#include <linux/delay.h>
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/list.h>
-+#include <linux/interrupt.h>
-+#include <linux/spinlock.h>
-+#include <linux/timer.h>
-+#include <linux/slab.h>
-+#include <linux/pci_ids.h>
-+#include <linux/pci.h>
-+#include <linux/timer.h>
-+
-+#include "../w1.h"
-+#include "../w1_int.h"
-+#include "../w1_log.h"
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
-+MODULE_DESCRIPTION("Driver for transport(Dallas 1-wire prtocol) over VGA DDC(matrox gpio).");
-+
-+static struct pci_device_id matrox_w1_tbl[] = {
-+ { PCI_DEVICE(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G400) },
-+ { },
-+};
-+MODULE_DEVICE_TABLE(pci, matrox_w1_tbl);
-+
-+static int __devinit matrox_w1_probe(struct pci_dev *, const struct pci_device_id *);
-+static void __devexit matrox_w1_remove(struct pci_dev *);
-+
-+static struct pci_driver matrox_w1_pci_driver = {
-+ .name = "matrox_w1",
-+ .id_table = matrox_w1_tbl,
-+ .probe = matrox_w1_probe,
-+ .remove = __devexit_p(matrox_w1_remove),
-+};
-+
-+/*
-+ * Matrox G400 DDC registers.
-+ */
-+
-+#define MATROX_G400_DDC_CLK (1<<4)
-+#define MATROX_G400_DDC_DATA (1<<1)
-+
-+#define MATROX_BASE 0x3C00
-+#define MATROX_STATUS 0x1e14
-+
-+#define MATROX_PORT_INDEX_OFFSET 0x00
-+#define MATROX_PORT_DATA_OFFSET 0x0A
-+
-+#define MATROX_GET_CONTROL 0x2A
-+#define MATROX_GET_DATA 0x2B
-+#define MATROX_CURSOR_CTL 0x06
-+
-+struct matrox_device
-+{
-+ void __iomem *base_addr;
-+ void __iomem *port_index;
-+ void __iomem *port_data;
-+ u8 data_mask;
-+
-+ unsigned long phys_addr;
-+ void __iomem *virt_addr;
-+ unsigned long found;
-+
-+ struct w1_bus_master *bus_master;
-+};
-+
-+static u8 matrox_w1_read_ddc_bit(void *);
-+static void matrox_w1_write_ddc_bit(void *, u8);
-+
-+/*
-+ * These functions read and write DDC Data bit.
-+ *
-+ * Using tristate pins, since i can't find any open-drain pin in whole motherboard.
-+ * Unfortunately we can't connect to Intel's 82801xx IO controller
-+ * since we don't know motherboard schema, wich has pretty unused(may be not) GPIO.
-+ *
-+ * I've heard that PIIX also has open drain pin.
-+ *
-+ * Port mapping.
-+ */
-+static __inline__ u8 matrox_w1_read_reg(struct matrox_device *dev, u8 reg)
-+{
-+ u8 ret;
-+
-+ writeb(reg, dev->port_index);
-+ ret = readb(dev->port_data);
-+ barrier();
-+
-+ return ret;
-+}
-+
-+static __inline__ void matrox_w1_write_reg(struct matrox_device *dev, u8 reg, u8 val)
-+{
-+ writeb(reg, dev->port_index);
-+ writeb(val, dev->port_data);
-+ wmb();
-+}
-+
-+static void matrox_w1_write_ddc_bit(void *data, u8 bit)
-+{
-+ u8 ret;
-+ struct matrox_device *dev = data;
-+
-+ if (bit)
-+ bit = 0;
-+ else
-+ bit = dev->data_mask;
-+
-+ ret = matrox_w1_read_reg(dev, MATROX_GET_CONTROL);
-+ matrox_w1_write_reg(dev, MATROX_GET_CONTROL, ((ret & ~dev->data_mask) | bit));
-+ matrox_w1_write_reg(dev, MATROX_GET_DATA, 0x00);
-+}
-+
-+static u8 matrox_w1_read_ddc_bit(void *data)
-+{
-+ u8 ret;
-+ struct matrox_device *dev = data;
-+
-+ ret = matrox_w1_read_reg(dev, MATROX_GET_DATA);
-+
-+ return ret;
-+}
-+
-+static void matrox_w1_hw_init(struct matrox_device *dev)
-+{
-+ matrox_w1_write_reg(dev, MATROX_GET_DATA, 0xFF);
-+ matrox_w1_write_reg(dev, MATROX_GET_CONTROL, 0x00);
-+}
-+
-+static int __devinit matrox_w1_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
-+{
-+ struct matrox_device *dev;
-+ int err;
-+
-+ assert(pdev != NULL);
-+ assert(ent != NULL);
-+
-+ if (pdev->vendor != PCI_VENDOR_ID_MATROX || pdev->device != PCI_DEVICE_ID_MATROX_G400)
-+ return -ENODEV;
-+
-+ dev = kmalloc(sizeof(struct matrox_device) +
-+ sizeof(struct w1_bus_master), GFP_KERNEL);
-+ if (!dev) {
-+ dev_err(&pdev->dev,
-+ "%s: Failed to create new matrox_device object.\n",
-+ __func__);
-+ return -ENOMEM;
-+ }
-+
-+ memset(dev, 0, sizeof(struct matrox_device) + sizeof(struct w1_bus_master));
-+
-+ dev->bus_master = (struct w1_bus_master *)(dev + 1);
-+
-+ /*
-+ * True for G400, for some other we need resource 0, see drivers/video/matrox/matroxfb_base.c
-+ */
-+
-+ dev->phys_addr = pci_resource_start(pdev, 1);
-+
-+ dev->virt_addr = ioremap_nocache(dev->phys_addr, 16384);
-+ if (!dev->virt_addr) {
-+ dev_err(&pdev->dev, "%s: failed to ioremap(0x%lx, %d).\n",
-+ __func__, dev->phys_addr, 16384);
-+ err = -EIO;
-+ goto err_out_free_device;
-+ }
-+
-+ dev->base_addr = dev->virt_addr + MATROX_BASE;
-+ dev->port_index = dev->base_addr + MATROX_PORT_INDEX_OFFSET;
-+ dev->port_data = dev->base_addr + MATROX_PORT_DATA_OFFSET;
-+ dev->data_mask = (MATROX_G400_DDC_DATA);
-+
-+ matrox_w1_hw_init(dev);
-+
-+ dev->bus_master->data = dev;
-+ dev->bus_master->read_bit = &matrox_w1_read_ddc_bit;
-+ dev->bus_master->write_bit = &matrox_w1_write_ddc_bit;
-+
-+ err = w1_add_master_device(dev->bus_master);
-+ if (err)
-+ goto err_out_free_device;
-+
-+ pci_set_drvdata(pdev, dev);
-+
-+ dev->found = 1;
-+
-+ dev_info(&pdev->dev, "Matrox G400 GPIO transport layer for 1-wire.\n");
-+
-+ return 0;
-+
-+err_out_free_device:
-+ kfree(dev);
-+
-+ return err;
-+}
-+
-+static void __devexit matrox_w1_remove(struct pci_dev *pdev)
-+{
-+ struct matrox_device *dev = pci_get_drvdata(pdev);
-+
-+ assert(dev != NULL);
-+
-+ if (dev->found) {
-+ w1_remove_master_device(dev->bus_master);
-+ iounmap(dev->virt_addr);
-+ }
-+ kfree(dev);
-+}
-+
-+static int __init matrox_w1_init(void)
-+{
-+ return pci_register_driver(&matrox_w1_pci_driver);
-+}
-+
-+static void __exit matrox_w1_fini(void)
-+{
-+ pci_unregister_driver(&matrox_w1_pci_driver);
-+}
-+
-+module_init(matrox_w1_init);
-+module_exit(matrox_w1_fini);
---- gregkh-2.6.orig/drivers/w1/matrox_w1.c
-+++ /dev/null
-@@ -1,247 +0,0 @@
--/*
-- * matrox_w1.c
-- *
-- * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-- *
-- *
-- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--#include <asm/atomic.h>
--#include <asm/types.h>
--#include <asm/io.h>
--
--#include <linux/delay.h>
--#include <linux/kernel.h>
--#include <linux/module.h>
--#include <linux/list.h>
--#include <linux/interrupt.h>
--#include <linux/spinlock.h>
--#include <linux/timer.h>
--#include <linux/slab.h>
--#include <linux/pci_ids.h>
--#include <linux/pci.h>
--#include <linux/timer.h>
--
--#include "w1.h"
--#include "w1_int.h"
--#include "w1_log.h"
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
--MODULE_DESCRIPTION("Driver for transport(Dallas 1-wire prtocol) over VGA DDC(matrox gpio).");
--
--static struct pci_device_id matrox_w1_tbl[] = {
-- { PCI_DEVICE(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G400) },
-- { },
--};
--MODULE_DEVICE_TABLE(pci, matrox_w1_tbl);
--
--static int __devinit matrox_w1_probe(struct pci_dev *, const struct pci_device_id *);
--static void __devexit matrox_w1_remove(struct pci_dev *);
--
--static struct pci_driver matrox_w1_pci_driver = {
-- .name = "matrox_w1",
-- .id_table = matrox_w1_tbl,
-- .probe = matrox_w1_probe,
-- .remove = __devexit_p(matrox_w1_remove),
--};
--
--/*
-- * Matrox G400 DDC registers.
-- */
--
--#define MATROX_G400_DDC_CLK (1<<4)
--#define MATROX_G400_DDC_DATA (1<<1)
--
--#define MATROX_BASE 0x3C00
--#define MATROX_STATUS 0x1e14
--
--#define MATROX_PORT_INDEX_OFFSET 0x00
--#define MATROX_PORT_DATA_OFFSET 0x0A
--
--#define MATROX_GET_CONTROL 0x2A
--#define MATROX_GET_DATA 0x2B
--#define MATROX_CURSOR_CTL 0x06
--
--struct matrox_device
--{
-- void __iomem *base_addr;
-- void __iomem *port_index;
-- void __iomem *port_data;
-- u8 data_mask;
--
-- unsigned long phys_addr;
-- void __iomem *virt_addr;
-- unsigned long found;
--
-- struct w1_bus_master *bus_master;
--};
--
--static u8 matrox_w1_read_ddc_bit(void *);
--static void matrox_w1_write_ddc_bit(void *, u8);
--
--/*
-- * These functions read and write DDC Data bit.
-- *
-- * Using tristate pins, since i can't find any open-drain pin in whole motherboard.
-- * Unfortunately we can't connect to Intel's 82801xx IO controller
-- * since we don't know motherboard schema, wich has pretty unused(may be not) GPIO.
-- *
-- * I've heard that PIIX also has open drain pin.
-- *
-- * Port mapping.
-- */
--static __inline__ u8 matrox_w1_read_reg(struct matrox_device *dev, u8 reg)
--{
-- u8 ret;
--
-- writeb(reg, dev->port_index);
-- ret = readb(dev->port_data);
-- barrier();
--
-- return ret;
--}
--
--static __inline__ void matrox_w1_write_reg(struct matrox_device *dev, u8 reg, u8 val)
--{
-- writeb(reg, dev->port_index);
-- writeb(val, dev->port_data);
-- wmb();
--}
--
--static void matrox_w1_write_ddc_bit(void *data, u8 bit)
--{
-- u8 ret;
-- struct matrox_device *dev = data;
--
-- if (bit)
-- bit = 0;
-- else
-- bit = dev->data_mask;
--
-- ret = matrox_w1_read_reg(dev, MATROX_GET_CONTROL);
-- matrox_w1_write_reg(dev, MATROX_GET_CONTROL, ((ret & ~dev->data_mask) | bit));
-- matrox_w1_write_reg(dev, MATROX_GET_DATA, 0x00);
--}
--
--static u8 matrox_w1_read_ddc_bit(void *data)
--{
-- u8 ret;
-- struct matrox_device *dev = data;
--
-- ret = matrox_w1_read_reg(dev, MATROX_GET_DATA);
--
-- return ret;
--}
--
--static void matrox_w1_hw_init(struct matrox_device *dev)
--{
-- matrox_w1_write_reg(dev, MATROX_GET_DATA, 0xFF);
-- matrox_w1_write_reg(dev, MATROX_GET_CONTROL, 0x00);
--}
--
--static int __devinit matrox_w1_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
--{
-- struct matrox_device *dev;
-- int err;
--
-- assert(pdev != NULL);
-- assert(ent != NULL);
--
-- if (pdev->vendor != PCI_VENDOR_ID_MATROX || pdev->device != PCI_DEVICE_ID_MATROX_G400)
-- return -ENODEV;
--
-- dev = kmalloc(sizeof(struct matrox_device) +
-- sizeof(struct w1_bus_master), GFP_KERNEL);
-- if (!dev) {
-- dev_err(&pdev->dev,
-- "%s: Failed to create new matrox_device object.\n",
-- __func__);
-- return -ENOMEM;
-- }
--
-- memset(dev, 0, sizeof(struct matrox_device) + sizeof(struct w1_bus_master));
--
-- dev->bus_master = (struct w1_bus_master *)(dev + 1);
--
-- /*
-- * True for G400, for some other we need resource 0, see drivers/video/matrox/matroxfb_base.c
-- */
--
-- dev->phys_addr = pci_resource_start(pdev, 1);
--
-- dev->virt_addr = ioremap_nocache(dev->phys_addr, 16384);
-- if (!dev->virt_addr) {
-- dev_err(&pdev->dev, "%s: failed to ioremap(0x%lx, %d).\n",
-- __func__, dev->phys_addr, 16384);
-- err = -EIO;
-- goto err_out_free_device;
-- }
--
-- dev->base_addr = dev->virt_addr + MATROX_BASE;
-- dev->port_index = dev->base_addr + MATROX_PORT_INDEX_OFFSET;
-- dev->port_data = dev->base_addr + MATROX_PORT_DATA_OFFSET;
-- dev->data_mask = (MATROX_G400_DDC_DATA);
--
-- matrox_w1_hw_init(dev);
--
-- dev->bus_master->data = dev;
-- dev->bus_master->read_bit = &matrox_w1_read_ddc_bit;
-- dev->bus_master->write_bit = &matrox_w1_write_ddc_bit;
--
-- err = w1_add_master_device(dev->bus_master);
-- if (err)
-- goto err_out_free_device;
--
-- pci_set_drvdata(pdev, dev);
--
-- dev->found = 1;
--
-- dev_info(&pdev->dev, "Matrox G400 GPIO transport layer for 1-wire.\n");
--
-- return 0;
--
--err_out_free_device:
-- kfree(dev);
--
-- return err;
--}
--
--static void __devexit matrox_w1_remove(struct pci_dev *pdev)
--{
-- struct matrox_device *dev = pci_get_drvdata(pdev);
--
-- assert(dev != NULL);
--
-- if (dev->found) {
-- w1_remove_master_device(dev->bus_master);
-- iounmap(dev->virt_addr);
-- }
-- kfree(dev);
--}
--
--static int __init matrox_w1_init(void)
--{
-- return pci_register_driver(&matrox_w1_pci_driver);
--}
--
--static void __exit matrox_w1_fini(void)
--{
-- pci_unregister_driver(&matrox_w1_pci_driver);
--}
--
--module_init(matrox_w1_init);
--module_exit(matrox_w1_fini);
---- /dev/null
-+++ gregkh-2.6/drivers/w1/slaves/Kconfig
-@@ -0,0 +1,38 @@
-+#
-+# 1-wire slaves configuration
-+#
-+
-+menu "1-wire Slaves"
-+ depends on W1
-+
-+config W1_SLAVE_THERM
-+ tristate "Thermal family implementation"
-+ depends on W1
-+ help
-+ Say Y here if you want to connect 1-wire thermal sensors to you
-+ wire.
-+
-+config W1_SLAVE_SMEM
-+ tristate "Simple 64bit memory family implementation"
-+ depends on W1
-+ help
-+ Say Y here if you want to connect 1-wire
-+ simple 64bit memory rom(ds2401/ds2411/ds1990*) to you wire.
-+
-+config W1_SLAVE_DS2433
-+ tristate "4kb EEPROM family support (DS2433)"
-+ depends on W1
-+ help
-+ Say Y here if you want to use a 1-wire
-+ 4kb EEPROM family device (DS2433).
-+
-+config W1_SLAVE_DS2433_CRC
-+ bool "Protect DS2433 data with a CRC16"
-+ depends on W1_DS2433
-+ select CRC16
-+ help
-+ Say Y here to protect DS2433 data with a CRC16.
-+ Each block has 30 bytes of data and a two byte CRC16.
-+ Full block writes are only allowed if the CRC is valid.
-+
-+endmenu
---- /dev/null
-+++ gregkh-2.6/drivers/w1/slaves/Makefile
-@@ -0,0 +1,12 @@
-+#
-+# Makefile for the Dallas's 1-wire slaves.
-+#
-+
-+ifeq ($(CONFIG_W1_SLAVE_DS2433_CRC), y)
-+EXTRA_CFLAGS += -DCONFIG_W1_F23_CRC
-+endif
-+
-+obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o
-+obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o
-+obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o
-+
---- /dev/null
-+++ gregkh-2.6/drivers/w1/slaves/w1_ds2433.c
-@@ -0,0 +1,329 @@
-+/*
-+ * w1_ds2433.c - w1 family 23 (DS2433) driver
-+ *
-+ * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
-+ *
-+ * This source code is licensed under the GNU General Public License,
-+ * Version 2. See the file COPYING for more details.
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/device.h>
-+#include <linux/types.h>
-+#include <linux/delay.h>
-+#ifdef CONFIG_W1_F23_CRC
-+#include <linux/crc16.h>
-+
-+#define CRC16_INIT 0
-+#define CRC16_VALID 0xb001
-+
-+#endif
-+
-+#include "../w1.h"
-+#include "../w1_io.h"
-+#include "../w1_int.h"
-+#include "../w1_family.h"
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>");
-+MODULE_DESCRIPTION("w1 family 23 driver for DS2433, 4kb EEPROM");
-+
-+#define W1_EEPROM_SIZE 512
-+#define W1_PAGE_COUNT 16
-+#define W1_PAGE_SIZE 32
-+#define W1_PAGE_BITS 5
-+#define W1_PAGE_MASK 0x1F
-+
-+#define W1_F23_TIME 300
-+
-+#define W1_F23_READ_EEPROM 0xF0
-+#define W1_F23_WRITE_SCRATCH 0x0F
-+#define W1_F23_READ_SCRATCH 0xAA
-+#define W1_F23_COPY_SCRATCH 0x55
-+
-+struct w1_f23_data {
-+ u8 memory[W1_EEPROM_SIZE];
-+ u32 validcrc;
-+};
-+
-+/**
-+ * Check the file size bounds and adjusts count as needed.
-+ * This would not be needed if the file size didn't reset to 0 after a write.
-+ */
-+static inline size_t w1_f23_fix_count(loff_t off, size_t count, size_t size)
-+{
-+ if (off > size)
-+ return 0;
-+
-+ if ((off + count) > size)
-+ return (size - off);
-+
-+ return count;
-+}
-+
-+#ifdef CONFIG_W1_F23_CRC
-+static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data,
-+ int block)
-+{
-+ u8 wrbuf[3];
-+ int off = block * W1_PAGE_SIZE;
-+
-+ if (data->validcrc & (1 << block))
-+ return 0;
-+
-+ if (w1_reset_select_slave(sl)) {
-+ data->validcrc = 0;
-+ return -EIO;
-+ }
-+
-+ wrbuf[0] = W1_F23_READ_EEPROM;
-+ wrbuf[1] = off & 0xff;
-+ wrbuf[2] = off >> 8;
-+ w1_write_block(sl->master, wrbuf, 3);
-+ w1_read_block(sl->master, &data->memory[off], W1_PAGE_SIZE);
-+
-+ /* cache the block if the CRC is valid */
-+ if (crc16(CRC16_INIT, &data->memory[off], W1_PAGE_SIZE) == CRC16_VALID)
-+ data->validcrc |= (1 << block);
-+
-+ return 0;
-+}
-+#endif /* CONFIG_W1_F23_CRC */
-+
-+static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
-+ size_t count)
-+{
-+ struct w1_slave *sl = kobj_to_w1_slave(kobj);
-+#ifdef CONFIG_W1_F23_CRC
-+ struct w1_f23_data *data = sl->family_data;
-+ int i, min_page, max_page;
-+#else
-+ u8 wrbuf[3];
-+#endif
-+
-+ if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
-+ return 0;
-+
-+ atomic_inc(&sl->refcnt);
-+ if (down_interruptible(&sl->master->mutex)) {
-+ count = 0;
-+ goto out_dec;
-+ }
-+
-+#ifdef CONFIG_W1_F23_CRC
-+
-+ min_page = (off >> W1_PAGE_BITS);
-+ max_page = (off + count - 1) >> W1_PAGE_BITS;
-+ for (i = min_page; i <= max_page; i++) {
-+ if (w1_f23_refresh_block(sl, data, i)) {
-+ count = -EIO;
-+ goto out_up;
-+ }
-+ }
-+ memcpy(buf, &data->memory[off], count);
-+
-+#else /* CONFIG_W1_F23_CRC */
-+
-+ /* read directly from the EEPROM */
-+ if (w1_reset_select_slave(sl)) {
-+ count = -EIO;
-+ goto out_up;
-+ }
-+
-+ wrbuf[0] = W1_F23_READ_EEPROM;
-+ wrbuf[1] = off & 0xff;
-+ wrbuf[2] = off >> 8;
-+ w1_write_block(sl->master, wrbuf, 3);
-+ w1_read_block(sl->master, buf, count);
-+
-+#endif /* CONFIG_W1_F23_CRC */
-+
-+out_up:
-+ up(&sl->master->mutex);
-+out_dec:
-+ atomic_dec(&sl->refcnt);
-+
-+ return count;
-+}
-+
-+/**
-+ * Writes to the scratchpad and reads it back for verification.
-+ * Then copies the scratchpad to EEPROM.
-+ * The data must be on one page.
-+ * The master must be locked.
-+ *
-+ * @param sl The slave structure
-+ * @param addr Address for the write
-+ * @param len length must be <= (W1_PAGE_SIZE - (addr & W1_PAGE_MASK))
-+ * @param data The data to write
-+ * @return 0=Success -1=failure
-+ */
-+static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data)
-+{
-+ u8 wrbuf[4];
-+ u8 rdbuf[W1_PAGE_SIZE + 3];
-+ u8 es = (addr + len - 1) & 0x1f;
-+
-+ /* Write the data to the scratchpad */
-+ if (w1_reset_select_slave(sl))
-+ return -1;
-+
-+ wrbuf[0] = W1_F23_WRITE_SCRATCH;
-+ wrbuf[1] = addr & 0xff;
-+ wrbuf[2] = addr >> 8;
-+
-+ w1_write_block(sl->master, wrbuf, 3);
-+ w1_write_block(sl->master, data, len);
-+
-+ /* Read the scratchpad and verify */
-+ if (w1_reset_select_slave(sl))
-+ return -1;
-+
-+ w1_write_8(sl->master, W1_F23_READ_SCRATCH);
-+ w1_read_block(sl->master, rdbuf, len + 3);
-+
-+ /* Compare what was read against the data written */
-+ if ((rdbuf[0] != wrbuf[1]) || (rdbuf[1] != wrbuf[2]) ||
-+ (rdbuf[2] != es) || (memcmp(data, &rdbuf[3], len) != 0))
-+ return -1;
-+
-+ /* Copy the scratchpad to EEPROM */
-+ if (w1_reset_select_slave(sl))
-+ return -1;
-+
-+ wrbuf[0] = W1_F23_COPY_SCRATCH;
-+ wrbuf[3] = es;
-+ w1_write_block(sl->master, wrbuf, 4);
-+
-+ /* Sleep for 5 ms to wait for the write to complete */
-+ msleep(5);
-+
-+ /* Reset the bus to wake up the EEPROM (this may not be needed) */
-+ w1_reset_bus(sl->master);
-+
-+ return 0;
-+}
-+
-+static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off,
-+ size_t count)
-+{
-+ struct w1_slave *sl = kobj_to_w1_slave(kobj);
-+ int addr, len, idx;
-+
-+ if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
-+ return 0;
-+
-+#ifdef CONFIG_W1_F23_CRC
-+ /* can only write full blocks in cached mode */
-+ if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) {
-+ dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n",
-+ (int)off, count);
-+ return -EINVAL;
-+ }
-+
-+ /* make sure the block CRCs are valid */
-+ for (idx = 0; idx < count; idx += W1_PAGE_SIZE) {
-+ if (crc16(CRC16_INIT, &buf[idx], W1_PAGE_SIZE) != CRC16_VALID) {
-+ dev_err(&sl->dev, "bad CRC at offset %d\n", (int)off);
-+ return -EINVAL;
-+ }
-+ }
-+#endif /* CONFIG_W1_F23_CRC */
-+
-+ atomic_inc(&sl->refcnt);
-+ if (down_interruptible(&sl->master->mutex)) {
-+ count = 0;
-+ goto out_dec;
-+ }
-+
-+ /* Can only write data to one page at a time */
-+ idx = 0;
-+ while (idx < count) {
-+ addr = off + idx;
-+ len = W1_PAGE_SIZE - (addr & W1_PAGE_MASK);
-+ if (len > (count - idx))
-+ len = count - idx;
-+
-+ if (w1_f23_write(sl, addr, len, &buf[idx]) < 0) {
-+ count = -EIO;
-+ goto out_up;
-+ }
-+ idx += len;
-+ }
-+
-+out_up:
-+ up(&sl->master->mutex);
-+out_dec:
-+ atomic_dec(&sl->refcnt);
-+
-+ return count;
-+}
-+
-+static struct bin_attribute w1_f23_bin_attr = {
-+ .attr = {
-+ .name = "eeprom",
-+ .mode = S_IRUGO | S_IWUSR,
-+ .owner = THIS_MODULE,
-+ },
-+ .size = W1_EEPROM_SIZE,
-+ .read = w1_f23_read_bin,
-+ .write = w1_f23_write_bin,
-+};
-+
-+static int w1_f23_add_slave(struct w1_slave *sl)
-+{
-+ int err;
-+#ifdef CONFIG_W1_F23_CRC
-+ struct w1_f23_data *data;
-+
-+ data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL);
-+ if (!data)
-+ return -ENOMEM;
-+ memset(data, 0, sizeof(struct w1_f23_data));
-+ sl->family_data = data;
-+
-+#endif /* CONFIG_W1_F23_CRC */
-+
-+ err = sysfs_create_bin_file(&sl->dev.kobj, &w1_f23_bin_attr);
-+
-+#ifdef CONFIG_W1_F23_CRC
-+ if (err)
-+ kfree(data);
-+#endif /* CONFIG_W1_F23_CRC */
-+
-+ return err;
-+}
-+
-+static void w1_f23_remove_slave(struct w1_slave *sl)
-+{
-+#ifdef CONFIG_W1_F23_CRC
-+ kfree(sl->family_data);
-+ sl->family_data = NULL;
-+#endif /* CONFIG_W1_F23_CRC */
-+ sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr);
-+}
-+
-+static struct w1_family_ops w1_f23_fops = {
-+ .add_slave = w1_f23_add_slave,
-+ .remove_slave = w1_f23_remove_slave,
-+};
-+
-+static struct w1_family w1_family_23 = {
-+ .fid = W1_EEPROM_DS2433,
-+ .fops = &w1_f23_fops,
-+};
-+
-+static int __init w1_f23_init(void)
-+{
-+ return w1_register_family(&w1_family_23);
-+}
-+
-+static void __exit w1_f23_fini(void)
-+{
-+ w1_unregister_family(&w1_family_23);
-+}
-+
-+module_init(w1_f23_init);
-+module_exit(w1_f23_fini);
---- /dev/null
-+++ gregkh-2.6/drivers/w1/slaves/w1_smem.c
-@@ -0,0 +1,71 @@
-+/*
-+ * w1_smem.c
-+ *
-+ * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the smems 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <asm/types.h>
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/device.h>
-+#include <linux/types.h>
-+
-+#include "../w1.h"
-+#include "../w1_io.h"
-+#include "../w1_int.h"
-+#include "../w1_family.h"
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
-+MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family.");
-+
-+static struct w1_family w1_smem_family_01 = {
-+ .fid = W1_FAMILY_SMEM_01,
-+};
-+
-+static struct w1_family w1_smem_family_81 = {
-+ .fid = W1_FAMILY_SMEM_81,
-+};
-+
-+static int __init w1_smem_init(void)
-+{
-+ int err;
-+
-+ err = w1_register_family(&w1_smem_family_01);
-+ if (err)
-+ return err;
-+
-+ err = w1_register_family(&w1_smem_family_81);
-+ if (err) {
-+ w1_unregister_family(&w1_smem_family_01);
-+ return err;
-+ }
-+
-+ return 0;
-+}
-+
-+static void __exit w1_smem_fini(void)
-+{
-+ w1_unregister_family(&w1_smem_family_01);
-+ w1_unregister_family(&w1_smem_family_81);
-+}
-+
-+module_init(w1_smem_init);
-+module_exit(w1_smem_fini);
---- /dev/null
-+++ gregkh-2.6/drivers/w1/slaves/w1_therm.c
-@@ -0,0 +1,268 @@
-+/*
-+ * w1_therm.c
-+ *
-+ * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the therms 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <asm/types.h>
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/device.h>
-+#include <linux/types.h>
-+#include <linux/delay.h>
-+
-+#include "../w1.h"
-+#include "../w1_io.h"
-+#include "../w1_int.h"
-+#include "../w1_family.h"
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
-+MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, temperature family.");
-+
-+static u8 bad_roms[][9] = {
-+ {0xaa, 0x00, 0x4b, 0x46, 0xff, 0xff, 0x0c, 0x10, 0x87},
-+ {}
-+ };
-+
-+static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t);
-+
-+static struct bin_attribute w1_therm_bin_attr = {
-+ .attr = {
-+ .name = "w1_slave",
-+ .mode = S_IRUGO,
-+ .owner = THIS_MODULE,
-+ },
-+ .size = W1_SLAVE_DATA_SIZE,
-+ .read = w1_therm_read_bin,
-+};
-+
-+static int w1_therm_add_slave(struct w1_slave *sl)
-+{
-+ return sysfs_create_bin_file(&sl->dev.kobj, &w1_therm_bin_attr);
-+}
-+
-+static void w1_therm_remove_slave(struct w1_slave *sl)
-+{
-+ sysfs_remove_bin_file(&sl->dev.kobj, &w1_therm_bin_attr);
-+}
-+
-+static struct w1_family_ops w1_therm_fops = {
-+ .add_slave = w1_therm_add_slave,
-+ .remove_slave = w1_therm_remove_slave,
-+};
-+
-+static struct w1_family w1_therm_family_DS18S20 = {
-+ .fid = W1_THERM_DS18S20,
-+ .fops = &w1_therm_fops,
-+};
-+
-+static struct w1_family w1_therm_family_DS18B20 = {
-+ .fid = W1_THERM_DS18B20,
-+ .fops = &w1_therm_fops,
-+};
-+
-+static struct w1_family w1_therm_family_DS1822 = {
-+ .fid = W1_THERM_DS1822,
-+ .fops = &w1_therm_fops,
-+};
-+
-+struct w1_therm_family_converter
-+{
-+ u8 broken;
-+ u16 reserved;
-+ struct w1_family *f;
-+ int (*convert)(u8 rom[9]);
-+};
-+
-+static inline int w1_DS18B20_convert_temp(u8 rom[9]);
-+static inline int w1_DS18S20_convert_temp(u8 rom[9]);
-+
-+static struct w1_therm_family_converter w1_therm_families[] = {
-+ {
-+ .f = &w1_therm_family_DS18S20,
-+ .convert = w1_DS18S20_convert_temp
-+ },
-+ {
-+ .f = &w1_therm_family_DS1822,
-+ .convert = w1_DS18B20_convert_temp
-+ },
-+ {
-+ .f = &w1_therm_family_DS18B20,
-+ .convert = w1_DS18B20_convert_temp
-+ },
-+};
-+
-+static inline int w1_DS18B20_convert_temp(u8 rom[9])
-+{
-+ int t = (rom[1] << 8) | rom[0];
-+ t /= 16;
-+ return t;
-+}
-+
-+static inline int w1_DS18S20_convert_temp(u8 rom[9])
-+{
-+ int t, h;
-+
-+ if (!rom[7])
-+ return 0;
-+
-+ if (rom[1] == 0)
-+ t = ((s32)rom[0] >> 1)*1000;
-+ else
-+ t = 1000*(-1*(s32)(0x100-rom[0]) >> 1);
-+
-+ t -= 250;
-+ h = 1000*((s32)rom[7] - (s32)rom[6]);
-+ h /= (s32)rom[7];
-+ t += h;
-+
-+ return t;
-+}
-+
-+static inline int w1_convert_temp(u8 rom[9], u8 fid)
-+{
-+ int i;
-+
-+ for (i=0; i<sizeof(w1_therm_families)/sizeof(w1_therm_families[0]); ++i)
-+ if (w1_therm_families[i].f->fid == fid)
-+ return w1_therm_families[i].convert(rom);
-+
-+ return 0;
-+}
-+
-+static int w1_therm_check_rom(u8 rom[9])
-+{
-+ int i;
-+
-+ for (i=0; i<sizeof(bad_roms)/9; ++i)
-+ if (!memcmp(bad_roms[i], rom, 9))
-+ return 1;
-+
-+ return 0;
-+}
-+
-+static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count)
-+{
-+ struct w1_slave *sl = kobj_to_w1_slave(kobj);
-+ struct w1_master *dev = sl->master;
-+ u8 rom[9], crc, verdict;
-+ int i, max_trying = 10;
-+
-+ atomic_inc(&sl->refcnt);
-+ smp_mb__after_atomic_inc();
-+ if (down_interruptible(&sl->master->mutex)) {
-+ count = 0;
-+ goto out_dec;
-+ }
-+
-+ if (off > W1_SLAVE_DATA_SIZE) {
-+ count = 0;
-+ goto out;
-+ }
-+ if (off + count > W1_SLAVE_DATA_SIZE) {
-+ count = 0;
-+ goto out;
-+ }
-+
-+ memset(buf, 0, count);
-+ memset(rom, 0, sizeof(rom));
-+
-+ count = 0;
-+ verdict = 0;
-+ crc = 0;
-+
-+ while (max_trying--) {
-+ if (!w1_reset_select_slave(sl)) {
-+ int count = 0;
-+ unsigned int tm = 750;
-+
-+ w1_write_8(dev, W1_CONVERT_TEMP);
-+
-+ while (tm) {
-+ tm = msleep_interruptible(tm);
-+ if (signal_pending(current))
-+ flush_signals(current);
-+ }
-+
-+ if (!w1_reset_select_slave(sl)) {
-+
-+ w1_write_8(dev, W1_READ_SCRATCHPAD);
-+ if ((count = w1_read_block(dev, rom, 9)) != 9) {
-+ dev_warn(&dev->dev, "w1_read_block() returned %d instead of 9.\n", count);
-+ }
-+
-+ crc = w1_calc_crc8(rom, 8);
-+
-+ if (rom[8] == crc && rom[0])
-+ verdict = 1;
-+ }
-+ }
-+
-+ if (!w1_therm_check_rom(rom))
-+ break;
-+ }
-+
-+ for (i = 0; i < 9; ++i)
-+ count += sprintf(buf + count, "%02x ", rom[i]);
-+ count += sprintf(buf + count, ": crc=%02x %s\n",
-+ crc, (verdict) ? "YES" : "NO");
-+ if (verdict)
-+ memcpy(sl->rom, rom, sizeof(sl->rom));
-+ else
-+ dev_warn(&dev->dev, "18S20 doesn't respond to CONVERT_TEMP.\n");
-+
-+ for (i = 0; i < 9; ++i)
-+ count += sprintf(buf + count, "%02x ", sl->rom[i]);
-+
-+ count += sprintf(buf + count, "t=%d\n", w1_convert_temp(rom, sl->family->fid));
-+out:
-+ up(&dev->mutex);
-+out_dec:
-+ smp_mb__before_atomic_inc();
-+ atomic_dec(&sl->refcnt);
-+
-+ return count;
-+}
-+
-+static int __init w1_therm_init(void)
-+{
-+ int err, i;
-+
-+ for (i=0; i<sizeof(w1_therm_families)/sizeof(w1_therm_families[0]); ++i) {
-+ err = w1_register_family(w1_therm_families[i].f);
-+ if (err)
-+ w1_therm_families[i].broken = 1;
-+ }
-+
-+ return 0;
-+}
-+
-+static void __exit w1_therm_fini(void)
-+{
-+ int i;
-+
-+ for (i=0; i<sizeof(w1_therm_families)/sizeof(w1_therm_families[0]); ++i)
-+ if (!w1_therm_families[i].broken)
-+ w1_unregister_family(w1_therm_families[i].f);
-+}
-+
-+module_init(w1_therm_init);
-+module_exit(w1_therm_fini);
---- gregkh-2.6.orig/drivers/w1/w1_ds2433.c
-+++ /dev/null
-@@ -1,329 +0,0 @@
--/*
-- * w1_ds2433.c - w1 family 23 (DS2433) driver
-- *
-- * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
-- *
-- * This source code is licensed under the GNU General Public License,
-- * Version 2. See the file COPYING for more details.
-- */
--
--#include <linux/kernel.h>
--#include <linux/module.h>
--#include <linux/moduleparam.h>
--#include <linux/device.h>
--#include <linux/types.h>
--#include <linux/delay.h>
--#ifdef CONFIG_W1_F23_CRC
--#include <linux/crc16.h>
--
--#define CRC16_INIT 0
--#define CRC16_VALID 0xb001
--
--#endif
--
--#include "w1.h"
--#include "w1_io.h"
--#include "w1_int.h"
--#include "w1_family.h"
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>");
--MODULE_DESCRIPTION("w1 family 23 driver for DS2433, 4kb EEPROM");
--
--#define W1_EEPROM_SIZE 512
--#define W1_PAGE_COUNT 16
--#define W1_PAGE_SIZE 32
--#define W1_PAGE_BITS 5
--#define W1_PAGE_MASK 0x1F
--
--#define W1_F23_TIME 300
--
--#define W1_F23_READ_EEPROM 0xF0
--#define W1_F23_WRITE_SCRATCH 0x0F
--#define W1_F23_READ_SCRATCH 0xAA
--#define W1_F23_COPY_SCRATCH 0x55
--
--struct w1_f23_data {
-- u8 memory[W1_EEPROM_SIZE];
-- u32 validcrc;
--};
--
--/**
-- * Check the file size bounds and adjusts count as needed.
-- * This would not be needed if the file size didn't reset to 0 after a write.
-- */
--static inline size_t w1_f23_fix_count(loff_t off, size_t count, size_t size)
--{
-- if (off > size)
-- return 0;
--
-- if ((off + count) > size)
-- return (size - off);
--
-- return count;
--}
--
--#ifdef CONFIG_W1_F23_CRC
--static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data,
-- int block)
--{
-- u8 wrbuf[3];
-- int off = block * W1_PAGE_SIZE;
--
-- if (data->validcrc & (1 << block))
-- return 0;
--
-- if (w1_reset_select_slave(sl)) {
-- data->validcrc = 0;
-- return -EIO;
-- }
--
-- wrbuf[0] = W1_F23_READ_EEPROM;
-- wrbuf[1] = off & 0xff;
-- wrbuf[2] = off >> 8;
-- w1_write_block(sl->master, wrbuf, 3);
-- w1_read_block(sl->master, &data->memory[off], W1_PAGE_SIZE);
--
-- /* cache the block if the CRC is valid */
-- if (crc16(CRC16_INIT, &data->memory[off], W1_PAGE_SIZE) == CRC16_VALID)
-- data->validcrc |= (1 << block);
--
-- return 0;
--}
--#endif /* CONFIG_W1_F23_CRC */
--
--static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off,
-- size_t count)
--{
-- struct w1_slave *sl = kobj_to_w1_slave(kobj);
--#ifdef CONFIG_W1_F23_CRC
-- struct w1_f23_data *data = sl->family_data;
-- int i, min_page, max_page;
--#else
-- u8 wrbuf[3];
--#endif
--
-- if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
-- return 0;
--
-- atomic_inc(&sl->refcnt);
-- if (down_interruptible(&sl->master->mutex)) {
-- count = 0;
-- goto out_dec;
-- }
--
--#ifdef CONFIG_W1_F23_CRC
--
-- min_page = (off >> W1_PAGE_BITS);
-- max_page = (off + count - 1) >> W1_PAGE_BITS;
-- for (i = min_page; i <= max_page; i++) {
-- if (w1_f23_refresh_block(sl, data, i)) {
-- count = -EIO;
-- goto out_up;
-- }
-- }
-- memcpy(buf, &data->memory[off], count);
--
--#else /* CONFIG_W1_F23_CRC */
--
-- /* read directly from the EEPROM */
-- if (w1_reset_select_slave(sl)) {
-- count = -EIO;
-- goto out_up;
-- }
--
-- wrbuf[0] = W1_F23_READ_EEPROM;
-- wrbuf[1] = off & 0xff;
-- wrbuf[2] = off >> 8;
-- w1_write_block(sl->master, wrbuf, 3);
-- w1_read_block(sl->master, buf, count);
--
--#endif /* CONFIG_W1_F23_CRC */
--
--out_up:
-- up(&sl->master->mutex);
--out_dec:
-- atomic_dec(&sl->refcnt);
--
-- return count;
--}
--
--/**
-- * Writes to the scratchpad and reads it back for verification.
-- * Then copies the scratchpad to EEPROM.
-- * The data must be on one page.
-- * The master must be locked.
-- *
-- * @param sl The slave structure
-- * @param addr Address for the write
-- * @param len length must be <= (W1_PAGE_SIZE - (addr & W1_PAGE_MASK))
-- * @param data The data to write
-- * @return 0=Success -1=failure
-- */
--static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data)
--{
-- u8 wrbuf[4];
-- u8 rdbuf[W1_PAGE_SIZE + 3];
-- u8 es = (addr + len - 1) & 0x1f;
--
-- /* Write the data to the scratchpad */
-- if (w1_reset_select_slave(sl))
-- return -1;
--
-- wrbuf[0] = W1_F23_WRITE_SCRATCH;
-- wrbuf[1] = addr & 0xff;
-- wrbuf[2] = addr >> 8;
--
-- w1_write_block(sl->master, wrbuf, 3);
-- w1_write_block(sl->master, data, len);
--
-- /* Read the scratchpad and verify */
-- if (w1_reset_select_slave(sl))
-- return -1;
--
-- w1_write_8(sl->master, W1_F23_READ_SCRATCH);
-- w1_read_block(sl->master, rdbuf, len + 3);
--
-- /* Compare what was read against the data written */
-- if ((rdbuf[0] != wrbuf[1]) || (rdbuf[1] != wrbuf[2]) ||
-- (rdbuf[2] != es) || (memcmp(data, &rdbuf[3], len) != 0))
-- return -1;
--
-- /* Copy the scratchpad to EEPROM */
-- if (w1_reset_select_slave(sl))
-- return -1;
--
-- wrbuf[0] = W1_F23_COPY_SCRATCH;
-- wrbuf[3] = es;
-- w1_write_block(sl->master, wrbuf, 4);
--
-- /* Sleep for 5 ms to wait for the write to complete */
-- msleep(5);
--
-- /* Reset the bus to wake up the EEPROM (this may not be needed) */
-- w1_reset_bus(sl->master);
--
-- return 0;
--}
--
--static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off,
-- size_t count)
--{
-- struct w1_slave *sl = kobj_to_w1_slave(kobj);
-- int addr, len, idx;
--
-- if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
-- return 0;
--
--#ifdef CONFIG_W1_F23_CRC
-- /* can only write full blocks in cached mode */
-- if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) {
-- dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n",
-- (int)off, count);
-- return -EINVAL;
-- }
--
-- /* make sure the block CRCs are valid */
-- for (idx = 0; idx < count; idx += W1_PAGE_SIZE) {
-- if (crc16(CRC16_INIT, &buf[idx], W1_PAGE_SIZE) != CRC16_VALID) {
-- dev_err(&sl->dev, "bad CRC at offset %d\n", (int)off);
-- return -EINVAL;
-- }
-- }
--#endif /* CONFIG_W1_F23_CRC */
--
-- atomic_inc(&sl->refcnt);
-- if (down_interruptible(&sl->master->mutex)) {
-- count = 0;
-- goto out_dec;
-- }
--
-- /* Can only write data to one page at a time */
-- idx = 0;
-- while (idx < count) {
-- addr = off + idx;
-- len = W1_PAGE_SIZE - (addr & W1_PAGE_MASK);
-- if (len > (count - idx))
-- len = count - idx;
--
-- if (w1_f23_write(sl, addr, len, &buf[idx]) < 0) {
-- count = -EIO;
-- goto out_up;
-- }
-- idx += len;
-- }
--
--out_up:
-- up(&sl->master->mutex);
--out_dec:
-- atomic_dec(&sl->refcnt);
--
-- return count;
--}
--
--static struct bin_attribute w1_f23_bin_attr = {
-- .attr = {
-- .name = "eeprom",
-- .mode = S_IRUGO | S_IWUSR,
-- .owner = THIS_MODULE,
-- },
-- .size = W1_EEPROM_SIZE,
-- .read = w1_f23_read_bin,
-- .write = w1_f23_write_bin,
--};
--
--static int w1_f23_add_slave(struct w1_slave *sl)
--{
-- int err;
--#ifdef CONFIG_W1_F23_CRC
-- struct w1_f23_data *data;
--
-- data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL);
-- if (!data)
-- return -ENOMEM;
-- memset(data, 0, sizeof(struct w1_f23_data));
-- sl->family_data = data;
--
--#endif /* CONFIG_W1_F23_CRC */
--
-- err = sysfs_create_bin_file(&sl->dev.kobj, &w1_f23_bin_attr);
--
--#ifdef CONFIG_W1_F23_CRC
-- if (err)
-- kfree(data);
--#endif /* CONFIG_W1_F23_CRC */
--
-- return err;
--}
--
--static void w1_f23_remove_slave(struct w1_slave *sl)
--{
--#ifdef CONFIG_W1_F23_CRC
-- kfree(sl->family_data);
-- sl->family_data = NULL;
--#endif /* CONFIG_W1_F23_CRC */
-- sysfs_remove_bin_file(&sl->dev.kobj, &w1_f23_bin_attr);
--}
--
--static struct w1_family_ops w1_f23_fops = {
-- .add_slave = w1_f23_add_slave,
-- .remove_slave = w1_f23_remove_slave,
--};
--
--static struct w1_family w1_family_23 = {
-- .fid = W1_EEPROM_DS2433,
-- .fops = &w1_f23_fops,
--};
--
--static int __init w1_f23_init(void)
--{
-- return w1_register_family(&w1_family_23);
--}
--
--static void __exit w1_f23_fini(void)
--{
-- w1_unregister_family(&w1_family_23);
--}
--
--module_init(w1_f23_init);
--module_exit(w1_f23_fini);
---- gregkh-2.6.orig/drivers/w1/w1_smem.c
-+++ /dev/null
-@@ -1,71 +0,0 @@
--/*
-- * w1_smem.c
-- *
-- * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-- *
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the smems 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--#include <asm/types.h>
--
--#include <linux/kernel.h>
--#include <linux/module.h>
--#include <linux/moduleparam.h>
--#include <linux/device.h>
--#include <linux/types.h>
--
--#include "w1.h"
--#include "w1_io.h"
--#include "w1_int.h"
--#include "w1_family.h"
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
--MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family.");
--
--static struct w1_family w1_smem_family_01 = {
-- .fid = W1_FAMILY_SMEM_01,
--};
--
--static struct w1_family w1_smem_family_81 = {
-- .fid = W1_FAMILY_SMEM_81,
--};
--
--static int __init w1_smem_init(void)
--{
-- int err;
--
-- err = w1_register_family(&w1_smem_family_01);
-- if (err)
-- return err;
--
-- err = w1_register_family(&w1_smem_family_81);
-- if (err) {
-- w1_unregister_family(&w1_smem_family_01);
-- return err;
-- }
--
-- return 0;
--}
--
--static void __exit w1_smem_fini(void)
--{
-- w1_unregister_family(&w1_smem_family_01);
-- w1_unregister_family(&w1_smem_family_81);
--}
--
--module_init(w1_smem_init);
--module_exit(w1_smem_fini);
---- gregkh-2.6.orig/drivers/w1/w1_therm.c
-+++ /dev/null
-@@ -1,268 +0,0 @@
--/*
-- * w1_therm.c
-- *
-- * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-- *
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the therms 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--#include <asm/types.h>
--
--#include <linux/kernel.h>
--#include <linux/module.h>
--#include <linux/moduleparam.h>
--#include <linux/device.h>
--#include <linux/types.h>
--#include <linux/delay.h>
--
--#include "w1.h"
--#include "w1_io.h"
--#include "w1_int.h"
--#include "w1_family.h"
--
--MODULE_LICENSE("GPL");
--MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
--MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, temperature family.");
--
--static u8 bad_roms[][9] = {
-- {0xaa, 0x00, 0x4b, 0x46, 0xff, 0xff, 0x0c, 0x10, 0x87},
-- {}
-- };
--
--static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t);
--
--static struct bin_attribute w1_therm_bin_attr = {
-- .attr = {
-- .name = "w1_slave",
-- .mode = S_IRUGO,
-- .owner = THIS_MODULE,
-- },
-- .size = W1_SLAVE_DATA_SIZE,
-- .read = w1_therm_read_bin,
--};
--
--static int w1_therm_add_slave(struct w1_slave *sl)
--{
-- return sysfs_create_bin_file(&sl->dev.kobj, &w1_therm_bin_attr);
--}
--
--static void w1_therm_remove_slave(struct w1_slave *sl)
--{
-- sysfs_remove_bin_file(&sl->dev.kobj, &w1_therm_bin_attr);
--}
--
--static struct w1_family_ops w1_therm_fops = {
-- .add_slave = w1_therm_add_slave,
-- .remove_slave = w1_therm_remove_slave,
--};
--
--static struct w1_family w1_therm_family_DS18S20 = {
-- .fid = W1_THERM_DS18S20,
-- .fops = &w1_therm_fops,
--};
--
--static struct w1_family w1_therm_family_DS18B20 = {
-- .fid = W1_THERM_DS18B20,
-- .fops = &w1_therm_fops,
--};
--
--static struct w1_family w1_therm_family_DS1822 = {
-- .fid = W1_THERM_DS1822,
-- .fops = &w1_therm_fops,
--};
--
--struct w1_therm_family_converter
--{
-- u8 broken;
-- u16 reserved;
-- struct w1_family *f;
-- int (*convert)(u8 rom[9]);
--};
--
--static inline int w1_DS18B20_convert_temp(u8 rom[9]);
--static inline int w1_DS18S20_convert_temp(u8 rom[9]);
--
--static struct w1_therm_family_converter w1_therm_families[] = {
-- {
-- .f = &w1_therm_family_DS18S20,
-- .convert = w1_DS18S20_convert_temp
-- },
-- {
-- .f = &w1_therm_family_DS1822,
-- .convert = w1_DS18B20_convert_temp
-- },
-- {
-- .f = &w1_therm_family_DS18B20,
-- .convert = w1_DS18B20_convert_temp
-- },
--};
--
--static inline int w1_DS18B20_convert_temp(u8 rom[9])
--{
-- int t = (rom[1] << 8) | rom[0];
-- t /= 16;
-- return t;
--}
--
--static inline int w1_DS18S20_convert_temp(u8 rom[9])
--{
-- int t, h;
--
-- if (!rom[7])
-- return 0;
--
-- if (rom[1] == 0)
-- t = ((s32)rom[0] >> 1)*1000;
-- else
-- t = 1000*(-1*(s32)(0x100-rom[0]) >> 1);
--
-- t -= 250;
-- h = 1000*((s32)rom[7] - (s32)rom[6]);
-- h /= (s32)rom[7];
-- t += h;
--
-- return t;
--}
--
--static inline int w1_convert_temp(u8 rom[9], u8 fid)
--{
-- int i;
--
-- for (i=0; i<sizeof(w1_therm_families)/sizeof(w1_therm_families[0]); ++i)
-- if (w1_therm_families[i].f->fid == fid)
-- return w1_therm_families[i].convert(rom);
--
-- return 0;
--}
--
--static int w1_therm_check_rom(u8 rom[9])
--{
-- int i;
--
-- for (i=0; i<sizeof(bad_roms)/9; ++i)
-- if (!memcmp(bad_roms[i], rom, 9))
-- return 1;
--
-- return 0;
--}
--
--static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count)
--{
-- struct w1_slave *sl = kobj_to_w1_slave(kobj);
-- struct w1_master *dev = sl->master;
-- u8 rom[9], crc, verdict;
-- int i, max_trying = 10;
--
-- atomic_inc(&sl->refcnt);
-- smp_mb__after_atomic_inc();
-- if (down_interruptible(&sl->master->mutex)) {
-- count = 0;
-- goto out_dec;
-- }
--
-- if (off > W1_SLAVE_DATA_SIZE) {
-- count = 0;
-- goto out;
-- }
-- if (off + count > W1_SLAVE_DATA_SIZE) {
-- count = 0;
-- goto out;
-- }
--
-- memset(buf, 0, count);
-- memset(rom, 0, sizeof(rom));
--
-- count = 0;
-- verdict = 0;
-- crc = 0;
--
-- while (max_trying--) {
-- if (!w1_reset_select_slave(sl)) {
-- int count = 0;
-- unsigned int tm = 750;
--
-- w1_write_8(dev, W1_CONVERT_TEMP);
--
-- while (tm) {
-- tm = msleep_interruptible(tm);
-- if (signal_pending(current))
-- flush_signals(current);
-- }
--
-- if (!w1_reset_select_slave(sl)) {
--
-- w1_write_8(dev, W1_READ_SCRATCHPAD);
-- if ((count = w1_read_block(dev, rom, 9)) != 9) {
-- dev_warn(&dev->dev, "w1_read_block() returned %d instead of 9.\n", count);
-- }
--
-- crc = w1_calc_crc8(rom, 8);
--
-- if (rom[8] == crc && rom[0])
-- verdict = 1;
-- }
-- }
--
-- if (!w1_therm_check_rom(rom))
-- break;
-- }
--
-- for (i = 0; i < 9; ++i)
-- count += sprintf(buf + count, "%02x ", rom[i]);
-- count += sprintf(buf + count, ": crc=%02x %s\n",
-- crc, (verdict) ? "YES" : "NO");
-- if (verdict)
-- memcpy(sl->rom, rom, sizeof(sl->rom));
-- else
-- dev_warn(&dev->dev, "18S20 doesn't respond to CONVERT_TEMP.\n");
--
-- for (i = 0; i < 9; ++i)
-- count += sprintf(buf + count, "%02x ", sl->rom[i]);
--
-- count += sprintf(buf + count, "t=%d\n", w1_convert_temp(rom, sl->family->fid));
--out:
-- up(&dev->mutex);
--out_dec:
-- smp_mb__before_atomic_inc();
-- atomic_dec(&sl->refcnt);
--
-- return count;
--}
--
--static int __init w1_therm_init(void)
--{
-- int err, i;
--
-- for (i=0; i<sizeof(w1_therm_families)/sizeof(w1_therm_families[0]); ++i) {
-- err = w1_register_family(w1_therm_families[i].f);
-- if (err)
-- w1_therm_families[i].broken = 1;
-- }
--
-- return 0;
--}
--
--static void __exit w1_therm_fini(void)
--{
-- int i;
--
-- for (i=0; i<sizeof(w1_therm_families)/sizeof(w1_therm_families[0]); ++i)
-- if (!w1_therm_families[i].broken)
-- w1_unregister_family(w1_therm_families[i].f);
--}
--
--module_init(w1_therm_init);
--module_exit(w1_therm_fini);
diff --git a/i2c/w1-remove-incorrect-module_alias.patch b/i2c/w1-remove-incorrect-module_alias.patch
deleted file mode 100644
index dcc3863ce925a..0000000000000
--- a/i2c/w1-remove-incorrect-module_alias.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From linux-kernel-owner+greg=40kroah.com-S1161073AbWAGXo5@vger.kernel.org Sat Jan 7 15:48:06 2006
-Message-ID: <43C0524F.1030602@trash.net>
-Date: Sun, 08 Jan 2006 00:44:15 +0100
-From: Patrick McHardy <kaber@trash.net>
-To: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Subject: W1: Remove incorrect MODULE_ALIAS
-
-The w1 netlink socket is created by a hardware specific driver calling
-w1_add_master_device, so there is no point in including a module alias
-for netlink autoloading in the core.
-
-Signed-off-by: Patrick McHardy <kaber@trash.net>
-Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-
----
- drivers/w1/w1_int.c | 2 --
- 1 file changed, 2 deletions(-)
-
---- gregkh-2.6.orig/drivers/w1/w1_int.c
-+++ gregkh-2.6/drivers/w1/w1_int.c
-@@ -208,5 +208,3 @@ void w1_remove_master_device(struct w1_b
-
- EXPORT_SYMBOL(w1_add_master_device);
- EXPORT_SYMBOL(w1_remove_master_device);
--
--MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_W1);
diff --git a/i2c/w1-u64-is-not-long-long.patch b/i2c/w1-u64-is-not-long-long.patch
deleted file mode 100644
index dc8fc84f80285..0000000000000
--- a/i2c/w1-u64-is-not-long-long.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From akpm@osdl.org Sat Jan 14 00:06:36 2006
-Message-Id: <200601140806.k0E86FVg023998@shell0.pdx.osdl.net>
-From: Andrew Morton <akpm@osdl.org>
-Subject: W1: u64 is not long long
-To: akpm@osdl.org, greg@kroah.com, mm-commits@vger.kernel.org
-Date: Sat, 14 Jan 2006 00:05:59 -0800
-
-From: Andrew Morton <akpm@osdl.org>
-
-You don't know what type a u64 is, hence you cannot print it without a cast.
-
-Signed-off-by: Andrew Morton <akpm@osdl.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
----
- drivers/w1/w1.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
---- gregkh-2.6.orig/drivers/w1/w1.c
-+++ gregkh-2.6/drivers/w1/w1.c
-@@ -388,11 +388,14 @@ static int w1_uevent(struct device *dev,
- if (dev->driver != &w1_slave_driver || !sl)
- return 0;
-
-- err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family);
-+ err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size,
-+ &cur_len, "W1_FID=%02X", sl->reg_num.family);
- if (err)
- return err;
-
-- err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id);
-+ err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size,
-+ &cur_len, "W1_SLAVE_ID=%024LX",
-+ (unsigned long long)sl->reg_num.id);
- if (err)
- return err;
-
diff --git a/i2c/w1-use-kthread-api.patch b/i2c/w1-use-kthread-api.patch
deleted file mode 100644
index de380b9f80dae..0000000000000
--- a/i2c/w1-use-kthread-api.patch
+++ /dev/null
@@ -1,271 +0,0 @@
-From johnpol@2ka.mipt.ru Mon Feb 20 00:15:43 2006
-Date: Mon, 20 Feb 2006 11:15:37 +0300
-From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-To: GregKH <greg@kroah.com>
-Cc: Christoph Hellwig <hch@lst.de>
-Subject: w1: use kthread api.
-Message-ID: <20060220081537.GA17313@2ka.mipt.ru>
-Content-Disposition: inline
-
-This patch removes old-style kernel thread initialization
-and changes w1 to use kthread api.
-It is based on Christoph Hellwig <hch@lst.de> work.
-
-Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-
----
- drivers/w1/w1.c | 56 ++++++++++++++--------------------------------------
- drivers/w1/w1.h | 3 --
- drivers/w1/w1_int.c | 34 ++++++++++---------------------
- 3 files changed, 28 insertions(+), 65 deletions(-)
-
---- gregkh-2.6.orig/drivers/w1/w1.c
-+++ gregkh-2.6/drivers/w1/w1.c
-@@ -30,6 +30,7 @@
- #include <linux/device.h>
- #include <linux/slab.h>
- #include <linux/sched.h>
-+#include <linux/kthread.h>
-
- #include <asm/atomic.h>
-
-@@ -57,9 +58,7 @@ module_param_named(slave_ttl, w1_max_sla
- DEFINE_SPINLOCK(w1_mlock);
- LIST_HEAD(w1_masters);
-
--static pid_t control_thread;
--static int control_needs_exit;
--static DECLARE_COMPLETION(w1_control_complete);
-+static struct task_struct *w1_control_thread;
-
- static int w1_master_match(struct device *dev, struct device_driver *drv)
- {
-@@ -717,22 +716,16 @@ static int w1_control(void *data)
- {
- struct w1_slave *sl, *sln;
- struct w1_master *dev, *n;
-- int err, have_to_wait = 0;
-+ int have_to_wait = 0;
-
-- daemonize("w1_control");
-- allow_signal(SIGTERM);
--
-- while (!control_needs_exit || have_to_wait) {
-+ while (!kthread_should_stop() || have_to_wait) {
- have_to_wait = 0;
-
- try_to_freeze();
- msleep_interruptible(w1_control_timeout * 1000);
-
-- if (signal_pending(current))
-- flush_signals(current);
--
- list_for_each_entry_safe(dev, n, &w1_masters, w1_master_entry) {
-- if (!control_needs_exit && !dev->flags)
-+ if (!kthread_should_stop() && !dev->flags)
- continue;
- /*
- * Little race: we can create thread but not set the flag.
-@@ -743,21 +736,12 @@ static int w1_control(void *data)
- continue;
- }
-
-- if (control_needs_exit) {
-+ if (kthread_should_stop() || test_bit(W1_MASTER_NEED_EXIT, &dev->flags)) {
- set_bit(W1_MASTER_NEED_EXIT, &dev->flags);
-
-- err = kill_proc(dev->kpid, SIGTERM, 1);
-- if (err)
-- dev_err(&dev->dev,
-- "Failed to send signal to w1 kernel thread %d.\n",
-- dev->kpid);
-- }
--
-- if (test_bit(W1_MASTER_NEED_EXIT, &dev->flags)) {
-- wait_for_completion(&dev->dev_exited);
-- spin_lock_bh(&w1_mlock);
-+ spin_lock(&w1_mlock);
- list_del(&dev->w1_master_entry);
-- spin_unlock_bh(&w1_mlock);
-+ spin_unlock(&w1_mlock);
-
- down(&dev->mutex);
- list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
-@@ -789,7 +773,7 @@ static int w1_control(void *data)
- }
- }
-
-- complete_and_exit(&w1_control_complete, 0);
-+ return 0;
- }
-
- int w1_process(void *data)
-@@ -797,17 +781,11 @@ int w1_process(void *data)
- struct w1_master *dev = (struct w1_master *) data;
- struct w1_slave *sl, *sln;
-
-- daemonize("%s", dev->name);
-- allow_signal(SIGTERM);
--
-- while (!test_bit(W1_MASTER_NEED_EXIT, &dev->flags)) {
-+ while (!kthread_should_stop() && !test_bit(W1_MASTER_NEED_EXIT, &dev->flags)) {
- try_to_freeze();
- msleep_interruptible(w1_timeout * 1000);
-
-- if (signal_pending(current))
-- flush_signals(current);
--
-- if (test_bit(W1_MASTER_NEED_EXIT, &dev->flags))
-+ if (kthread_should_stop() || test_bit(W1_MASTER_NEED_EXIT, &dev->flags))
- break;
-
- if (!dev->initialized)
-@@ -840,7 +818,6 @@ int w1_process(void *data)
- }
-
- atomic_dec(&dev->refcnt);
-- complete_and_exit(&dev->dev_exited, 0);
-
- return 0;
- }
-@@ -873,11 +850,11 @@ static int w1_init(void)
- goto err_out_master_unregister;
- }
-
-- control_thread = kernel_thread(&w1_control, NULL, 0);
-- if (control_thread < 0) {
-+ w1_control_thread = kthread_run(w1_control, NULL, "w1_control");
-+ if (IS_ERR(w1_control_thread)) {
-+ retval = PTR_ERR(w1_control_thread);
- printk(KERN_ERR "Failed to create control thread. err=%d\n",
-- control_thread);
-- retval = control_thread;
-+ retval);
- goto err_out_slave_unregister;
- }
-
-@@ -903,8 +880,7 @@ static void w1_fini(void)
- list_for_each_entry(dev, &w1_masters, w1_master_entry)
- __w1_remove_master_device(dev);
-
-- control_needs_exit = 1;
-- wait_for_completion(&w1_control_complete);
-+ kthread_stop(w1_control_thread);
-
- driver_unregister(&w1_slave_driver);
- driver_unregister(&w1_master_driver);
---- gregkh-2.6.orig/drivers/w1/w1.h
-+++ gregkh-2.6/drivers/w1/w1.h
-@@ -172,12 +172,11 @@ struct w1_master
-
- long flags;
-
-- pid_t kpid;
-+ struct task_struct *thread;
- struct semaphore mutex;
-
- struct device_driver *driver;
- struct device dev;
-- struct completion dev_exited;
-
- struct w1_bus_master *bus_master;
-
---- gregkh-2.6.orig/drivers/w1/w1_int.c
-+++ gregkh-2.6/drivers/w1/w1_int.c
-@@ -22,6 +22,7 @@
- #include <linux/kernel.h>
- #include <linux/list.h>
- #include <linux/delay.h>
-+#include <linux/kthread.h>
-
- #include "w1.h"
- #include "w1_log.h"
-@@ -56,7 +57,6 @@ static struct w1_master * w1_alloc_dev(u
- dev->max_slave_count = slave_count;
- dev->slave_count = 0;
- dev->attempts = 0;
-- dev->kpid = -1;
- dev->initialized = 0;
- dev->id = id;
- dev->slave_ttl = slave_ttl;
-@@ -67,8 +67,6 @@ static struct w1_master * w1_alloc_dev(u
- INIT_LIST_HEAD(&dev->slist);
- init_MUTEX(&dev->mutex);
-
-- init_completion(&dev->dev_exited);
--
- memcpy(&dev->dev, device, sizeof(struct device));
- snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id),
- "w1_bus_master%u", dev->id);
-@@ -116,12 +114,12 @@ int w1_add_master_device(struct w1_bus_m
- if (!dev)
- return -ENOMEM;
-
-- dev->kpid = kernel_thread(&w1_process, dev, 0);
-- if (dev->kpid < 0) {
-+ dev->thread = kthread_run(&w1_process, dev, "%s", dev->name);
-+ if (IS_ERR(dev->thread)) {
-+ retval = PTR_ERR(dev->thread);
- dev_err(&dev->dev,
- "Failed to create new kernel thread. err=%d\n",
-- dev->kpid);
-- retval = dev->kpid;
-+ retval);
- goto err_out_free_dev;
- }
-
-@@ -138,20 +136,14 @@ int w1_add_master_device(struct w1_bus_m
- spin_unlock(&w1_mlock);
-
- msg.id.mst.id = dev->id;
-- msg.id.mst.pid = dev->kpid;
-+ msg.id.mst.pid = dev->thread->pid;
- msg.type = W1_MASTER_ADD;
- w1_netlink_send(dev, &msg);
-
- return 0;
-
- err_out_kill_thread:
-- set_bit(W1_MASTER_NEED_EXIT, &dev->flags);
-- if (kill_proc(dev->kpid, SIGTERM, 1))
-- dev_err(&dev->dev,
-- "Failed to send signal to w1 kernel thread %d.\n",
-- dev->kpid);
-- wait_for_completion(&dev->dev_exited);
--
-+ kthread_stop(dev->thread);
- err_out_free_dev:
- w1_free_dev(dev);
-
-@@ -160,18 +152,14 @@ err_out_free_dev:
-
- void __w1_remove_master_device(struct w1_master *dev)
- {
-- int err;
- struct w1_netlink_msg msg;
-+ pid_t pid = dev->thread->pid;
-
- set_bit(W1_MASTER_NEED_EXIT, &dev->flags);
-- err = kill_proc(dev->kpid, SIGTERM, 1);
-- if (err)
-- dev_err(&dev->dev,
-- "%s: Failed to send signal to w1 kernel thread %d.\n",
-- __func__, dev->kpid);
-+ kthread_stop(dev->thread);
-
- while (atomic_read(&dev->refcnt)) {
-- dev_dbg(&dev->dev, "Waiting for %s to become free: refcnt=%d.\n",
-+ dev_info(&dev->dev, "Waiting for %s to become free: refcnt=%d.\n",
- dev->name, atomic_read(&dev->refcnt));
-
- if (msleep_interruptible(1000))
-@@ -179,7 +167,7 @@ void __w1_remove_master_device(struct w1
- }
-
- msg.id.mst.id = dev->id;
-- msg.id.mst.pid = dev->kpid;
-+ msg.id.mst.pid = pid;
- msg.type = W1_MASTER_REMOVE;
- w1_netlink_send(dev, &msg);
-