aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/smsc47m1.c33
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
132static int smsc47m1_detect(struct i2c_adapter *adapter); 131static int smsc47m1_detect(struct i2c_adapter *adapter);
133static int smsc47m1_detach_client(struct i2c_client *client); 132static int smsc47m1_detach_client(struct i2c_client *client);
134
135static int smsc47m1_read_value(struct i2c_client *client, u8 reg);
136static void smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value);
137
138static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, 133static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
139 int init); 134 int init);
140 135
136static inline int smsc47m1_read_value(struct i2c_client *client, u8 reg)
137{
138 return inb_p(client->addr + reg);
139}
140
141static 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
142static struct i2c_driver smsc47m1_driver = { 147static 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
636static 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
646static 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
653static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, 640static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
654 int init) 641 int init)
655{ 642{