diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-05 09:35:09 -0500 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-07 20:39:45 -0500 |
commit | 6cc37ee536bb90c428c8a7cde91f33ffe1fd27bd (patch) | |
tree | 04e127c56a8750a29a9ce61045082da338b865de /drivers/hwmon | |
parent | 1c1381076f8c6cf0a2c9918194e3fa6369cdf06a (diff) |
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.c | 49 |
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 { | |||
127 | u16 alarms; /* Register encoding, combined */ | 127 | u16 alarms; /* Register encoding, combined */ |
128 | }; | 128 | }; |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * Functions declaration | 131 | * Functions declaration |
132 | */ | 132 | */ |
133 | 133 | ||
@@ -336,7 +336,8 @@ set_temp(hot_hyst, temp_hot_hyst, LM80_REG_TEMP_HOT_HYST); | |||
336 | set_temp(os_max, temp_os_max, LM80_REG_TEMP_OS_MAX); | 336 | set_temp(os_max, temp_os_max, LM80_REG_TEMP_OS_MAX); |
337 | set_temp(os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST); | 337 | set_temp(os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST); |
338 | 338 | ||
339 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) | 339 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, |
340 | char *buf) | ||
340 | { | 341 | { |
341 | struct lm80_data *data = lm80_update_device(dev); | 342 | struct lm80_data *data = lm80_update_device(dev); |
342 | return sprintf(buf, "%u\n", data->alarms); | 343 | return sprintf(buf, "%u\n", data->alarms); |
@@ -438,7 +439,7 @@ static const struct attribute_group lm80_group = { | |||
438 | static int lm80_detect(struct i2c_adapter *adapter, int address, int kind) | 439 | static int lm80_detect(struct i2c_adapter *adapter, int address, int kind) |
439 | { | 440 | { |
440 | int i, cur; | 441 | int i, cur; |
441 | struct i2c_client *new_client; | 442 | struct i2c_client *client; |
442 | struct lm80_data *data; | 443 | struct lm80_data *data; |
443 | int err = 0; | 444 | int err = 0; |
444 | const char *name; | 445 | const char *name; |
@@ -454,21 +455,20 @@ static int lm80_detect(struct i2c_adapter *adapter, int address, int kind) | |||
454 | goto exit; | 455 | goto exit; |
455 | } | 456 | } |
456 | 457 | ||
457 | new_client = &data->client; | 458 | client = &data->client; |
458 | i2c_set_clientdata(new_client, data); | 459 | i2c_set_clientdata(client, data); |
459 | new_client->addr = address; | 460 | client->addr = address; |
460 | new_client->adapter = adapter; | 461 | client->adapter = adapter; |
461 | new_client->driver = &lm80_driver; | 462 | client->driver = &lm80_driver; |
462 | new_client->flags = 0; | ||
463 | 463 | ||
464 | /* Now, we do the remaining detection. It is lousy. */ | 464 | /* Now, we do the remaining detection. It is lousy. */ |
465 | if (lm80_read_value(new_client, LM80_REG_ALARM2) & 0xc0) | 465 | if (lm80_read_value(client, LM80_REG_ALARM2) & 0xc0) |
466 | goto error_free; | 466 | goto error_free; |
467 | for (i = 0x2a; i <= 0x3d; i++) { | 467 | for (i = 0x2a; i <= 0x3d; i++) { |
468 | cur = i2c_smbus_read_byte_data(new_client, i); | 468 | cur = i2c_smbus_read_byte_data(client, i); |
469 | if ((i2c_smbus_read_byte_data(new_client, i + 0x40) != cur) | 469 | if ((i2c_smbus_read_byte_data(client, i + 0x40) != cur) |
470 | || (i2c_smbus_read_byte_data(new_client, i + 0x80) != cur) | 470 | || (i2c_smbus_read_byte_data(client, i + 0x80) != cur) |
471 | || (i2c_smbus_read_byte_data(new_client, i + 0xc0) != cur)) | 471 | || (i2c_smbus_read_byte_data(client, i + 0xc0) != cur)) |
472 | goto error_free; | 472 | goto error_free; |
473 | } | 473 | } |
474 | 474 | ||
@@ -476,27 +476,26 @@ static int lm80_detect(struct i2c_adapter *adapter, int address, int kind) | |||
476 | kind = lm80; | 476 | kind = lm80; |
477 | name = "lm80"; | 477 | name = "lm80"; |
478 | 478 | ||
479 | /* Fill in the remaining client fields and put it into the global list */ | 479 | /* Fill in the remaining client fields */ |
480 | strlcpy(new_client->name, name, I2C_NAME_SIZE); | 480 | strlcpy(client->name, name, I2C_NAME_SIZE); |
481 | data->valid = 0; | ||
482 | mutex_init(&data->update_lock); | 481 | mutex_init(&data->update_lock); |
483 | 482 | ||
484 | /* Tell the I2C layer a new client has arrived */ | 483 | /* Tell the I2C layer a new client has arrived */ |
485 | if ((err = i2c_attach_client(new_client))) | 484 | if ((err = i2c_attach_client(client))) |
486 | goto error_free; | 485 | goto error_free; |
487 | 486 | ||
488 | /* Initialize the LM80 chip */ | 487 | /* Initialize the LM80 chip */ |
489 | lm80_init_client(new_client); | 488 | lm80_init_client(client); |
490 | 489 | ||
491 | /* A few vars need to be filled upon startup */ | 490 | /* A few vars need to be filled upon startup */ |
492 | data->fan_min[0] = lm80_read_value(new_client, LM80_REG_FAN_MIN(1)); | 491 | data->fan_min[0] = lm80_read_value(client, LM80_REG_FAN_MIN(1)); |
493 | data->fan_min[1] = lm80_read_value(new_client, LM80_REG_FAN_MIN(2)); | 492 | data->fan_min[1] = lm80_read_value(client, LM80_REG_FAN_MIN(2)); |
494 | 493 | ||
495 | /* Register sysfs hooks */ | 494 | /* Register sysfs hooks */ |
496 | if ((err = sysfs_create_group(&new_client->dev.kobj, &lm80_group))) | 495 | if ((err = sysfs_create_group(&client->dev.kobj, &lm80_group))) |
497 | goto error_detach; | 496 | goto error_detach; |
498 | 497 | ||
499 | data->hwmon_dev = hwmon_device_register(&new_client->dev); | 498 | data->hwmon_dev = hwmon_device_register(&client->dev); |
500 | if (IS_ERR(data->hwmon_dev)) { | 499 | if (IS_ERR(data->hwmon_dev)) { |
501 | err = PTR_ERR(data->hwmon_dev); | 500 | err = PTR_ERR(data->hwmon_dev); |
502 | goto error_remove; | 501 | goto error_remove; |
@@ -505,9 +504,9 @@ static int lm80_detect(struct i2c_adapter *adapter, int address, int kind) | |||
505 | return 0; | 504 | return 0; |
506 | 505 | ||
507 | error_remove: | 506 | error_remove: |
508 | sysfs_remove_group(&new_client->dev.kobj, &lm80_group); | 507 | sysfs_remove_group(&client->dev.kobj, &lm80_group); |
509 | error_detach: | 508 | error_detach: |
510 | i2c_detach_client(new_client); | 509 | i2c_detach_client(client); |
511 | error_free: | 510 | error_free: |
512 | kfree(data); | 511 | kfree(data); |
513 | exit: | 512 | exit: |