summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-01-05 17:35:09 +0300
committerMark M. Hoffman <mhoffman@lightlink.com>2008-02-08 04:39:45 +0300
commit6cc37ee536bb90c428c8a7cde91f33ffe1fd27bd (patch)
tree04e127c56a8750a29a9ce61045082da338b865de /drivers/hwmon
parent1c1381076f8c6cf0a2c9918194e3fa6369cdf06a (diff)
downloadlinux-6cc37ee536bb90c428c8a7cde91f33ffe1fd27bd.tar.xz
hwmon: (lm80) Various cleanups
* Drop trailing whitespace * Fold a long line * Rename new_client to client * Drop redundant initializations to 0 * Drop bogus comment Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm80.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
index 0bde0a382ef1..32dfdf38b161 100644
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -127,7 +127,7 @@ struct lm80_data {
u16 alarms; /* Register encoding, combined */
};
-/*
+/*
* Functions declaration
*/
@@ -336,7 +336,8 @@ set_temp(hot_hyst, temp_hot_hyst, LM80_REG_TEMP_HOT_HYST);
set_temp(os_max, temp_os_max, LM80_REG_TEMP_OS_MAX);
set_temp(os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST);
-static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t show_alarms(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
struct lm80_data *data = lm80_update_device(dev);
return sprintf(buf, "%u\n", data->alarms);
@@ -438,7 +439,7 @@ static const struct attribute_group lm80_group = {
static int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
{
int i, cur;
- struct i2c_client *new_client;
+ struct i2c_client *client;
struct lm80_data *data;
int err = 0;
const char *name;
@@ -454,21 +455,20 @@ static int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
goto exit;
}
- new_client = &data->client;
- i2c_set_clientdata(new_client, data);
- new_client->addr = address;
- new_client->adapter = adapter;
- new_client->driver = &lm80_driver;
- new_client->flags = 0;
+ client = &data->client;
+ i2c_set_clientdata(client, data);
+ client->addr = address;
+ client->adapter = adapter;
+ client->driver = &lm80_driver;
/* Now, we do the remaining detection. It is lousy. */
- if (lm80_read_value(new_client, LM80_REG_ALARM2) & 0xc0)
+ if (lm80_read_value(client, LM80_REG_ALARM2) & 0xc0)
goto error_free;
for (i = 0x2a; i <= 0x3d; i++) {
- cur = i2c_smbus_read_byte_data(new_client, i);
- if ((i2c_smbus_read_byte_data(new_client, i + 0x40) != cur)
- || (i2c_smbus_read_byte_data(new_client, i + 0x80) != cur)
- || (i2c_smbus_read_byte_data(new_client, i + 0xc0) != cur))
+ cur = i2c_smbus_read_byte_data(client, i);
+ if ((i2c_smbus_read_byte_data(client, i + 0x40) != cur)
+ || (i2c_smbus_read_byte_data(client, i + 0x80) != cur)
+ || (i2c_smbus_read_byte_data(client, i + 0xc0) != cur))
goto error_free;
}
@@ -476,27 +476,26 @@ static int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
kind = lm80;
name = "lm80";
- /* Fill in the remaining client fields and put it into the global list */
- strlcpy(new_client->name, name, I2C_NAME_SIZE);
- data->valid = 0;
+ /* Fill in the remaining client fields */
+ strlcpy(client->name, name, I2C_NAME_SIZE);
mutex_init(&data->update_lock);
/* Tell the I2C layer a new client has arrived */
- if ((err = i2c_attach_client(new_client)))
+ if ((err = i2c_attach_client(client)))
goto error_free;
/* Initialize the LM80 chip */
- lm80_init_client(new_client);
+ lm80_init_client(client);
/* A few vars need to be filled upon startup */
- data->fan_min[0] = lm80_read_value(new_client, LM80_REG_FAN_MIN(1));
- data->fan_min[1] = lm80_read_value(new_client, LM80_REG_FAN_MIN(2));
+ data->fan_min[0] = lm80_read_value(client, LM80_REG_FAN_MIN(1));
+ data->fan_min[1] = lm80_read_value(client, LM80_REG_FAN_MIN(2));
/* Register sysfs hooks */
- if ((err = sysfs_create_group(&new_client->dev.kobj, &lm80_group)))
+ if ((err = sysfs_create_group(&client->dev.kobj, &lm80_group)))
goto error_detach;
- data->hwmon_dev = hwmon_device_register(&new_client->dev);
+ data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto error_remove;
@@ -505,9 +504,9 @@ static int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
return 0;
error_remove:
- sysfs_remove_group(&new_client->dev.kobj, &lm80_group);
+ sysfs_remove_group(&client->dev.kobj, &lm80_group);
error_detach:
- i2c_detach_client(new_client);
+ i2c_detach_client(client);
error_free:
kfree(data);
exit: