aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/smsc47b397.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-18 17:19:26 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:21:52 -0500
commit9a61bf6300533d3b64d7ff29adfec00e596de67d (patch)
treecadce1ae78b51a1dc4c4414699cb590e8c8625e1 /drivers/hwmon/smsc47b397.c
parent3fb9a65529615944138d527b70174840c95c637a (diff)
[PATCH] hwmon: Semaphore to mutex conversions
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>
Diffstat (limited to 'drivers/hwmon/smsc47b397.c')
-rw-r--r--drivers/hwmon/smsc47b397.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c
index 8663bbbe97f5..b6086186d225 100644
--- a/drivers/hwmon/smsc47b397.c
+++ b/drivers/hwmon/smsc47b397.c
@@ -35,6 +35,7 @@
35#include <linux/hwmon.h> 35#include <linux/hwmon.h>
36#include <linux/err.h> 36#include <linux/err.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/mutex.h>
38#include <asm/io.h> 39#include <asm/io.h>
39 40
40/* Address is autodetected, there is no default value */ 41/* Address is autodetected, there is no default value */
@@ -92,9 +93,9 @@ static u8 smsc47b397_reg_temp[] = {0x25, 0x26, 0x27, 0x80};
92struct smsc47b397_data { 93struct smsc47b397_data {
93 struct i2c_client client; 94 struct i2c_client client;
94 struct class_device *class_dev; 95 struct class_device *class_dev;
95 struct semaphore lock; 96 struct mutex lock;
96 97
97 struct semaphore update_lock; 98 struct mutex update_lock;
98 unsigned long last_updated; /* in jiffies */ 99 unsigned long last_updated; /* in jiffies */
99 int valid; 100 int valid;
100 101
@@ -108,10 +109,10 @@ static int smsc47b397_read_value(struct i2c_client *client, u8 reg)
108 struct smsc47b397_data *data = i2c_get_clientdata(client); 109 struct smsc47b397_data *data = i2c_get_clientdata(client);
109 int res; 110 int res;
110 111
111 down(&data->lock); 112 mutex_lock(&data->lock);
112 outb(reg, client->addr); 113 outb(reg, client->addr);
113 res = inb_p(client->addr + 1); 114 res = inb_p(client->addr + 1);
114 up(&data->lock); 115 mutex_unlock(&data->lock);
115 return res; 116 return res;
116} 117}
117 118
@@ -121,7 +122,7 @@ static struct smsc47b397_data *smsc47b397_update_device(struct device *dev)
121 struct smsc47b397_data *data = i2c_get_clientdata(client); 122 struct smsc47b397_data *data = i2c_get_clientdata(client);
122 int i; 123 int i;
123 124
124 down(&data->update_lock); 125 mutex_lock(&data->update_lock);
125 126
126 if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { 127 if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
127 dev_dbg(&client->dev, "starting device update...\n"); 128 dev_dbg(&client->dev, "starting device update...\n");
@@ -144,7 +145,7 @@ static struct smsc47b397_data *smsc47b397_update_device(struct device *dev)
144 dev_dbg(&client->dev, "... device update complete\n"); 145 dev_dbg(&client->dev, "... device update complete\n");
145 } 146 }
146 147
147 up(&data->update_lock); 148 mutex_unlock(&data->update_lock);
148 149
149 return data; 150 return data;
150} 151}
@@ -254,14 +255,14 @@ static int smsc47b397_detect(struct i2c_adapter *adapter)
254 new_client = &data->client; 255 new_client = &data->client;
255 i2c_set_clientdata(new_client, data); 256 i2c_set_clientdata(new_client, data);
256 new_client->addr = address; 257 new_client->addr = address;
257 init_MUTEX(&data->lock); 258 mutex_init(&data->lock);
258 new_client->adapter = adapter; 259 new_client->adapter = adapter;
259 new_client->driver = &smsc47b397_driver; 260 new_client->driver = &smsc47b397_driver;
260 new_client->flags = 0; 261 new_client->flags = 0;
261 262
262 strlcpy(new_client->name, "smsc47b397", I2C_NAME_SIZE); 263 strlcpy(new_client->name, "smsc47b397", I2C_NAME_SIZE);
263 264
264 init_MUTEX(&data->update_lock); 265 mutex_init(&data->update_lock);
265 266
266 if ((err = i2c_attach_client(new_client))) 267 if ((err = i2c_attach_client(new_client)))
267 goto error_free; 268 goto error_free;