diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-24 13:29:18 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-24 13:29:18 -0700 |
commit | 0cd5ff591ab6473355d5a6a47f7694def28e451d (patch) | |
tree | aed0ea4fbb724f13208ed76d438518ffc9130a17 /drivers | |
parent | 3539fc544f39017cf3403b9319fb4d74b5116135 (diff) | |
parent | e30bca12573fbf54e2470723aadc047549d147ce (diff) |
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck:
"New drivers for DA9052/53 PMIC as well as HIH-6130/HIH-6131 humidity
and temperature sensors.
Convert drivers to use devm_ functions and to use dev_pm_ops. Address
a couple of Coverity errors/warnings as well as compile warnings.
Some functional improvements in applesmc driver."
* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (72 commits)
hwmon: (applesmc) Ignore some temperature registers
hwmon: (applesmc) Allow negative temperature values
hwmon: (s3c-hwmon) Use devm_kzalloc instead of kzalloc
hwmon: (w83781d) Fix compile warning
hwmon: (applesmc) Shorten minimum wait time
hwmon: (exynos4_tmu) Use struct dev_pm_ops for power management
hwmon: (gpio-fan) Use struct dev_pm_ops for power management
hwmon: (abituguru3) Use struct dev_pm_ops for power management
hwmon: (abituguru) Use struct dev_pm_ops for power management
hwmon: (acpi_power_meter) Fix unintentional integer overflow
hwmon: (acpi_power_meter) Cleanup and optimizations
hwmon: Honeywell Humidicon HIH-6130/HIH-6131 humidity and temperature sensor driver
hwmon: (applesmc) Skip sensor mapping
hwmon: (ntc_thermistor) Ensure that data->name string is terminated
hwmon: (w83l785ts) Convert to use devm_ functions
hwmon: (w83l785ts) Simplify code and improve readability
hwmon: (smsc47m192) Convert to use devm_ functions
hwmon: (smsc47m1) Convert to use devm_ functions
hwmon: (smsc47b397) Convert to use devm_ functions
hwmon: (k8temp) Convert to use devm_ functions
...
Diffstat (limited to 'drivers')
65 files changed, 1119 insertions, 846 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 6f1d167cb1e..b0a2e4c37e1 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -314,6 +314,16 @@ config SENSORS_DS1621 This driver can also be built as a module. If so, the module will be called ds1621. +config SENSORS_DA9052_ADC + tristate "Dialog DA9052/DA9053 ADC" + depends on PMIC_DA9052 + help + Say y here to support the ADC found on Dialog Semiconductor + DA9052-BC and DA9053-AA/Bx PMICs. + + This driver can also be built as module. If so, the module + will be called da9052-hwmon. + config SENSORS_EXYNOS4_TMU tristate "Temperature sensor on Samsung EXYNOS4" depends on ARCH_EXYNOS4 @@ -433,6 +443,16 @@ config SENSORS_GPIO_FAN This driver can also be built as a module. If so, the module will be called gpio-fan. +config SENSORS_HIH6130 + tristate "Honeywell Humidicon HIH-6130 humidity/temperature sensor" + depends on I2C && EXPERIMENTAL + help + If you say yes here you get support for Honeywell Humidicon + HIH-6130 and HIH-6131 Humidicon humidity sensors. + + This driver can also be built as a module. If so, the module + will be called hih6130. + config SENSORS_CORETEMP tristate "Intel Core/Core2/Atom temperature sensor" depends on X86 && PCI && EXPERIMENTAL diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index e1eeac13b85..7aa98119c4a 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -42,6 +42,7 @@ obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o obj-$(CONFIG_SENSORS_ASC7621) += asc7621.o obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o +obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o obj-$(CONFIG_SENSORS_DME1737) += dme1737.o obj-$(CONFIG_SENSORS_DS620) += ds620.o obj-$(CONFIG_SENSORS_DS1621) += ds1621.o @@ -58,6 +59,7 @@ obj-$(CONFIG_SENSORS_G760A) += g760a.o obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o obj-$(CONFIG_SENSORS_GPIO_FAN) += gpio-fan.o +obj-$(CONFIG_SENSORS_HIH6130) += hih6130.o obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index a72bf25601a..d4419b47f3d 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c @@ -1513,10 +1513,10 @@ LEAVE_UPDATE: return NULL; } -#ifdef CONFIG_PM -static int abituguru_suspend(struct platform_device *pdev, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int abituguru_suspend(struct device *dev) { - struct abituguru_data *data = platform_get_drvdata(pdev); + struct abituguru_data *data = dev_get_drvdata(dev); /* * make sure all communications with the uguru are done and no new * ones are started @@ -1525,29 +1525,30 @@ static int abituguru_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int abituguru_resume(struct platform_device *pdev) +static int abituguru_resume(struct device *dev) { - struct abituguru_data *data = platform_get_drvdata(pdev); + struct abituguru_data *data = dev_get_drvdata(dev); /* See if the uGuru is still ready */ if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT) data->uguru_ready = 0; mutex_unlock(&data->update_lock); return 0; } + +static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume); +#define ABIT_UGURU_PM &abituguru_pm #else -#define abituguru_suspend NULL -#define abituguru_resume NULL +#define ABIT_UGURU_PM NULL #endif /* CONFIG_PM */ static struct platform_driver abituguru_driver = { .driver = { .owner = THIS_MODULE, .name = ABIT_UGURU_NAME, + .pm = ABIT_UGURU_PM, }, .probe = abituguru_probe, .remove = __devexit_p(abituguru_remove), - .suspend = abituguru_suspend, - .resume = abituguru_resume, }; static int __init abituguru_detect(void) diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index a5bc4287daa..5d582aebff8 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c @@ -1141,10 +1141,10 @@ LEAVE_UPDATE: return NULL; } -#ifdef CONFIG_PM -static int abituguru3_suspend(struct platform_device *pdev, pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int abituguru3_suspend(struct device *dev) { - struct abituguru3_data *data = platform_get_drvdata(pdev); + struct abituguru3_data *data = dev_get_drvdata(dev); /* * make sure all communications with the uguru3 are done and no new * ones are started @@ -1153,26 +1153,27 @@ static int abituguru3_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int abituguru3_resume(struct platform_device *pdev) +static int abituguru3_resume(struct device *dev) { - struct abituguru3_data *data = platform_get_drvdata(pdev); + struct abituguru3_data *data = dev_get_drvdata(dev); mutex_unlock(&data->update_lock); return 0; } + +static SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume); +#define ABIT_UGURU3_PM &abituguru3_pm #else -#define abituguru3_suspend NULL -#define abituguru3_resume NULL +#define ABIT_UGURU3_PM NULL #endif /* CONFIG_PM */ static struct platform_driver abituguru3_driver = { .driver = { .owner = THIS_MODULE, .name = ABIT_UGURU3_NAME, + .pm = ABIT_UGURU3_PM }, .probe = abituguru3_probe, .remove = __devexit_p(abituguru3_remove), - .suspend = abituguru3_suspend, - .resume = abituguru3_resume }; static int __init abituguru3_dmi_detect(void) diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index e3fcf814683..563c02904dd 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c @@ -101,7 +101,7 @@ struct acpi_power_meter_resource { unsigned long sensors_last_updated; struct sensor_device_attribute sensors[NUM_SENSORS]; int num_sensors; - int trip[2]; + s64 trip[2]; int num_domain_devices; struct acpi_device **domain_devices; struct kobject *holders_dir; @@ -237,7 +237,7 @@ static ssize_t set_cap(struct device *dev, struct device_attribute *devattr, if (res) return res; - temp /= 1000; + temp = DIV_ROUND_CLOSEST(temp, 1000); if (temp > resource->caps.max_cap || temp < resource->caps.min_cap) return -EINVAL; arg0.integer.value = temp; @@ -307,9 +307,7 @@ static ssize_t set_trip(struct device *dev, struct device_attribute *devattr, if (res) return res; - temp /= 1000; - if (temp < 0) - return -EINVAL; + temp = DIV_ROUND_CLOSEST(temp, 1000); mutex_lock(&resource->lock); resource->trip[attr->index - 7] = temp; diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 4394e7e99c4..fd1d1b15854 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c @@ -366,11 +366,11 @@ static int adm1021_probe(struct i2c_client *client, struct adm1021_data *data; int err; - data = kzalloc(sizeof(struct adm1021_data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(struct adm1021_data), + GFP_KERNEL); if (!data) { - pr_debug("adm1021: detect failed, kzalloc failed!\n"); - err = -ENOMEM; - goto error0; + pr_debug("adm1021: detect failed, devm_kzalloc failed!\n"); + return -ENOMEM; } i2c_set_clientdata(client, data); @@ -384,21 +384,18 @@ static int adm1021_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &adm1021_group); if (err) - goto error1; + return err; data->hwmon_dev = hwmon_device_register(&client->dev); if (IS_ERR(data->hwmon_dev)) { err = PTR_ERR(data->hwmon_dev); - goto error3; + goto error; } return 0; -error3: +error: sysfs_remove_group(&client->dev.kobj, &adm1021_group); -error1: - kfree(data); -error0: return err; } @@ -418,7 +415,6 @@ static int adm1021_remove(struct i2c_client *client) hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &adm1021_group); - kfree(data); return 0; } diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index b8557f9857d..7e16e5d07bc 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -477,11 +477,10 @@ static int adm1025_probe(struct i2c_client *client, int err; u8 config; - data = kzalloc(sizeof(struct adm1025_data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&client->dev, sizeof(struct adm1025_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(client, data); mutex_init(&data->update_lock); @@ -492,7 +491,7 @@ static int adm1025_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &adm1025_group); if (err) - goto exit_free; + return err; /* Pin 11 is either in4 (+12V) or VID4 */ config = i2c_smbus_read_byte_data(client, ADM1025_REG_CONFIG); @@ -513,9 +512,6 @@ static int adm1025_probe(struct i2c_client *client, exit_remove: sysfs_remove_group(&client->dev.kobj, &adm1025_group); sysfs_remove_group(&client->dev.kobj, &adm1025_group_in4); -exit_free: - kfree(data); -exit: return err; } @@ -569,7 +565,6 @@ static int adm1025_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &adm1025_group); sysfs_remove_group(&client->dev.kobj, &adm1025_group_in4); - kfree(data); return 0; } diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 1003219b9f9..0f068e7297e 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -1834,11 +1834,10 @@ static int adm1026_probe(struct i2c_client *client, struct adm1026_data *data; int err; - data = kzalloc(sizeof(struct adm1026_data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&client->dev, sizeof(struct adm1026_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(client, data); mutex_init(&data->update_lock); @@ -1852,7 +1851,7 @@ static int adm1026_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &adm1026_group); if (err) - goto exitfree; + return err; if (data->config1 & CFG1_AIN8_9) err = sysfs_create_group(&client->dev.kobj, &adm1026_group_in8_9); @@ -1877,9 +1876,6 @@ exitremove: sysfs_remove_group(&client->dev.kobj, &adm1026_group_in8_9); else sysfs_remove_group(&client->dev.kobj, &adm1026_group_temp3); -exitfree: - kfree(data); -exit: return err; } @@ -1892,7 +1888,6 @@ static int adm1026_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &adm1026_group_in8_9); else sysfs_remove_group(&client->dev.kobj, &adm1026_group_temp3); - kfree(data); return 0; } diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 44e1fd7f3d8..c6a4631e833 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c @@ -954,11 +954,10 @@ static int adm1031_probe(struct i2c_client *client, struct adm1031_data *data; int err; - data = kzalloc(sizeof(struct adm1031_data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&client->dev, sizeof(struct adm1031_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(client, data); data->chip_type = id->driver_data; @@ -975,7 +974,7 @@ static int adm1031_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &adm1031_group); if (err) - goto exit_free; + return err; if (data->chip_type == adm1031) { err = sysfs_create_group(&client->dev.kobj, &adm1031_group_opt); @@ -994,9 +993,6 @@ static int adm1031_probe(struct i2c_client *client, exit_remove: sysfs_remove_group(&client->dev.kobj, &adm1031_group); sysfs_remove_group(&client->dev.kobj, &adm1031_group_opt); -exit_free: - kfree(data); -exit: return err; } @@ -1007,7 +1003,6 @@ static int adm1031_remove(struct i2c_client *client) hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &adm1031_group); sysfs_remove_group(&client->dev.kobj, &adm1031_group_opt); - kfree(data); return 0; } diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c index c3c2865a896..5a78d102a0f 100644 --- a/drivers/hwmon/adm9240.c +++ b/drivers/hwmon/adm9240.c @@ -650,11 +650,9 @@ static int adm9240_probe(struct i2c_client *new_client, struct adm9240_data *data; int err; - data = kzalloc(sizeof(*data), GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit; - } + data = devm_kzalloc(&new_client->dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; i2c_set_clientdata(new_client, data); mutex_init(&data->update_lock); @@ -664,7 +662,7 @@ static int adm9240_probe(struct i2c_client *new_client, /* populate sysfs filesystem */ err = sysfs_create_group(&new_client->dev.kobj, &adm9240_group); if (err) - goto exit_free; + return err; data->hwmon_dev = hwmon_device_register(&new_client->dev); if (IS_ERR(data->hwmon_dev)) { @@ -676,9 +674,6 @@ static int adm9240_probe(struct i2c_client *new_client, exit_remove: sysfs_remove_group(&new_client->dev.kobj, &adm9240_group); -exit_free: - kfree(data); -exit: return err; } @@ -689,7 +684,6 @@ static int adm9240_remove(struct i2c_client *client) hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &adm9240_group); - kfree(data); return 0; } diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index df29d13a534..861c756e953 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -1260,7 +1260,7 @@ static int adt7475_probe(struct i2c_client *client, int i, ret = 0, revision; u8 config2, config3; - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (data == NULL) return -ENOMEM; @@ -1344,7 +1344,7 @@ static int adt7475_probe(struct i2c_client *client, ret = sysfs_create_group(&client->dev.kobj, &adt7475_attr_group); if (ret) - goto efree; + return ret; /* Features that can be disabled individually */ if (data->has_fan4) { @@ -1410,8 +1410,6 @@ static int adt7475_probe(struct i2c_client *client, eremove: adt7475_remove_files(client, data); -efree: - kfree(data); return ret; } @@ -1421,7 +1419,6 @@ static int adt7475_remove(struct i2c_client *client) hwmon_device_unregister(data->hwmon_dev); adt7475_remove_files(client, data); - kfree(data); return 0; } diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 2cde9ecf773..4d937a18fad 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c @@ -54,7 +54,7 @@ #define APPLESMC_MAX_DATA_LENGTH 32 /* wait up to 32 ms for a status change. */ -#define APPLESMC_MIN_WAIT 0x0040 +#define APPLESMC_MIN_WAIT 0x0010 #define APPLESMC_MAX_WAIT 0x8000 #define APPLESMC_STATUS_MASK 0x0f @@ -80,6 +80,8 @@ #define FANS_MANUAL "FS! " /* r-w ui16 */ #define FAN_ID_FMT "F%dID" /* r-o char[16] */ +#define TEMP_SENSOR_TYPE "sp78" + /* List of keys used to read/write fan speeds */ static const char *const fan_speed_fmt[] = { "F%dAc", /* actual speed */ @@ -96,10 +98,6 @@ static const char *const fan_speed_fmt[] = { #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */ #define APPLESMC_INPUT_FLAT 4 -#define SENSOR_X 0 -#define SENSOR_Y 1 -#define SENSOR_Z 2 - #define to_index(attr) (to_sensor_dev_attr(attr)->index & 0xffff) #define to_option(attr) (to_sensor_dev_attr(attr)->index >> 16) @@ -135,11 +133,13 @@ static struct applesmc_registers { unsigned int temp_count; /* number of temperature registers */ unsigned int temp_begin; /* temperature lower index bound */ unsigned int temp_end; /* temperature upper index bound */ + unsigned int index_count; /* size of temperature index array */ int num_light_sensors; /* number of light sensors */ bool has_accelerometer; /* has motion sensor */ bool has_key_backlight; /* has keyboard backlight */ bool init_complete; /* true when fully initialized */ struct applesmc_entry *cache; /* cached key entries */ + const char **index; /* temperature key index */ } smcreg = { .mutex = __MUTEX_INITIALIZER(smcreg.mutex), }; @@ -432,30 +432,19 @@ static int applesmc_has_key(const char *key, bool *value) } /* - * applesmc_read_motion_sensor - Read motion sensor (X, Y or Z). + * |