aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-12-18 10:29:40 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-06 01:16:25 -0500
commitc9152deaa635cab09cb43c17cf80130b9e6ee29d (patch)
treef05e5e846b0c042d0f7421bf33c68337aaca20ed /drivers/hwmon
parent79472132f555ae1e912699e116e5c82f338872f6 (diff)
[PATCH] hwmon: w83792d misc cleanups
Cleanup the w83792d driver a bit: * Discard unused lock and irrelevant comments inherited from the w83781d driver. * Simplify w83792d_{read,write}_value functions. * Drop useless address test during detection. * Drop useless bitmasking. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Yuan Mu <Ymu@winbond.com.tw> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/w83792d.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index ff1c9f0abf93..0ad1ae569531 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -269,7 +269,6 @@ DIV_TO_REG(long val)
269struct w83792d_data { 269struct w83792d_data {
270 struct i2c_client client; 270 struct i2c_client client;
271 struct class_device *class_dev; 271 struct class_device *class_dev;
272 struct semaphore lock;
273 enum chips type; 272 enum chips type;
274 273
275 struct semaphore update_lock; 274 struct semaphore update_lock;
@@ -1192,7 +1191,6 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1192 new_client = &data->client; 1191 new_client = &data->client;
1193 i2c_set_clientdata(new_client, data); 1192 i2c_set_clientdata(new_client, data);
1194 new_client->addr = address; 1193 new_client->addr = address;
1195 init_MUTEX(&data->lock);
1196 new_client->adapter = adapter; 1194 new_client->adapter = adapter;
1197 new_client->driver = &w83792d_driver; 1195 new_client->driver = &w83792d_driver;
1198 new_client->flags = 0; 1196 new_client->flags = 0;
@@ -1243,7 +1241,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1243 goto ERROR1; 1241 goto ERROR1;
1244 } 1242 }
1245 val1 = w83792d_read_value(new_client, W83792D_REG_WCHIPID); 1243 val1 = w83792d_read_value(new_client, W83792D_REG_WCHIPID);
1246 if (val1 == 0x7a && address >= 0x2c) { 1244 if (val1 == 0x7a) {
1247 kind = w83792d; 1245 kind = w83792d;
1248 } else { 1246 } else {
1249 if (kind == 0) 1247 if (kind == 0)
@@ -1416,26 +1414,17 @@ w83792d_detach_client(struct i2c_client *client)
1416 return 0; 1414 return 0;
1417} 1415}
1418 1416
1419/* The SMBus locks itself, usually, but nothing may access the Winbond between 1417/* The SMBus locks itself. The Winbond W83792D chip has a bank register,
1420 bank switches. ISA access must always be locked explicitly! 1418 but the driver only accesses registers in bank 0, so we don't have
1421 We ignore the W83792D BUSY flag at this moment - it could lead to deadlocks, 1419 to switch banks and lock access between switches. */
1422 would slow down the W83792D access and should not be necessary. 1420static int w83792d_read_value(struct i2c_client *client, u8 reg)
1423 There are some ugly typecasts here, but the good news is - they should
1424 nowhere else be necessary! */
1425static int
1426w83792d_read_value(struct i2c_client *client, u8 reg)
1427{ 1421{
1428 int res=0; 1422 return i2c_smbus_read_byte_data(client, reg);
1429 res = i2c_smbus_read_byte_data(client, reg);
1430
1431 return res;
1432} 1423}
1433 1424
1434static int 1425static int w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)
1435w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)
1436{ 1426{
1437 i2c_smbus_write_byte_data(client, reg, value); 1427 return i2c_smbus_write_byte_data(client, reg, value);
1438 return 0;
1439} 1428}
1440 1429
1441static void 1430static void
@@ -1506,7 +1495,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev)
1506 pwm_array_tmp[i] = w83792d_read_value(client, 1495 pwm_array_tmp[i] = w83792d_read_value(client,
1507 W83792D_REG_PWM[i]); 1496 W83792D_REG_PWM[i]);
1508 data->pwm[i] = pwm_array_tmp[i] & 0x0f; 1497 data->pwm[i] = pwm_array_tmp[i] & 0x0f;
1509 data->pwm_mode[i] = (pwm_array_tmp[i] >> 7) & 0x01; 1498 data->pwm_mode[i] = pwm_array_tmp[i] >> 7;
1510 } 1499 }
1511 1500
1512 reg_tmp = w83792d_read_value(client, W83792D_REG_FAN_CFG); 1501 reg_tmp = w83792d_read_value(client, W83792D_REG_FAN_CFG);