aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/ds1374.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips/ds1374.c')
-rw-r--r--drivers/i2c/chips/ds1374.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c
index 0710b9da9d54..03d09ed5ec2c 100644
--- a/drivers/i2c/chips/ds1374.c
+++ b/drivers/i2c/chips/ds1374.c
@@ -26,6 +26,7 @@
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/rtc.h> 27#include <linux/rtc.h>
28#include <linux/bcd.h> 28#include <linux/bcd.h>
29#include <linux/mutex.h>
29 30
30#define DS1374_REG_TOD0 0x00 31#define DS1374_REG_TOD0 0x00
31#define DS1374_REG_TOD1 0x01 32#define DS1374_REG_TOD1 0x01
@@ -41,7 +42,7 @@
41 42
42#define DS1374_DRV_NAME "ds1374" 43#define DS1374_DRV_NAME "ds1374"
43 44
44static DECLARE_MUTEX(ds1374_mutex); 45static DEFINE_MUTEX(ds1374_mutex);
45 46
46static struct i2c_driver ds1374_driver; 47static struct i2c_driver ds1374_driver;
47static struct i2c_client *save_client; 48static struct i2c_client *save_client;
@@ -114,7 +115,7 @@ ulong ds1374_get_rtc_time(void)
114 ulong t1, t2; 115 ulong t1, t2;
115 int limit = 10; /* arbitrary retry limit */ 116 int limit = 10; /* arbitrary retry limit */
116 117
117 down(&ds1374_mutex); 118 mutex_lock(&ds1374_mutex);
118 119
119 /* 120 /*
120 * Since the reads are being performed one byte at a time using 121 * Since the reads are being performed one byte at a time using
@@ -127,7 +128,7 @@ ulong ds1374_get_rtc_time(void)
127 t2 = ds1374_read_rtc(); 128 t2 = ds1374_read_rtc();
128 } while (t1 != t2 && limit--); 129 } while (t1 != t2 && limit--);
129 130
130 up(&ds1374_mutex); 131 mutex_unlock(&ds1374_mutex);
131 132
132 if (t1 != t2) { 133 if (t1 != t2) {
133 dev_warn(&save_client->dev, 134 dev_warn(&save_client->dev,
@@ -145,7 +146,7 @@ static void ds1374_set_tlet(ulong arg)
145 146
146 t1 = *(ulong *) arg; 147 t1 = *(ulong *) arg;
147 148
148 down(&ds1374_mutex); 149 mutex_lock(&ds1374_mutex);
149 150
150 /* 151 /*
151 * Since the writes are being performed one byte at a time using 152 * Since the writes are being performed one byte at a time using
@@ -158,7 +159,7 @@ static void ds1374_set_tlet(ulong arg)
158 t2 = ds1374_read_rtc(); 159 t2 = ds1374_read_rtc();
159 } while (t1 != t2 && limit--); 160 } while (t1 != t2 && limit--);
160 161
161 up(&ds1374_mutex); 162 mutex_unlock(&ds1374_mutex);
162 163
163 if (t1 != t2) 164 if (t1 != t2)
164 dev_warn(&save_client->dev, 165 dev_warn(&save_client->dev,