diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-03 17:15:49 -0500 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-07 20:39:44 -0500 |
commit | af221931519571028c98cf7c7030dd973a524011 (patch) | |
tree | ebb11bc630f2a5e32f04f982b675e8a162401ab2 /drivers/hwmon/asb100.c | |
parent | 8f74efe81d122c071410fd74f42879ef81439fa4 (diff) |
hwmon: (asb100) Various cleanups
* Drop history, it's incomplete and doesn't belong there
* Drop unused version number
* Drop trailing spaces
* Coding style fixes
* Fold long lines
* Rename new_client to client
* Drop redundant initializations to 0
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/asb100.c')
-rw-r--r-- | drivers/hwmon/asb100.c | 124 |
1 files changed, 60 insertions, 64 deletions
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 3f434de1d993..db86bc113905 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c | |||
@@ -47,12 +47,6 @@ | |||
47 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
48 | #include "lm75.h" | 48 | #include "lm75.h" |
49 | 49 | ||
50 | /* | ||
51 | HISTORY: | ||
52 | 2003-12-29 1.0.0 Ported from lm_sensors project for kernel 2.6 | ||
53 | */ | ||
54 | #define ASB100_VERSION "1.0.0" | ||
55 | |||
56 | /* I2C addresses to scan */ | 50 | /* I2C addresses to scan */ |
57 | static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; | 51 | static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; |
58 | 52 | ||
@@ -344,14 +338,14 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
344 | unsigned long min; | 338 | unsigned long min; |
345 | unsigned long val = simple_strtoul(buf, NULL, 10); | 339 | unsigned long val = simple_strtoul(buf, NULL, 10); |
346 | int reg; | 340 | int reg; |
347 | 341 | ||
348 | mutex_lock(&data->update_lock); | 342 | mutex_lock(&data->update_lock); |
349 | 343 | ||
350 | min = FAN_FROM_REG(data->fan_min[nr], | 344 | min = FAN_FROM_REG(data->fan_min[nr], |
351 | DIV_FROM_REG(data->fan_div[nr])); | 345 | DIV_FROM_REG(data->fan_div[nr])); |
352 | data->fan_div[nr] = DIV_TO_REG(val); | 346 | data->fan_div[nr] = DIV_TO_REG(val); |
353 | 347 | ||
354 | switch(nr) { | 348 | switch (nr) { |
355 | case 0: /* fan 1 */ | 349 | case 0: /* fan 1 */ |
356 | reg = asb100_read_value(client, ASB100_REG_VID_FANDIV); | 350 | reg = asb100_read_value(client, ASB100_REG_VID_FANDIV); |
357 | reg = (reg & 0xcf) | (data->fan_div[0] << 4); | 351 | reg = (reg & 0xcf) | (data->fan_div[0] << 4); |
@@ -429,7 +423,7 @@ static int sprintf_temp_from_reg(u16 reg, char *buf, int nr) | |||
429 | } | 423 | } |
430 | return ret; | 424 | return ret; |
431 | } | 425 | } |
432 | 426 | ||
433 | #define show_temp_reg(reg) \ | 427 | #define show_temp_reg(reg) \ |
434 | static ssize_t show_##reg(struct device *dev, char *buf, int nr) \ | 428 | static ssize_t show_##reg(struct device *dev, char *buf, int nr) \ |
435 | { \ | 429 | { \ |
@@ -502,7 +496,8 @@ sysfs_temp(3); | |||
502 | sysfs_temp(4); | 496 | sysfs_temp(4); |
503 | 497 | ||
504 | /* VID */ | 498 | /* VID */ |
505 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) | 499 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, |
500 | char *buf) | ||
506 | { | 501 | { |
507 | struct asb100_data *data = asb100_update_device(dev); | 502 | struct asb100_data *data = asb100_update_device(dev); |
508 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); | 503 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); |
@@ -511,13 +506,15 @@ static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char | |||
511 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 506 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
512 | 507 | ||
513 | /* VRM */ | 508 | /* VRM */ |
514 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) | 509 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, |
510 | char *buf) | ||
515 | { | 511 | { |
516 | struct asb100_data *data = dev_get_drvdata(dev); | 512 | struct asb100_data *data = dev_get_drvdata(dev); |
517 | return sprintf(buf, "%d\n", data->vrm); | 513 | return sprintf(buf, "%d\n", data->vrm); |
518 | } | 514 | } |
519 | 515 | ||
520 | static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 516 | static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, |
517 | const char *buf, size_t count) | ||
521 | { | 518 | { |
522 | struct asb100_data *data = dev_get_drvdata(dev); | 519 | struct asb100_data *data = dev_get_drvdata(dev); |
523 | data->vrm = simple_strtoul(buf, NULL, 10); | 520 | data->vrm = simple_strtoul(buf, NULL, 10); |
@@ -527,7 +524,8 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const | |||
527 | /* Alarms */ | 524 | /* Alarms */ |
528 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); | 525 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); |
529 | 526 | ||
530 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) | 527 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, |
528 | char *buf) | ||
531 | { | 529 | { |
532 | struct asb100_data *data = asb100_update_device(dev); | 530 | struct asb100_data *data = asb100_update_device(dev); |
533 | return sprintf(buf, "%u\n", data->alarms); | 531 | return sprintf(buf, "%u\n", data->alarms); |
@@ -536,13 +534,15 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
536 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 534 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
537 | 535 | ||
538 | /* 1 PWM */ | 536 | /* 1 PWM */ |
539 | static ssize_t show_pwm1(struct device *dev, struct device_attribute *attr, char *buf) | 537 | static ssize_t show_pwm1(struct device *dev, struct device_attribute *attr, |
538 | char *buf) | ||
540 | { | 539 | { |
541 | struct asb100_data *data = asb100_update_device(dev); | 540 | struct asb100_data *data = asb100_update_device(dev); |
542 | return sprintf(buf, "%d\n", ASB100_PWM_FROM_REG(data->pwm & 0x0f)); | 541 | return sprintf(buf, "%d\n", ASB100_PWM_FROM_REG(data->pwm & 0x0f)); |
543 | } | 542 | } |
544 | 543 | ||
545 | static ssize_t set_pwm1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 544 | static ssize_t set_pwm1(struct device *dev, struct device_attribute *attr, |
545 | const char *buf, size_t count) | ||
546 | { | 546 | { |
547 | struct i2c_client *client = to_i2c_client(dev); | 547 | struct i2c_client *client = to_i2c_client(dev); |
548 | struct asb100_data *data = i2c_get_clientdata(client); | 548 | struct asb100_data *data = i2c_get_clientdata(client); |
@@ -556,14 +556,15 @@ static ssize_t set_pwm1(struct device *dev, struct device_attribute *attr, const | |||
556 | return count; | 556 | return count; |
557 | } | 557 | } |
558 | 558 | ||
559 | static ssize_t show_pwm_enable1(struct device *dev, struct device_attribute *attr, char *buf) | 559 | static ssize_t show_pwm_enable1(struct device *dev, |
560 | struct device_attribute *attr, char *buf) | ||
560 | { | 561 | { |
561 | struct asb100_data *data = asb100_update_device(dev); | 562 | struct asb100_data *data = asb100_update_device(dev); |
562 | return sprintf(buf, "%d\n", (data->pwm & 0x80) ? 1 : 0); | 563 | return sprintf(buf, "%d\n", (data->pwm & 0x80) ? 1 : 0); |
563 | } | 564 | } |
564 | 565 | ||
565 | static ssize_t set_pwm_enable1(struct device *dev, struct device_attribute *attr, const char *buf, | 566 | static ssize_t set_pwm_enable1(struct device *dev, |
566 | size_t count) | 567 | struct device_attribute *attr, const char *buf, size_t count) |
567 | { | 568 | { |
568 | struct i2c_client *client = to_i2c_client(dev); | 569 | struct i2c_client *client = to_i2c_client(dev); |
569 | struct asb100_data *data = i2c_get_clientdata(client); | 570 | struct asb100_data *data = i2c_get_clientdata(client); |
@@ -653,10 +654,10 @@ static int asb100_attach_adapter(struct i2c_adapter *adapter) | |||
653 | } | 654 | } |
654 | 655 | ||
655 | static int asb100_detect_subclients(struct i2c_adapter *adapter, int address, | 656 | static int asb100_detect_subclients(struct i2c_adapter *adapter, int address, |
656 | int kind, struct i2c_client *new_client) | 657 | int kind, struct i2c_client *client) |
657 | { | 658 | { |
658 | int i, id, err; | 659 | int i, id, err; |
659 | struct asb100_data *data = i2c_get_clientdata(new_client); | 660 | struct asb100_data *data = i2c_get_clientdata(client); |
660 | 661 | ||
661 | data->lm75[0] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 662 | data->lm75[0] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
662 | if (!(data->lm75[0])) { | 663 | if (!(data->lm75[0])) { |
@@ -676,26 +677,26 @@ static int asb100_detect_subclients(struct i2c_adapter *adapter, int address, | |||
676 | for (i = 2; i <= 3; i++) { | 677 | for (i = 2; i <= 3; i++) { |
677 | if (force_subclients[i] < 0x48 || | 678 | if (force_subclients[i] < 0x48 || |
678 | force_subclients[i] > 0x4f) { | 679 | force_subclients[i] > 0x4f) { |
679 | dev_err(&new_client->dev, "invalid subclient " | 680 | dev_err(&client->dev, "invalid subclient " |
680 | "address %d; must be 0x48-0x4f\n", | 681 | "address %d; must be 0x48-0x4f\n", |
681 | force_subclients[i]); | 682 | force_subclients[i]); |
682 | err = -ENODEV; | 683 | err = -ENODEV; |
683 | goto ERROR_SC_2; | 684 | goto ERROR_SC_2; |
684 | } | 685 | } |
685 | } | 686 | } |
686 | asb100_write_value(new_client, ASB100_REG_I2C_SUBADDR, | 687 | asb100_write_value(client, ASB100_REG_I2C_SUBADDR, |
687 | (force_subclients[2] & 0x07) | | 688 | (force_subclients[2] & 0x07) | |
688 | ((force_subclients[3] & 0x07) <<4)); | 689 | ((force_subclients[3] & 0x07) << 4)); |
689 | data->lm75[0]->addr = force_subclients[2]; | 690 | data->lm75[0]->addr = force_subclients[2]; |
690 | data->lm75[1]->addr = force_subclients[3]; | 691 | data->lm75[1]->addr = force_subclients[3]; |
691 | } else { | 692 | } else { |
692 | int val = asb100_read_value(new_client, ASB100_REG_I2C_SUBADDR); | 693 | int val = asb100_read_value(client, ASB100_REG_I2C_SUBADDR); |
693 | data->lm75[0]->addr = 0x48 + (val & 0x07); | 694 | data->lm75[0]->addr = 0x48 + (val & 0x07); |
694 | data->lm75[1]->addr = 0x48 + ((val >> 4) & 0x07); | 695 | data->lm75[1]->addr = 0x48 + ((val >> 4) & 0x07); |
695 | } | 696 | } |
696 | 697 | ||
697 | if(data->lm75[0]->addr == data->lm75[1]->addr) { | 698 | if (data->lm75[0]->addr == data->lm75[1]->addr) { |
698 | dev_err(&new_client->dev, "duplicate addresses 0x%x " | 699 | dev_err(&client->dev, "duplicate addresses 0x%x " |
699 | "for subclients\n", data->lm75[0]->addr); | 700 | "for subclients\n", data->lm75[0]->addr); |
700 | err = -ENODEV; | 701 | err = -ENODEV; |
701 | goto ERROR_SC_2; | 702 | goto ERROR_SC_2; |
@@ -705,18 +706,17 @@ static int asb100_detect_subclients(struct i2c_adapter *adapter, int address, | |||
705 | i2c_set_clientdata(data->lm75[i], NULL); | 706 | i2c_set_clientdata(data->lm75[i], NULL); |
706 | data->lm75[i]->adapter = adapter; | 707 | data->lm75[i]->adapter = adapter; |
707 | data->lm75[i]->driver = &asb100_driver; | 708 | data->lm75[i]->driver = &asb100_driver; |
708 | data->lm75[i]->flags = 0; | ||
709 | strlcpy(data->lm75[i]->name, "asb100 subclient", I2C_NAME_SIZE); | 709 | strlcpy(data->lm75[i]->name, "asb100 subclient", I2C_NAME_SIZE); |
710 | } | 710 | } |
711 | 711 | ||
712 | if ((err = i2c_attach_client(data->lm75[0]))) { | 712 | if ((err = i2c_attach_client(data->lm75[0]))) { |
713 | dev_err(&new_client->dev, "subclient %d registration " | 713 | dev_err(&client->dev, "subclient %d registration " |
714 | "at address 0x%x failed.\n", i, data->lm75[0]->addr); | 714 | "at address 0x%x failed.\n", i, data->lm75[0]->addr); |
715 | goto ERROR_SC_2; | 715 | goto ERROR_SC_2; |
716 | } | 716 | } |
717 | 717 | ||
718 | if ((err = i2c_attach_client(data->lm75[1]))) { | 718 | if ((err = i2c_attach_client(data->lm75[1]))) { |
719 | dev_err(&new_client->dev, "subclient %d registration " | 719 | dev_err(&client->dev, "subclient %d registration " |
720 | "at address 0x%x failed.\n", i, data->lm75[1]->addr); | 720 | "at address 0x%x failed.\n", i, data->lm75[1]->addr); |
721 | goto ERROR_SC_3; | 721 | goto ERROR_SC_3; |
722 | } | 722 | } |
@@ -737,7 +737,7 @@ ERROR_SC_0: | |||
737 | static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) | 737 | static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) |
738 | { | 738 | { |
739 | int err; | 739 | int err; |
740 | struct i2c_client *new_client; | 740 | struct i2c_client *client; |
741 | struct asb100_data *data; | 741 | struct asb100_data *data; |
742 | 742 | ||
743 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { | 743 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { |
@@ -757,13 +757,12 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) | |||
757 | goto ERROR0; | 757 | goto ERROR0; |
758 | } | 758 | } |
759 | 759 | ||
760 | new_client = &data->client; | 760 | client = &data->client; |
761 | mutex_init(&data->lock); | 761 | mutex_init(&data->lock); |
762 | i2c_set_clientdata(new_client, data); | 762 | i2c_set_clientdata(client, data); |
763 | new_client->addr = address; | 763 | client->addr = address; |
764 | new_client->adapter = adapter; | 764 | client->adapter = adapter; |
765 | new_client->driver = &asb100_driver; | 765 | client->driver = &asb100_driver; |
766 | new_client->flags = 0; | ||
767 | 766 | ||
768 | /* Now, we do the remaining detection. */ | 767 | /* Now, we do the remaining detection. */ |
769 | 768 | ||
@@ -773,15 +772,15 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) | |||
773 | bank. */ | 772 | bank. */ |
774 | if (kind < 0) { | 773 | if (kind < 0) { |
775 | 774 | ||
776 | int val1 = asb100_read_value(new_client, ASB100_REG_BANK); | 775 | int val1 = asb100_read_value(client, ASB100_REG_BANK); |
777 | int val2 = asb100_read_value(new_client, ASB100_REG_CHIPMAN); | 776 | int val2 = asb100_read_value(client, ASB100_REG_CHIPMAN); |
778 | 777 | ||
779 | /* If we're in bank 0 */ | 778 | /* If we're in bank 0 */ |
780 | if ( (!(val1 & 0x07)) && | 779 | if ((!(val1 & 0x07)) && |
781 | /* Check for ASB100 ID (low byte) */ | 780 | /* Check for ASB100 ID (low byte) */ |
782 | ( ((!(val1 & 0x80)) && (val2 != 0x94)) || | 781 | (((!(val1 & 0x80)) && (val2 != 0x94)) || |
783 | /* Check for ASB100 ID (high byte ) */ | 782 | /* Check for ASB100 ID (high byte ) */ |
784 | ((val1 & 0x80) && (val2 != 0x06)) ) ) { | 783 | ((val1 & 0x80) && (val2 != 0x06)))) { |
785 | pr_debug("asb100.o: detect failed, " | 784 | pr_debug("asb100.o: detect failed, " |
786 | "bad chip id 0x%02x!\n", val2); | 785 | "bad chip id 0x%02x!\n", val2); |
787 | err = -ENODEV; | 786 | err = -ENODEV; |
@@ -792,19 +791,19 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) | |||
792 | 791 | ||
793 | /* We have either had a force parameter, or we have already detected | 792 | /* We have either had a force parameter, or we have already detected |
794 | Winbond. Put it now into bank 0 and Vendor ID High Byte */ | 793 | Winbond. Put it now into bank 0 and Vendor ID High Byte */ |
795 | asb100_write_value(new_client, ASB100_REG_BANK, | 794 | asb100_write_value(client, ASB100_REG_BANK, |
796 | (asb100_read_value(new_client, ASB100_REG_BANK) & 0x78) | 0x80); | 795 | (asb100_read_value(client, ASB100_REG_BANK) & 0x78) | 0x80); |
797 | 796 | ||
798 | /* Determine the chip type. */ | 797 | /* Determine the chip type. */ |
799 | if (kind <= 0) { | 798 | if (kind <= 0) { |
800 | int val1 = asb100_read_value(new_client, ASB100_REG_WCHIPID); | 799 | int val1 = asb100_read_value(client, ASB100_REG_WCHIPID); |
801 | int val2 = asb100_read_value(new_client, ASB100_REG_CHIPMAN); | 800 | int val2 = asb100_read_value(client, ASB100_REG_CHIPMAN); |
802 | 801 | ||
803 | if ((val1 == 0x31) && (val2 == 0x06)) | 802 | if ((val1 == 0x31) && (val2 == 0x06)) |
804 | kind = asb100; | 803 | kind = asb100; |
805 | else { | 804 | else { |
806 | if (kind == 0) | 805 | if (kind == 0) |
807 | dev_warn(&new_client->dev, "ignoring " | 806 | dev_warn(&client->dev, "ignoring " |
808 | "'force' parameter for unknown chip " | 807 | "'force' parameter for unknown chip " |
809 | "at adapter %d, address 0x%02x.\n", | 808 | "at adapter %d, address 0x%02x.\n", |
810 | i2c_adapter_id(adapter), address); | 809 | i2c_adapter_id(adapter), address); |
@@ -814,34 +813,32 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) | |||
814 | } | 813 | } |
815 | 814 | ||
816 | /* Fill in remaining client fields and put it into the global list */ | 815 | /* Fill in remaining client fields and put it into the global list */ |
817 | strlcpy(new_client->name, "asb100", I2C_NAME_SIZE); | 816 | strlcpy(client->name, "asb100", I2C_NAME_SIZE); |
818 | data->type = kind; | 817 | data->type = kind; |
819 | |||
820 | data->valid = 0; | ||
821 | mutex_init(&data->update_lock); | 818 | mutex_init(&data->update_lock); |
822 | 819 | ||
823 | /* Tell the I2C layer a new client has arrived */ | 820 | /* Tell the I2C layer a new client has arrived */ |
824 | if ((err = i2c_attach_client(new_client))) | 821 | if ((err = i2c_attach_client(client))) |
825 | goto ERROR1; | 822 | goto ERROR1; |
826 | 823 | ||
827 | /* Attach secondary lm75 clients */ | 824 | /* Attach secondary lm75 clients */ |
828 | if ((err = asb100_detect_subclients(adapter, address, kind, | 825 | if ((err = asb100_detect_subclients(adapter, address, kind, |
829 | new_client))) | 826 | client))) |
830 | goto ERROR2; | 827 | goto ERROR2; |
831 | 828 | ||
832 | /* Initialize the chip */ | 829 | /* Initialize the chip */ |
833 | asb100_init_client(new_client); | 830 | asb100_init_client(client); |
834 | 831 | ||
835 | /* A few vars need to be filled upon startup */ | 832 | /* A few vars need to be filled upon startup */ |
836 | data->fan_min[0] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(0)); | 833 | data->fan_min[0] = asb100_read_value(client, ASB100_REG_FAN_MIN(0)); |
837 | data->fan_min[1] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(1)); | 834 | data->fan_min[1] = asb100_read_value(client, ASB100_REG_FAN_MIN(1)); |
838 | data->fan_min[2] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(2)); | 835 | data->fan_min[2] = asb100_read_value(client, ASB100_REG_FAN_MIN(2)); |
839 | 836 | ||
840 | /* Register sysfs hooks */ | 837 | /* Register sysfs hooks */ |
841 | if ((err = sysfs_create_group(&new_client->dev.kobj, &asb100_group))) | 838 | if ((err = sysfs_create_group(&client->dev.kobj, &asb100_group))) |
842 | goto ERROR3; | 839 | goto ERROR3; |
843 | 840 | ||
844 | data->hwmon_dev = hwmon_device_register(&new_client->dev); | 841 | data->hwmon_dev = hwmon_device_register(&client->dev); |
845 | if (IS_ERR(data->hwmon_dev)) { | 842 | if (IS_ERR(data->hwmon_dev)) { |
846 | err = PTR_ERR(data->hwmon_dev); | 843 | err = PTR_ERR(data->hwmon_dev); |
847 | goto ERROR4; | 844 | goto ERROR4; |
@@ -850,14 +847,14 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) | |||
850 | return 0; | 847 | return 0; |
851 | 848 | ||
852 | ERROR4: | 849 | ERROR4: |
853 | sysfs_remove_group(&new_client->dev.kobj, &asb100_group); | 850 | sysfs_remove_group(&client->dev.kobj, &asb100_group); |
854 | ERROR3: | 851 | ERROR3: |
855 | i2c_detach_client(data->lm75[1]); | 852 | i2c_detach_client(data->lm75[1]); |
856 | i2c_detach_client(data->lm75[0]); | 853 | i2c_detach_client(data->lm75[0]); |
857 | kfree(data->lm75[1]); | 854 | kfree(data->lm75[1]); |
858 | kfree(data->lm75[0]); | 855 | kfree(data->lm75[0]); |
859 | ERROR2: | 856 | ERROR2: |
860 | i2c_detach_client(new_client); | 857 | i2c_detach_client(client); |
861 | ERROR1: | 858 | ERROR1: |
862 | kfree(data); | 859 | kfree(data); |
863 | ERROR0: | 860 | ERROR0: |
@@ -913,17 +910,17 @@ static int asb100_read_value(struct i2c_client *client, u16 reg) | |||
913 | /* convert from ISA to LM75 I2C addresses */ | 910 | /* convert from ISA to LM75 I2C addresses */ |
914 | switch (reg & 0xff) { | 911 | switch (reg & 0xff) { |
915 | case 0x50: /* TEMP */ | 912 | case 0x50: /* TEMP */ |
916 | res = swab16(i2c_smbus_read_word_data (cl, 0)); | 913 | res = swab16(i2c_smbus_read_word_data(cl, 0)); |
917 | break; | 914 | break; |
918 | case 0x52: /* CONFIG */ | 915 | case 0x52: /* CONFIG */ |
919 | res = i2c_smbus_read_byte_data(cl, 1); | 916 | res = i2c_smbus_read_byte_data(cl, 1); |
920 | break; | 917 | break; |
921 | case 0x53: /* HYST */ | 918 | case 0x53: /* HYST */ |
922 | res = swab16(i2c_smbus_read_word_data (cl, 2)); | 919 | res = swab16(i2c_smbus_read_word_data(cl, 2)); |
923 | break; | 920 | break; |
924 | case 0x55: /* MAX */ | 921 | case 0x55: /* MAX */ |
925 | default: | 922 | default: |
926 | res = swab16(i2c_smbus_read_word_data (cl, 3)); | 923 | res = swab16(i2c_smbus_read_word_data(cl, 3)); |
927 | break; | 924 | break; |
928 | } | 925 | } |
929 | } | 926 | } |
@@ -986,7 +983,7 @@ static void asb100_init_client(struct i2c_client *client) | |||
986 | vid = vid_from_reg(vid, data->vrm); | 983 | vid = vid_from_reg(vid, data->vrm); |
987 | 984 | ||
988 | /* Start monitoring */ | 985 | /* Start monitoring */ |
989 | asb100_write_value(client, ASB100_REG_CONFIG, | 986 | asb100_write_value(client, ASB100_REG_CONFIG, |
990 | (asb100_read_value(client, ASB100_REG_CONFIG) & 0xf7) | 0x01); | 987 | (asb100_read_value(client, ASB100_REG_CONFIG) & 0xf7) | 0x01); |
991 | } | 988 | } |
992 | 989 | ||
@@ -1075,4 +1072,3 @@ MODULE_LICENSE("GPL"); | |||
1075 | 1072 | ||
1076 | module_init(asb100_init); | 1073 | module_init(asb100_init); |
1077 | module_exit(asb100_exit); | 1074 | module_exit(asb100_exit); |
1078 | |||