hwmon: (lm80) Various cleanups
authorJean Delvare <khali@linux-fr.org>
Sat, 5 Jan 2008 14:35:09 +0000 (15:35 +0100)
committerMark M. Hoffman <mhoffman@lightlink.com>
Fri, 8 Feb 2008 01:39:45 +0000 (20:39 -0500)
* 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>
drivers/hwmon/lm80.c

index 0bde0a382ef14f0d49030e628b186ca8cdfdc25a..32dfdf38b161bf49bc9b24ed545e19bd236460f8 100644 (file)
@@ -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: