diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-05-08 11:21:59 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-05-08 11:21:59 -0400 |
commit | 94e183fd0425a917d9c1453041ef88f3610c0f01 (patch) | |
tree | bbf098e0b4244fcca76a2f99373888804a3e018f /drivers/hwmon | |
parent | 8eccbb6fb97a5b54a9db166399f0d24f33114522 (diff) |
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: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 16762cca87e5..f219d7c6a982 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -116,7 +116,6 @@ struct smsc47m1_data { | |||
116 | struct i2c_client client; | 116 | struct i2c_client client; |
117 | enum chips type; | 117 | enum chips type; |
118 | struct class_device *class_dev; | 118 | struct class_device *class_dev; |
119 | struct mutex lock; | ||
120 | 119 | ||
121 | struct mutex update_lock; | 120 | struct mutex update_lock; |
122 | unsigned long last_updated; /* In jiffies */ | 121 | unsigned long last_updated; /* In jiffies */ |
@@ -131,13 +130,19 @@ struct smsc47m1_data { | |||
131 | 130 | ||
132 | static int smsc47m1_detect(struct i2c_adapter *adapter); | 131 | static int smsc47m1_detect(struct i2c_adapter *adapter); |
133 | static int smsc47m1_detach_client(struct i2c_client *client); | 132 | static int smsc47m1_detach_client(struct i2c_client *client); |
134 | |||
135 | static int smsc47m1_read_value(struct i2c_client *client, u8 reg); | ||
136 | static void smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value); | ||
137 | |||
138 | static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, | 133 | static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, |
139 | int init); | 134 | int init); |
140 | 135 | ||
136 | static inline int smsc47m1_read_value(struct i2c_client *client, u8 reg) | ||
137 | { | ||
138 | return inb_p(client->addr + reg); | ||
139 | } | ||
140 | |||
141 | static inline void smsc47m1_write_value(struct i2c_client *client, u8 reg, | ||
142 | u8 value) | ||
143 | { | ||
144 | outb_p(value, client->addr + reg); | ||
145 | } | ||
141 | 146 | ||
142 | static struct i2c_driver smsc47m1_driver = { | 147 | static struct i2c_driver smsc47m1_driver = { |
143 | .driver = { | 148 | .driver = { |
@@ -477,7 +482,6 @@ static int smsc47m1_detect(struct i2c_adapter *adapter) | |||
477 | new_client = &data->client; | 482 | new_client = &data->client; |
478 | i2c_set_clientdata(new_client, data); | 483 | i2c_set_clientdata(new_client, data); |
479 | new_client->addr = address; | 484 | new_client->addr = address; |
480 | mutex_init(&data->lock); | ||
481 | new_client->adapter = adapter; | 485 | new_client->adapter = adapter; |
482 | new_client->driver = &smsc47m1_driver; | 486 | new_client->driver = &smsc47m1_driver; |
483 | new_client->flags = 0; | 487 | new_client->flags = 0; |
@@ -633,23 +637,6 @@ static int smsc47m1_detach_client(struct i2c_client *client) | |||
633 | return 0; | 637 | return 0; |
634 | } | 638 | } |
635 | 639 | ||
636 | static int smsc47m1_read_value(struct i2c_client *client, u8 reg) | ||
637 | { | ||
638 | int res; | ||
639 | |||
640 | mutex_lock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock); | ||
641 | res = inb_p(client->addr + reg); | ||
642 | mutex_unlock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock); | ||
643 | return res; | ||
644 | } | ||
645 | |||
646 | static void smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value) | ||
647 | { | ||
648 | mutex_lock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock); | ||
649 | outb_p(value, client->addr + reg); | ||
650 | mutex_unlock(&((struct smsc47m1_data *) i2c_get_clientdata(client))->lock); | ||
651 | } | ||
652 | |||
653 | static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, | 640 | static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, |
654 | int init) | 641 | int init) |
655 | { | 642 | { |