summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/m41t00.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-01-11 10:50:26 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 14:21:49 -0800
commitb3585e4f5b3e4ddb4d82ae50d0b844f619c6d821 (patch)
tree5375363cc6087d74196efc0ded6dae9a8a4c2ad5 /drivers/i2c/chips/m41t00.c
parent2488a39d233a758d41ab7de70a220bc956f3c96c (diff)
downloadop-kernel-dev-b3585e4f5b3e4ddb4d82ae50d0b844f619c6d821.zip
op-kernel-dev-b3585e4f5b3e4ddb4d82ae50d0b844f619c6d821.tar.gz
[PATCH] I2C: Convert i2c to mutexes
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>
Diffstat (limited to 'drivers/i2c/chips/m41t00.c')
-rw-r--r--drivers/i2c/chips/m41t00.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c
index 2dc3d48..b5aabe7 100644
--- a/drivers/i2c/chips/m41t00.c
+++ b/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;
}
OpenPOWER on IntegriCloud