diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-11 13:32:52 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-11 13:32:52 -0800 |
commit | 4677f245b5fbfd83b8a025f0d8f4558b4c83ab91 (patch) | |
tree | e8a20161296d5ddac4881fe13b5b9d0aaeacbc06 /i2c | |
parent | c4a28a4f7fe1269989bb7e46f14231ef67316bb3 (diff) | |
download | patches-4677f245b5fbfd83b8a025f0d8f4558b4c83ab91.tar.gz |
new patches
Diffstat (limited to 'i2c')
-rw-r--r-- | i2c/i2c-convert-i2c-to-mutexes.patch | 270 |
1 files changed, 270 insertions, 0 deletions
diff --git a/i2c/i2c-convert-i2c-to-mutexes.patch b/i2c/i2c-convert-i2c-to-mutexes.patch new file mode 100644 index 0000000000000..c0dd72a46f376 --- /dev/null +++ b/i2c/i2c-convert-i2c-to-mutexes.patch @@ -0,0 +1,270 @@ +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; + } + |