pc87360 convert fan-sensor dev-attr
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest8 of 23 patches 0 repliesNew
8 of 23 patches are in this archive. The cover letter announces 23.
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 7/23 | pc87360 pwm use attr->indexdrivers/ | +3 | 0 replies | |
| 8/23 | pc87360 temp dev-attrs -->drivers/ | +41 | 0 replies | |
| 9/23 | pc87360 temp use attr->indexdrivers/ | +11 | 0 replies | |
| 10/23 | pc87360 thermistor dev-attr -->drivers/ | +41 | 0 replies | |
| 11/23 | pc87360 thermistor use attr->indexdrivers/ | +14 | 0 replies | |
| 12/23 | pc87360 rename thermistor get-setdrivers/ | +13 | 0 replies | |
| 13/23 | pc87360 convert voltage dev-attrdrivers/ | +62 | 0 replies | |
| 16/23 | pc87360 convert thermistor dev-attrdrivers/ | +85 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [lm-sensors] [patchset 0/23] pc87360 convert pww dev-attr get-set
convert pww dev-attr get-set macros to functions.
[jimc@harpo pset]$ diffstat 10-pwm-demacro
pc87360.c | 62 ++++++++++++++++++++++++++++++++------------------------------ 1 files changed, 32 insertions(+), 30 deletions(-)
Signed-off-by Jim Cromie <[email protected]>
-------------- next part --------------
drivers/hwmon/pc87360.c +32 -30
@@ -323,37 +323,39 @@ show_and_set_fan(1) show_and_set_fan(2) show_and_set_fan(3) -#define show_and_set_pwm (offset) \ -static ssize_t show_pwm##offset(struct device *dev, struct device_attribute *devattr, char *buf) \ -{ \ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); \ - struct pc87360_data *data = pc87360_update_device(dev); \ - return sprintf(buf, "%u\n", \ - PWM_FROM_REG(data->pwm[attr->index-1], \ - FAN_CONFIG_INVERT(data->fan_conf, \ - offset-1))); \ -} \ -static ssize_t set_pwm##offset(struct device *dev, struct device_attribute *devattr, const char *buf, \ - size_t count) \ -{ \ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); \ - struct i2c_client *client = to_i2c_client(dev); \ - struct pc87360_data *data = i2c_get_clientdata(client); \ - long val = simple_strtol(buf, NULL, 10); \ - \ - down(&data->update_lock); \ - data->pwm[attr->index-1] = PWM_TO_REG(val, \ - FAN_CONFIG_INVERT(data->fan_conf, offset-1)); \ - pc87360_write_value(data, LD_FAN, NO_BANK, PC87360_REG_PWM(offset-1), \ - data->pwm[attr->index-1]); \ - up(&data->update_lock); \ - return count; \ -} \ +static ssize_t show_pwm (struct device *dev,struct device_attribute *devattr,char *buf) +{ +struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr); +struct pc87360_data *data =pc87360_update_device (dev); +return sprintf (buf,"%u\n" , +PWM_FROM_REG (data->pwm[attr->index-1 ], +FAN_CONFIG_INVERT (data->fan_conf, + attr->index-1 ))); +} +static ssize_t set_pwm (struct device *dev,struct device_attribute *devattr,const char *buf, +size_t count) +{ +struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr); +struct i2c_client *client =to_i2c_client (dev); +struct pc87360_data *data =i2c_get_clientdata (client); +long val =simple_strtol (buf,NULL ,10 ); + +down (&data->update_lock); + data->pwm[attr->index-1 ] =PWM_TO_REG (val, +FAN_CONFIG_INVERT (data->fan_conf, attr->index-1 )); +pc87360_write_value (data,LD_FAN ,NO_BANK ,PC87360_REG_PWM (attr->index-1 ), + data->pwm[attr->index-1 ]); +up (&data->update_lock); +return count; +} + +#define declare_pwm_sdas (offset) \ static SENSOR_DEVICE_ATTR(pwm##offset, S_IWUSR | S_IRUGO, \ - show_pwm##offset, set_pwm##offset, offset); -show_and_set_pwm(1) -show_and_set_pwm(2) -show_and_set_pwm(3) + show_pwm, set_pwm, offset) + +declare_pwm_sdas (1 ); +declare_pwm_sdas (2 ); +declare_pwm_sdas (3 );static ssize_t show_in_input (struct device *dev,struct device_attribute *devattr,char *buf) {