Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
hwmon: (lm95241) Replace rate sysfs attribute with update_interval
hwmon: (adm1031) Replace update_rate sysfs attribute with update_interval
hwmon: (w83627ehf) Use proper exit sequence
hwmon: (emc1403) Remove unnecessary hwmon_device_unregister
hwmon: (f75375s) Do not overwrite values read from registers
hwmon: (f75375s) Shift control mode to the correct bit position
hwmon: New subsystem maintainers
hwmon: (lis3lv02d) Prevent NULL pointer dereference

+50 -42
+3 -4
Documentation/hwmon/sysfs-interface
··· 91 91 I2C devices get this attribute created automatically. 92 92 RO 93 93 94 - update_rate The rate at which the chip will update readings. 94 + update_interval The interval at which the chip will update readings. 95 95 Unit: millisecond 96 96 RW 97 - Some devices have a variable update rate. This attribute 98 - can be used to change the update rate to the desired 99 - frequency. 97 + Some devices have a variable update rate or interval. 98 + This attribute can be used to change it to the desired value. 100 99 101 100 102 101 ************
+4 -1
MAINTAINERS
··· 2657 2657 F: drivers/media/video/gspca/ 2658 2658 2659 2659 HARDWARE MONITORING 2660 + M: Jean Delvare <khali@linux-fr.org> 2661 + M: Guenter Roeck <guenter.roeck@ericsson.com> 2660 2662 L: lm-sensors@lm-sensors.org 2661 2663 W: http://www.lm-sensors.org/ 2662 - S: Orphan 2664 + T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ 2665 + S: Maintained 2663 2666 F: Documentation/hwmon/ 2664 2667 F: drivers/hwmon/ 2665 2668 F: include/linux/hwmon*.h
+24 -19
drivers/hwmon/adm1031.c
··· 79 79 int chip_type; 80 80 char valid; /* !=0 if following fields are valid */ 81 81 unsigned long last_updated; /* In jiffies */ 82 - unsigned int update_rate; /* In milliseconds */ 82 + unsigned int update_interval; /* In milliseconds */ 83 83 /* The chan_select_table contains the possible configurations for 84 84 * auto fan control. 85 85 */ ··· 743 743 static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_alarm, NULL, 13); 744 744 static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 14); 745 745 746 - /* Update Rate */ 747 - static const unsigned int update_rates[] = { 746 + /* Update Interval */ 747 + static const unsigned int update_intervals[] = { 748 748 16000, 8000, 4000, 2000, 1000, 500, 250, 125, 749 749 }; 750 750 751 - static ssize_t show_update_rate(struct device *dev, 752 - struct device_attribute *attr, char *buf) 751 + static ssize_t show_update_interval(struct device *dev, 752 + struct device_attribute *attr, char *buf) 753 753 { 754 754 struct i2c_client *client = to_i2c_client(dev); 755 755 struct adm1031_data *data = i2c_get_clientdata(client); 756 756 757 - return sprintf(buf, "%u\n", data->update_rate); 757 + return sprintf(buf, "%u\n", data->update_interval); 758 758 } 759 759 760 - static ssize_t set_update_rate(struct device *dev, 761 - struct device_attribute *attr, 762 - const char *buf, size_t count) 760 + static ssize_t set_update_interval(struct device *dev, 761 + struct device_attribute *attr, 762 + const char *buf, size_t count) 763 763 { 764 764 struct i2c_client *client = to_i2c_client(dev); 765 765 struct adm1031_data *data = i2c_get_clientdata(client); ··· 771 771 if (err) 772 772 return err; 773 773 774 - /* find the nearest update rate from the table */ 775 - for (i = 0; i < ARRAY_SIZE(update_rates) - 1; i++) { 776 - if (val >= update_rates[i]) 774 + /* 775 + * Find the nearest update interval from the table. 776 + * Use it to determine the matching update rate. 777 + */ 778 + for (i = 0; i < ARRAY_SIZE(update_intervals) - 1; i++) { 779 + if (val >= update_intervals[i]) 777 780 break; 778 781 } 779 - /* if not found, we point to the last entry (lowest update rate) */ 782 + /* if not found, we point to the last entry (lowest update interval) */ 780 783 781 784 /* set the new update rate while preserving other settings */ 782 785 reg = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); ··· 788 785 adm1031_write_value(client, ADM1031_REG_FAN_FILTER, reg); 789 786 790 787 mutex_lock(&data->update_lock); 791 - data->update_rate = update_rates[i]; 788 + data->update_interval = update_intervals[i]; 792 789 mutex_unlock(&data->update_lock); 793 790 794 791 return count; 795 792 } 796 793 797 - static DEVICE_ATTR(update_rate, S_IRUGO | S_IWUSR, show_update_rate, 798 - set_update_rate); 794 + static DEVICE_ATTR(update_interval, S_IRUGO | S_IWUSR, show_update_interval, 795 + set_update_interval); 799 796 800 797 static struct attribute *adm1031_attributes[] = { 801 798 &sensor_dev_attr_fan1_input.dev_attr.attr, ··· 833 830 834 831 &sensor_dev_attr_auto_fan1_min_pwm.dev_attr.attr, 835 832 836 - &dev_attr_update_rate.attr, 833 + &dev_attr_update_interval.attr, 837 834 &dev_attr_alarms.attr, 838 835 839 836 NULL ··· 984 981 mask = ADM1031_UPDATE_RATE_MASK; 985 982 read_val = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); 986 983 i = (read_val & mask) >> ADM1031_UPDATE_RATE_SHIFT; 987 - data->update_rate = update_rates[i]; 984 + /* Save it as update interval */ 985 + data->update_interval = update_intervals[i]; 988 986 } 989 987 990 988 static struct adm1031_data *adm1031_update_device(struct device *dev) ··· 997 993 998 994 mutex_lock(&data->update_lock); 999 995 1000 - next_update = data->last_updated + msecs_to_jiffies(data->update_rate); 996 + next_update = data->last_updated 997 + + msecs_to_jiffies(data->update_interval); 1001 998 if (time_after(jiffies, next_update) || !data->valid) { 1002 999 1003 1000 dev_dbg(&client->dev, "Starting adm1031 update\n");
-1
drivers/hwmon/emc1403.c
··· 308 308 res = sysfs_create_group(&client->dev.kobj, &m_thermal_gr); 309 309 if (res) { 310 310 dev_warn(&client->dev, "create group failed\n"); 311 - hwmon_device_unregister(data->hwmon_dev); 312 311 goto thermal_error1; 313 312 } 314 313 data->hwmon_dev = hwmon_device_register(&client->dev);
+3 -3
drivers/hwmon/f75375s.c
··· 79 79 #define F75375_REG_PWM2_DROP_DUTY 0x6C 80 80 81 81 #define FAN_CTRL_LINEAR(nr) (4 + nr) 82 - #define FAN_CTRL_MODE(nr) (5 + ((nr) * 2)) 82 + #define FAN_CTRL_MODE(nr) (4 + ((nr) * 2)) 83 83 84 84 /* 85 85 * Data structures and manipulation thereof ··· 298 298 return -EINVAL; 299 299 300 300 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); 301 - fanmode = ~(3 << FAN_CTRL_MODE(nr)); 301 + fanmode &= ~(3 << FAN_CTRL_MODE(nr)); 302 302 303 303 switch (val) { 304 304 case 0: /* Full speed */ ··· 350 350 351 351 mutex_lock(&data->update_lock); 352 352 conf = f75375_read8(client, F75375_REG_CONFIG1); 353 - conf = ~(1 << FAN_CTRL_LINEAR(nr)); 353 + conf &= ~(1 << FAN_CTRL_LINEAR(nr)); 354 354 355 355 if (val == 0) 356 356 conf |= (1 << FAN_CTRL_LINEAR(nr)) ;
+2 -2
drivers/hwmon/lis3lv02d_i2c.c
··· 121 121 { 122 122 struct lis3lv02d *lis3 = i2c_get_clientdata(client); 123 123 124 - if (!lis3->pdata->wakeup_flags) 124 + if (!lis3->pdata || !lis3->pdata->wakeup_flags) 125 125 lis3lv02d_poweroff(lis3); 126 126 return 0; 127 127 } ··· 130 130 { 131 131 struct lis3lv02d *lis3 = i2c_get_clientdata(client); 132 132 133 - if (!lis3->pdata->wakeup_flags) 133 + if (!lis3->pdata || !lis3->pdata->wakeup_flags) 134 134 lis3lv02d_poweron(lis3); 135 135 return 0; 136 136 }
+2 -2
drivers/hwmon/lis3lv02d_spi.c
··· 92 92 { 93 93 struct lis3lv02d *lis3 = spi_get_drvdata(spi); 94 94 95 - if (!lis3->pdata->wakeup_flags) 95 + if (!lis3->pdata || !lis3->pdata->wakeup_flags) 96 96 lis3lv02d_poweroff(&lis3_dev); 97 97 98 98 return 0; ··· 102 102 { 103 103 struct lis3lv02d *lis3 = spi_get_drvdata(spi); 104 104 105 - if (!lis3->pdata->wakeup_flags) 105 + if (!lis3->pdata || !lis3->pdata->wakeup_flags) 106 106 lis3lv02d_poweron(lis3); 107 107 108 108 return 0;
+11 -10
drivers/hwmon/lm95241.c
··· 91 91 struct lm95241_data { 92 92 struct device *hwmon_dev; 93 93 struct mutex update_lock; 94 - unsigned long last_updated, rate; /* in jiffies */ 94 + unsigned long last_updated, interval; /* in jiffies */ 95 95 char valid; /* zero until following fields are valid */ 96 96 /* registers values */ 97 97 u8 local_h, local_l; /* local */ ··· 114 114 show_temp(remote1); 115 115 show_temp(remote2); 116 116 117 - static ssize_t show_rate(struct device *dev, struct device_attribute *attr, 117 + static ssize_t show_interval(struct device *dev, struct device_attribute *attr, 118 118 char *buf) 119 119 { 120 120 struct lm95241_data *data = lm95241_update_device(dev); 121 121 122 - snprintf(buf, PAGE_SIZE - 1, "%lu\n", 1000 * data->rate / HZ); 122 + snprintf(buf, PAGE_SIZE - 1, "%lu\n", 1000 * data->interval / HZ); 123 123 return strlen(buf); 124 124 } 125 125 126 - static ssize_t set_rate(struct device *dev, struct device_attribute *attr, 126 + static ssize_t set_interval(struct device *dev, struct device_attribute *attr, 127 127 const char *buf, size_t count) 128 128 { 129 129 struct i2c_client *client = to_i2c_client(dev); 130 130 struct lm95241_data *data = i2c_get_clientdata(client); 131 131 132 - strict_strtol(buf, 10, &data->rate); 133 - data->rate = data->rate * HZ / 1000; 132 + strict_strtol(buf, 10, &data->interval); 133 + data->interval = data->interval * HZ / 1000; 134 134 135 135 return count; 136 136 } ··· 286 286 static DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_min2, set_min2); 287 287 static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_max1, set_max1); 288 288 static DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_max2, set_max2); 289 - static DEVICE_ATTR(rate, S_IWUSR | S_IRUGO, show_rate, set_rate); 289 + static DEVICE_ATTR(update_interval, S_IWUSR | S_IRUGO, show_interval, 290 + set_interval); 290 291 291 292 static struct attribute *lm95241_attributes[] = { 292 293 &dev_attr_temp1_input.attr, ··· 299 298 &dev_attr_temp3_min.attr, 300 299 &dev_attr_temp2_max.attr, 301 300 &dev_attr_temp3_max.attr, 302 - &dev_attr_rate.attr, 301 + &dev_attr_update_interval.attr, 303 302 NULL 304 303 }; 305 304 ··· 377 376 { 378 377 struct lm95241_data *data = i2c_get_clientdata(client); 379 378 380 - data->rate = HZ; /* 1 sec default */ 379 + data->interval = HZ; /* 1 sec default */ 381 380 data->valid = 0; 382 381 data->config = CFG_CR0076; 383 382 data->model = 0; ··· 411 410 412 411 mutex_lock(&data->update_lock); 413 412 414 - if (time_after(jiffies, data->last_updated + data->rate) || 413 + if (time_after(jiffies, data->last_updated + data->interval) || 415 414 !data->valid) { 416 415 dev_dbg(&client->dev, "Updating lm95241 data.\n"); 417 416 data->local_h =
+1
drivers/hwmon/w83627ehf.c
··· 127 127 static inline void 128 128 superio_exit(int ioreg) 129 129 { 130 + outb(0xaa, ioreg); 130 131 outb(0x02, ioreg); 131 132 outb(0x02, ioreg + 1); 132 133 }