diff options
Diffstat (limited to 'drivers/hwmon')
| -rw-r--r-- | drivers/hwmon/ad7314.c | 8 | ||||
| -rw-r--r-- | drivers/hwmon/ads7871.c | 9 | ||||
| -rw-r--r-- | drivers/hwmon/applesmc.c | 4 | ||||
| -rw-r--r-- | drivers/hwmon/coretemp.c | 5 | ||||
| -rw-r--r-- | drivers/hwmon/fam15h_power.c | 15 | ||||
| -rw-r--r-- | drivers/hwmon/ina2xx.c | 30 | ||||
| -rw-r--r-- | drivers/hwmon/twl4030-madc-hwmon.c | 9 | ||||
| -rw-r--r-- | drivers/hwmon/via-cputemp.c | 5 | 
8 files changed, 56 insertions, 29 deletions
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index cfec802cf9c..f915eb1c29f 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c @@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev,  	}  } +static ssize_t ad7314_show_name(struct device *dev, +				struct device_attribute *devattr, char *buf) +{ +	return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); +} + +static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL);  static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,  			  ad7314_show_temperature, NULL, 0);  static struct attribute *ad7314_attributes[] = { +	&dev_attr_name.attr,  	&sensor_dev_attr_temp1_input.dev_attr.attr,  	NULL,  }; diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c index e65c6e45d36..7bf4ce3d405 100644 --- a/drivers/hwmon/ads7871.c +++ b/drivers/hwmon/ads7871.c @@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev,  	}  } +static ssize_t ads7871_show_name(struct device *dev, +				 struct device_attribute *devattr, char *buf) +{ +	return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); +} +  static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0);  static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1);  static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); @@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5);  static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6);  static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); +  static struct attribute *ads7871_attributes[] = {  	&sensor_dev_attr_in0_input.dev_attr.attr,  	&sensor_dev_attr_in1_input.dev_attr.attr, @@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = {  	&sensor_dev_attr_in5_input.dev_attr.attr,  	&sensor_dev_attr_in6_input.dev_attr.attr,  	&sensor_dev_attr_in7_input.dev_attr.attr, +	&dev_attr_name.attr,  	NULL  }; diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 28270886051..8f3f6f2c45f 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c @@ -53,10 +53,10 @@  #define APPLESMC_MAX_DATA_LENGTH 32 -/* wait up to 32 ms for a status change. */ +/* wait up to 128 ms for a status change. */  #define APPLESMC_MIN_WAIT	0x0010  #define APPLESMC_RETRY_WAIT	0x0100 -#define APPLESMC_MAX_WAIT	0x8000 +#define APPLESMC_MAX_WAIT	0x20000  #define APPLESMC_READ_CMD	0x10  #define APPLESMC_WRITE_CMD	0x11 diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0fa356fe82c..984a3f13923 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -815,17 +815,20 @@ static int __init coretemp_init(void)  	if (err)  		goto exit; +	get_online_cpus();  	for_each_online_cpu(i)  		get_core_online(i);  #ifndef CONFIG_HOTPLUG_CPU  	if (list_empty(&pdev_list)) { +		put_online_cpus();  		err = -ENODEV;  		goto exit_driver_unreg;  	}  #endif  	register_hotcpu_notifier(&coretemp_cpu_notifier); +	put_online_cpus();  	return 0;  #ifndef CONFIG_HOTPLUG_CPU @@ -840,6 +843,7 @@ static void __exit coretemp_exit(void)  {  	struct pdev_entry *p, *n; +	get_online_cpus();  	unregister_hotcpu_notifier(&coretemp_cpu_notifier);  	mutex_lock(&pdev_list_mutex);  	list_for_each_entry_safe(p, n, &pdev_list, list) { @@ -848,6 +852,7 @@ static void __exit coretemp_exit(void)  		kfree(p);  	}  	mutex_unlock(&pdev_list_mutex); +	put_online_cpus();  	platform_driver_unregister(&coretemp_driver);  } diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 2764b78a784..af69073b3fe 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c @@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)   * counter saturations resulting in bogus power readings.   * We correct this value ourselves to cope with older BIOSes.   */ -static DEFINE_PCI_DEVICE_TABLE(affected_device) = { +static const struct pci_device_id affected_device[] = {  	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },  	{ 0 }  }; -static void __devinit tweak_runavg_range(struct pci_dev *pdev) +static void tweak_runavg_range(struct pci_dev *pdev)  {  	u32 val; @@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev)  		REG_TDP_RUNNING_AVERAGE, val);  } +#ifdef CONFIG_PM +static int fam15h_power_resume(struct pci_dev *pdev) +{ +	tweak_runavg_range(pdev); +	return 0; +} +#else +#define fam15h_power_resume NULL +#endif +  static void __devinit fam15h_power_init_data(struct pci_dev *f4,  					     struct fam15h_power_data *data)  { @@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = {  	.id_table = fam15h_power_id_table,  	.probe = fam15h_power_probe,  	.remove = __devexit_p(fam15h_power_remove), +	.resume = fam15h_power_resume,  };  module_pci_driver(fam15h_power_driver); diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 7f3f4a38572..602148299f6 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -69,22 +69,6 @@ struct ina2xx_data {  	u16 regs[INA2XX_MAX_REGISTERS];  }; -int ina2xx_read_word(struct i2c_client *client, int reg) -{ -	int val = i2c_smbus_read_word_data(client, reg); -	if (unlikely(val < 0)) { -		dev_dbg(&client->dev, -			"Failed to read register: %d\n", reg); -		return val; -	} -	return be16_to_cpu(val); -} - -void ina2xx_write_word(struct i2c_client *client, int reg, int data) -{ -	i2c_smbus_write_word_data(client, reg, cpu_to_be16(data)); -} -  static struct ina2xx_data *ina2xx_update_device(struct device *dev)  {  	struct i2c_client *client = to_i2c_client(dev); @@ -102,7 +86,7 @@ static struct ina2xx_data *ina2xx_update_device(struct device *dev)  		/* Read all registers */  		for (i = 0; i < data->registers; i++) { -			int rv = ina2xx_read_word(client, i); +			int rv = i2c_smbus_read_word_swapped(client, i);  			if (rv < 0) {  				ret = ERR_PTR(rv);  				goto abort; @@ -279,22 +263,26 @@ static int ina2xx_probe(struct i2c_client *client,  	switch (data->kind) {  	case ina219:  		/* device configuration */ -		ina2xx_write_word(client, INA2XX_CONFIG, INA219_CONFIG_DEFAULT); +		i2c_smbus_write_word_swapped(client, INA2XX_CONFIG, +					     INA219_CONFIG_DEFAULT);  		/* set current LSB to 1mA, shunt is in uOhms */  		/* (equation 13 in datasheet) */ -		ina2xx_write_word(client, INA2XX_CALIBRATION, 40960000 / shunt); +		i2c_smbus_write_word_swapped(client, INA2XX_CALIBRATION, +					     40960000 / shunt);  		dev_info(&client->dev,  			 "power monitor INA219 (Rshunt = %li uOhm)\n", shunt);  		data->registers = INA219_REGISTERS;  		break;  	case ina226:  		/* device configuration */ -		ina2xx_write_word(client, INA2XX_CONFIG, INA226_CONFIG_DEFAULT); +		i2c_smbus_write_word_swapped(client, INA2XX_CONFIG, +					     INA226_CONFIG_DEFAULT);  		/* set current LSB to 1mA, shunt is in uOhms */  		/* (equation 1 in datasheet)*/ -		ina2xx_write_word(client, INA2XX_CALIBRATION, 5120000 / shunt); +		i2c_smbus_write_word_swapped(client, INA2XX_CALIBRATION, +					     5120000 / shunt);  		dev_info(&client->dev,  			 "power monitor INA226 (Rshunt = %li uOhm)\n", shunt);  		data->registers = INA226_REGISTERS; diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c index 0018c7dd009..1a174f0a3cd 100644 --- a/drivers/hwmon/twl4030-madc-hwmon.c +++ b/drivers/hwmon/twl4030-madc-hwmon.c @@ -44,12 +44,13 @@ static ssize_t madc_read(struct device *dev,  			 struct device_attribute *devattr, char *buf)  {  	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -	struct twl4030_madc_request req; +	struct twl4030_madc_request req = { +		.channels = 1 << attr->index, +		.method = TWL4030_MADC_SW2, +		.type = TWL4030_MADC_WAIT, +	};  	long val; -	req.channels = (1 << attr->index); -	req.method = TWL4030_MADC_SW2; -	req.func_cb = NULL;  	val = twl4030_madc_conversion(&req);  	if (val < 0)  		return val; diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index ee4ebc198a9..2e56c6ce9fb 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c @@ -328,6 +328,7 @@ static int __init via_cputemp_init(void)  	if (err)  		goto exit; +	get_online_cpus();  	for_each_online_cpu(i) {  		struct cpuinfo_x86 *c = &cpu_data(i); @@ -347,12 +348,14 @@ static int __init via_cputemp_init(void)  #ifndef CONFIG_HOTPLUG_CPU  	if (list_empty(&pdev_list)) { +		put_online_cpus();  		err = -ENODEV;  		goto exit_driver_unreg;  	}  #endif  	register_hotcpu_notifier(&via_cputemp_cpu_notifier); +	put_online_cpus();  	return 0;  #ifndef CONFIG_HOTPLUG_CPU @@ -367,6 +370,7 @@ static void __exit via_cputemp_exit(void)  {  	struct pdev_entry *p, *n; +	get_online_cpus();  	unregister_hotcpu_notifier(&via_cputemp_cpu_notifier);  	mutex_lock(&pdev_list_mutex);  	list_for_each_entry_safe(p, n, &pdev_list, list) { @@ -375,6 +379,7 @@ static void __exit via_cputemp_exit(void)  		kfree(p);  	}  	mutex_unlock(&pdev_list_mutex); +	put_online_cpus();  	platform_driver_unregister(&via_cputemp_driver);  }  |