aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/via686a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/via686a.c')
-rw-r--r--drivers/hwmon/via686a.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index f397ce7ad598..25e91665a0a2 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -30,6 +30,8 @@
30 Warning - only supports a single device. 30 Warning - only supports a single device.
31*/ 31*/
32 32
33#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
34
33#include <linux/module.h> 35#include <linux/module.h>
34#include <linux/slab.h> 36#include <linux/slab.h>
35#include <linux/pci.h> 37#include <linux/pci.h>
@@ -687,6 +689,13 @@ static int __devexit via686a_remove(struct platform_device *pdev)
687 return 0; 689 return 0;
688} 690}
689 691
692static void via686a_update_fan_div(struct via686a_data *data)
693{
694 int reg = via686a_read_value(data, VIA686A_REG_FANDIV);
695 data->fan_div[0] = (reg >> 4) & 0x03;
696 data->fan_div[1] = reg >> 6;
697}
698
690static void __devinit via686a_init_device(struct via686a_data *data) 699static void __devinit via686a_init_device(struct via686a_data *data)
691{ 700{
692 u8 reg; 701 u8 reg;
@@ -700,6 +709,9 @@ static void __devinit via686a_init_device(struct via686a_data *data)
700 via686a_write_value(data, VIA686A_REG_TEMP_MODE, 709 via686a_write_value(data, VIA686A_REG_TEMP_MODE,
701 (reg & ~VIA686A_TEMP_MODE_MASK) 710 (reg & ~VIA686A_TEMP_MODE_MASK)
702 | VIA686A_TEMP_MODE_CONTINUOUS); 711 | VIA686A_TEMP_MODE_CONTINUOUS);
712
713 /* Pre-read fan clock divisor values */
714 via686a_update_fan_div(data);
703} 715}
704 716
705static struct via686a_data *via686a_update_device(struct device *dev) 717static struct via686a_data *via686a_update_device(struct device *dev)
@@ -751,9 +763,7 @@ static struct via686a_data *via686a_update_device(struct device *dev)
751 (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) & 763 (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) &
752 0xc0) >> 6; 764 0xc0) >> 6;
753 765
754 i = via686a_read_value(data, VIA686A_REG_FANDIV); 766 via686a_update_fan_div(data);
755 data->fan_div[0] = (i >> 4) & 0x03;
756 data->fan_div[1] = i >> 6;
757 data->alarms = 767 data->alarms =
758 via686a_read_value(data, 768 via686a_read_value(data,
759 VIA686A_REG_ALARM1) | 769 VIA686A_REG_ALARM1) |
@@ -791,21 +801,19 @@ static int __devinit via686a_device_add(unsigned short address)
791 pdev = platform_device_alloc("via686a", address); 801 pdev = platform_device_alloc("via686a", address);
792 if (!pdev) { 802 if (!pdev) {
793 err = -ENOMEM; 803 err = -ENOMEM;
794 printk(KERN_ERR "via686a: Device allocation failed\n"); 804 pr_err("Device allocation failed\n");
795 goto exit; 805 goto exit;
796 } 806 }
797 807
798 err = platform_device_add_resources(pdev, &res, 1); 808 err = platform_device_add_resources(pdev, &res, 1);
799 if (err) { 809 if (err) {
800 printk(KERN_ERR "via686a: Device resource addition failed " 810 pr_err("Device resource addition failed (%d)\n", err);
801 "(%d)\n", err);
802 goto exit_device_put; 811 goto exit_device_put;
803 } 812 }
804 813
805 err = platform_device_add(pdev); 814 err = platform_device_add(pdev);
806 if (err) { 815 if (err) {
807 printk(KERN_ERR "via686a: Device addition failed (%d)\n", 816 pr_err("Device addition failed (%d)\n", err);
808 err);
809 goto exit_device_put; 817 goto exit_device_put;
810 } 818 }
811 819