Commit 94e183fd authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

hwmon/smsc47m1: Get rid of a useless mutex

The smsc47m1 driver uses a mutex to protect the accesses to the
hardware registers. It really doesn't need any protection, as the
register space is flat. Get rid of that mutex for a smaller and
faster driver.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 8eccbb6f
...@@ -116,7 +116,6 @@ struct smsc47m1_data { ...@@ -116,7 +116,6 @@ struct smsc47m1_data {
struct i2c_client client; struct i2c_client client;
enum chips type; enum chips type;
struct class_device *class_dev; struct class_device *class_dev;
struct mutex lock;
struct mutex update_lock; struct mutex update_lock;
unsigned long last_updated; /* In jiffies */ unsigned long last_updated; /* In jiffies */
...@@ -131,13 +130,19 @@ struct smsc47m1_data { ...@@ -131,13 +130,19 @@ struct smsc47m1_data {
static int smsc47m1_detect(struct i2c_adapter *adapter); static int smsc47m1_detect(struct i2c_adapter *adapter);
static int smsc47m1_detach_client(struct i2c_client *client); static int smsc47m1_detach_client(struct i2c_client *client);
static int smsc47m1_read_value(struct i2c_client *client, u8 reg);
static void smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value);
static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
int init); int init);
static inline int smsc47m1_read_value(struct i2c_client *client, u8 reg)
{
return inb_p(client->addr + reg);
}
static inline void smsc47m1_write_value(struct i2c_client *client, u8 reg,
u8 value)
{
outb_p(value, client->addr + reg);
}
static struct i2c_driver smsc47m1_driver = { static struct i2c_driver smsc47m1_driver = {
.driver = { .driver = {
...@@ -477,7 +482,6 @@ static int smsc47m1_detect(struct i2c_adapter *adapter) ...@@ -477,7 +482,6 @@ static int smsc47m1_detect(struct i2c_adapter *adapter)
new_client = &data->client; new_client = &data->client;
i2c_set_clientdata(new_client, data); i2c_set_clientdata(new_client, data);
new_client->addr = address; new_client->addr = address;
mutex_init(&data->lock);
new_client->adapter = adapter; new_client->adapter = adapter;
new_client->driver = &smsc47m1_driver; new_client->driver = &smsc47m1_driver;
new_client->flags = 0; new_client->flags = 0;
...@@ -633,23 +637,6 @@ static int smsc47m1_detach_client(struct i2c_client *client) ...@@ -633,23 +637,6 @@ static int smsc47m1_detach_client(struct i2c_client *client)
return 0; return 0;
} }
static int smsc47m1_read_value(struct i2c_client *client, u8 reg)
{
int res;
mutex_lock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
res = inb_p(client->addr + reg);
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)
{
mutex_lock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
outb_p(value, client->addr + reg);
mutex_unlock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock);
}
static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
int init) int init)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment