diff options
Diffstat (limited to 'drivers/i2c/chips')
32 files changed, 647 insertions, 689 deletions
diff --git a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c index 9c59a370b6d..9058c395671 100644 --- a/drivers/i2c/chips/adm1021.c +++ b/drivers/i2c/chips/adm1021.c @@ -137,7 +137,7 @@ static struct i2c_driver adm1021_driver = { }; #define show(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct adm1021_data *data = adm1021_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ @@ -150,7 +150,7 @@ show(remote_temp_hyst); show(remote_temp_input); #define show2(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct adm1021_data *data = adm1021_update_device(dev); \ return sprintf(buf, "%d\n", data->value); \ @@ -159,7 +159,7 @@ show2(alarms); show2(die_code); #define set(value, reg) \ -static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ struct adm1021_data *data = i2c_get_clientdata(client); \ diff --git a/drivers/i2c/chips/adm1025.c b/drivers/i2c/chips/adm1025.c index e0771a3d05c..111f0c86c93 100644 --- a/drivers/i2c/chips/adm1025.c +++ b/drivers/i2c/chips/adm1025.c @@ -153,19 +153,19 @@ struct adm1025_data { */ #define show_in(offset) \ -static ssize_t show_in##offset(struct device *dev, char *buf) \ +static ssize_t show_in##offset(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct adm1025_data *data = adm1025_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ in_scale[offset])); \ } \ -static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct adm1025_data *data = adm1025_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ in_scale[offset])); \ } \ -static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct adm1025_data *data = adm1025_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ @@ -180,17 +180,17 @@ show_in(4); show_in(5); #define show_temp(offset) \ -static ssize_t show_temp##offset(struct device *dev, char *buf) \ +static ssize_t show_temp##offset(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct adm1025_data *data = adm1025_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ } \ -static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct adm1025_data *data = adm1025_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ } \ -static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct adm1025_data *data = adm1025_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \ @@ -200,7 +200,7 @@ show_temp(1); show_temp(2); #define set_in(offset) \ -static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ +static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -214,7 +214,7 @@ static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ up(&data->update_lock); \ return count; \ } \ -static ssize_t set_in##offset##_max(struct device *dev, const char *buf, \ +static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -240,7 +240,7 @@ set_in(4); set_in(5); #define set_temp(offset) \ -static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ +static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -254,7 +254,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ up(&data->update_lock); \ return count; \ } \ -static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ +static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -275,26 +275,26 @@ static DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ set_temp(1); set_temp(2); -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1025_data *data = adm1025_update_device(dev); return sprintf(buf, "%u\n", data->alarms); } static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); -static ssize_t show_vid(struct device *dev, char *buf) +static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1025_data *data = adm1025_update_device(dev); return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); } static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL); -static ssize_t show_vrm(struct device *dev, char *buf) +static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1025_data *data = adm1025_update_device(dev); return sprintf(buf, "%u\n", data->vrm); } -static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) +static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct adm1025_data *data = i2c_get_clientdata(client); diff --git a/drivers/i2c/chips/adm1026.c b/drivers/i2c/chips/adm1026.c index 39e2f4a900b..b15fafe8f11 100644 --- a/drivers/i2c/chips/adm1026.c +++ b/drivers/i2c/chips/adm1026.c @@ -30,6 +30,7 @@ #include <linux/jiffies.h> #include <linux/i2c.h> #include <linux/i2c-sensor.h> +#include <linux/i2c-sysfs.h> #include <linux/i2c-vid.h> /* Addresses to scan */ @@ -711,19 +712,27 @@ static struct adm1026_data *adm1026_update_device(struct device *dev) return data; } -static ssize_t show_in(struct device *dev, char *buf, int nr) +static ssize_t show_in(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in[nr])); } -static ssize_t show_in_min(struct device *dev, char *buf, int nr) +static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr])); } -static ssize_t set_in_min(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); @@ -734,14 +743,19 @@ static ssize_t set_in_min(struct device *dev, const char *buf, up(&data->update_lock); return count; } -static ssize_t show_in_max(struct device *dev, char *buf, int nr) +static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr])); } -static ssize_t set_in_max(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); @@ -753,34 +767,13 @@ static ssize_t set_in_max(struct device *dev, const char *buf, return count; } -#define in_reg(offset) \ -static ssize_t show_in##offset (struct device *dev, char *buf) \ -{ \ - return show_in(dev, buf, offset); \ -} \ -static ssize_t show_in##offset##_min (struct device *dev, char *buf) \ -{ \ - return show_in_min(dev, buf, offset); \ -} \ -static ssize_t set_in##offset##_min (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_in_min(dev, buf, count, offset); \ -} \ -static ssize_t show_in##offset##_max (struct device *dev, char *buf) \ -{ \ - return show_in_max(dev, buf, offset); \ -} \ -static ssize_t set_in##offset##_max (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_in_max(dev, buf, count, offset); \ -} \ -static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); \ -static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ - show_in##offset##_min, set_in##offset##_min); \ -static DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ - show_in##offset##_max, set_in##offset##_max); +#define in_reg(offset) \ +static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in, \ + NULL, offset); \ +static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ + show_in_min, set_in_min, offset); \ +static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ + show_in_max, set_in_max, offset); in_reg(0); @@ -800,19 +793,19 @@ in_reg(13); in_reg(14); in_reg(15); -static ssize_t show_in16(struct device *dev, char *buf) +static ssize_t show_in16(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in[16]) - NEG12_OFFSET); } -static ssize_t show_in16_min(struct device *dev, char *buf) +static ssize_t show_in16_min(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_min[16]) - NEG12_OFFSET); } -static ssize_t set_in16_min(struct device *dev, const char *buf, size_t count) +static ssize_t set_in16_min(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); @@ -824,13 +817,13 @@ static ssize_t set_in16_min(struct device *dev, const char *buf, size_t count) up(&data->update_lock); return count; } -static ssize_t show_in16_max(struct device *dev, char *buf) +static ssize_t show_in16_max(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_max[16]) - NEG12_OFFSET); } -static ssize_t set_in16_max(struct device *dev, const char *buf, size_t count) +static ssize_t set_in16_max(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); @@ -843,30 +836,38 @@ static ssize_t set_in16_max(struct device *dev, const char *buf, size_t count) return count; } -static DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL); -static DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, set_in16_min); -static DEVICE_ATTR(in16_max, S_IRUGO | S_IWUSR, show_in16_max, set_in16_max); +static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL, 16); +static SENSOR_DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, set_in16_min, 16); +static SENSOR_DEVICE_ATTR(in16_max, S_IRUGO | S_IWUSR, show_in16_max, set_in16_max, 16); /* Now add fan read/write functions */ -static ssize_t show_fan(struct device *dev, char *buf, int nr) +static ssize_t show_fan(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr], data->fan_div[nr])); } -static ssize_t show_fan_min(struct device *dev, char *buf, int nr) +static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr], data->fan_div[nr])); } -static ssize_t set_fan_min(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); @@ -879,23 +880,11 @@ static ssize_t set_fan_min(struct device *dev, const char *buf, return count; } -#define fan_offset(offset) \ -static ssize_t show_fan_##offset (struct device *dev, char *buf) \ -{ \ - return show_fan(dev, buf, offset - 1); \ -} \ -static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ -{ \ - return show_fan_min(dev, buf, offset - 1); \ -} \ -static ssize_t set_fan_##offset##_min (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_fan_min(dev, buf, count, offset - 1); \ -} \ -static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL); \ -static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ - show_fan_##offset##_min, set_fan_##offset##_min); +#define fan_offset(offset) \ +static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan, NULL, \ + offset - 1); \ +static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ + show_fan_min, set_fan_min, offset - 1); fan_offset(1); fan_offset(2); @@ -926,14 +915,19 @@ static void fixup_fan_min(struct device *dev, int fan, int old_div) } /* Now add fan_div read/write functions */ -static ssize_t show_fan_div(struct device *dev, char *buf, int nr) +static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", data->fan_div[nr]); } -static ssize_t set_fan_div(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val,orig_div,new_div,shift; @@ -967,17 +961,8 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, } #define fan_offset_div(offset) \ -static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ -{ \ - return show_fan_div(dev, buf, offset - 1); \ -} \ -static ssize_t set_fan_##offset##_div (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_fan_div(dev, buf, count, offset - 1); \ -} \ -static DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ - show_fan_##offset##_div, set_fan_##offset##_div); +static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ + show_fan_div, set_fan_div, offset - 1); fan_offset_div(1); fan_offset_div(2); @@ -989,19 +974,27 @@ fan_offset_div(7); fan_offset_div(8); /* Temps */ -static ssize_t show_temp(struct device *dev, char *buf, int nr) +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp[nr])); } -static ssize_t show_temp_min(struct device *dev, char *buf, int nr) +static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr])); } -static ssize_t set_temp_min(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); @@ -1013,14 +1006,19 @@ static ssize_t set_temp_min(struct device *dev, const char *buf, up(&data->update_lock); return count; } -static ssize_t show_temp_max(struct device *dev, char *buf, int nr) +static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, + char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr])); } -static ssize_t set_temp_max(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); @@ -1032,48 +1030,34 @@ static ssize_t set_temp_max(struct device *dev, const char *buf, up(&data->update_lock); return count; } -#define temp_reg(offset) \ -static ssize_t show_temp_##offset (struct device *dev, char *buf) \ -{ \ - return show_temp(dev, buf, offset - 1); \ -} \ -static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ -{ \ - return show_temp_min(dev, buf, offset - 1); \ -} \ -static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \ -{ \ - return show_temp_max(dev, buf, offset - 1); \ -} \ -static ssize_t set_temp_##offset##_min (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_temp_min(dev, buf, count, offset - 1); \ -} \ -static ssize_t set_temp_##offset##_max (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_temp_max(dev, buf, count, offset - 1); \ -} \ -static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp_##offset, NULL); \ -static DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ - show_temp_##offset##_min, set_temp_##offset##_min); \ -static DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ - show_temp_##offset##_max, set_temp_##offset##_max); + +#define temp_reg(offset) \ +static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \ + NULL, offset - 1); \ +static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ + show_temp_min, set_temp_min, offset - 1); \ +static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ + show_temp_max, set_temp_max, offset - 1); temp_reg(1); temp_reg(2); temp_reg(3); -static ssize_t show_temp_offset(struct device *dev, char *buf, int nr) +static ssize_t show_temp_offset(struct device *dev, + struct device_attribute *attr, char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_offset[nr])); } -static ssize_t set_temp_offset(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_temp_offset(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); @@ -1086,46 +1070,45 @@ static ssize_t set_temp_offset(struct device *dev, const char *buf, return count; } -#define temp_offset_reg(offset) \ -static ssize_t show_temp_##offset##_offset (struct device *dev, char *buf) \ -{ \ - return show_temp_offset(dev, buf, offset - 1); \ -} \ -static ssize_t set_temp_##offset##_offset (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_temp_offset(dev, buf, count, offset - 1); \ -} \ -static DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \ - show_temp_##offset##_offset, set_temp_##offset##_offset); +#define temp_offset_reg(offset) \ +static SENSOR_DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \ + show_temp_offset, set_temp_offset, offset - 1); temp_offset_reg(1); temp_offset_reg(2); temp_offset_reg(3); -static ssize_t show_temp_auto_point1_temp_hyst(struct device *dev, char *buf, - int nr) +static ssize_t show_temp_auto_point1_temp_hyst(struct device *dev, + struct device_attribute *attr, char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", TEMP_FROM_REG( ADM1026_FAN_ACTIVATION_TEMP_HYST + data->temp_tmin[nr])); } -static ssize_t show_temp_auto_point2_temp(struct device *dev, char *buf, - int nr) +static ssize_t show_temp_auto_point2_temp(struct device *dev, + struct device_attribute *attr, char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr] + ADM1026_FAN_CONTROL_TEMP_RANGE)); } -static ssize_t show_temp_auto_point1_temp(struct device *dev, char *buf, - int nr) +static ssize_t show_temp_auto_point1_temp(struct device *dev, + struct device_attribute *attr, char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr])); } -static ssize_t set_temp_auto_point1_temp(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_temp_auto_point1_temp(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); @@ -1138,46 +1121,27 @@ static ssize_t set_temp_auto_point1_temp(struct device *dev, const char *buf, return count; } -#define temp_auto_point(offset) \ -static ssize_t show_temp##offset##_auto_point1_temp (struct device *dev, \ - char *buf) \ -{ \ - return show_temp_auto_point1_temp(dev, buf, offset - 1); \ -} \ -static ssize_t set_temp##offset##_auto_point1_temp (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_temp_auto_point1_temp(dev, buf, count, offset - 1); \ -} \ -static ssize_t show_temp##offset##_auto_point1_temp_hyst (struct device \ - *dev, char *buf) \ -{ \ - return show_temp_auto_point1_temp_hyst(dev, buf, offset - 1); \ -} \ -static ssize_t show_temp##offset##_auto_point2_temp (struct device *dev, \ - char *buf) \ -{ \ - return show_temp_auto_point2_temp(dev, buf, offset - 1); \ -} \ -static DEVICE_ATTR(temp##offset##_auto_point1_temp, S_IRUGO | S_IWUSR, \ - show_temp##offset##_auto_point1_temp, \ - set_temp##offset##_auto_point1_temp); \ -static DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO, \ - show_temp##offset##_auto_point1_temp_hyst, NULL); \ -static DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \ - show_temp##offset##_auto_point2_temp, NULL); +#define temp_auto_point(offset) \ +static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp, S_IRUGO | S_IWUSR, \ + show_temp_auto_point1_temp, set_temp_auto_point1_temp, \ + offset - 1); \ +static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO, \ + show_temp_auto_point1_temp_hyst, NULL, offset - 1); \ +static SENSOR_DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \ + show_temp_auto_point2_temp, NULL, offset - 1); temp_auto_point(1); temp_auto_point(2); temp_auto_point(3); -static ssize_t show_temp_crit_enable(struct device *dev, char *buf) +static ssize_t show_temp_crit_enable(struct device *dev, + struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", (data->config1 & CFG1_THERM_HOT) >> 4); } -static ssize_t set_temp_crit_enable(struct device *dev, const char *buf, - size_t count) +static ssize_t set_temp_crit_enable(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); @@ -1193,24 +1157,27 @@ static ssize_t set_temp_crit_enable(struct device *dev, const char *buf, return count; } -static DEVICE_ATTR(temp1_crit_enable, S_IRUGO | S_IWUSR, - show_temp_crit_enable, set_temp_crit_enable); - -static DEVICE_ATTR(temp2_crit_enable, S_IRUGO | S_IWUSR, - show_temp_crit_enable, set_temp_crit_enable); - -static DEVICE_ATTR(temp3_crit_enable, S_IRUGO | S_IWUSR, +#define temp_crit_enable(offset) \ +static DEVICE_ATTR(temp##offset##_crit_enable, S_IRUGO | S_IWUSR, \ show_temp_crit_enable, set_temp_crit_enable); +temp_crit_enable(1); +temp_crit_enable(2); +temp_crit_enable(3); -static ssize_t show_temp_crit(struct device *dev, char *buf, int nr) +static ssize_t show_temp_crit(struct device *dev, + struct device_attribute *attr, char *buf) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_crit[nr])); } -static ssize_t set_temp_crit(struct device *dev, const char *buf, - size_t count, int nr) +static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; struct i2c_client *client = to_i2c_client(dev); struct adm1026_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); @@ -1223,29 +1190,20 @@ static ssize_t set_temp_crit(struct device *dev, const char *buf, return count; } -#define temp_crit_reg(offset) \ -static ssize_t show_temp_##offset##_crit (struct device *dev, char *buf) \ -{ \ - return show_temp_crit(dev, buf, offset - 1); \ -} \ -static ssize_t set_temp_##offset##_crit (struct device *dev, \ - const char *buf, size_t count) \ -{ \ - return set_temp_crit(dev, buf, count, offset - 1); \ -} \ -static DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \ - show_temp_##offset##_crit, set_temp_##offset##_crit); +#define temp_crit_reg(offset) \ +static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \ + show_temp_crit, set_temp_crit, offset - 1); temp_crit_reg(1); temp_crit_reg(2); temp_crit_reg(3); -static ssize_t show_analog_out_reg(struct device *dev, char *buf) +static ssize_t show_analog_out_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", DAC_FROM_REG(data->analog_out)); } -static ssize_t set_analog_out_reg(struct device *dev, const char *buf, +static ssize_t set_analog_out_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -1262,7 +1220,7 @@ static ssize_t set_analog_out_reg(struct device *dev, const char *buf, static DEVICE_ATTR(analog_out, S_IRUGO | S_IWUSR, show_analog_out_reg, set_analog_out_reg); -static ssize_t show_vid_reg(struct device *dev, char *buf) +static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm)); @@ -1270,12 +1228,12 @@ static ssize_t show_vid_reg(struct device *dev, char *buf) static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL); -static ssize_t show_vrm_reg(struct device *dev, char *buf) +static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", data->vrm); } -static ssize_t store_vrm_reg(struct device *dev, const char *buf, +static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -1287,7 +1245,7 @@ static ssize_t store_vrm_reg(struct device *dev, const char *buf, static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); -static ssize_t show_alarms_reg(struct device *dev, char *buf) +static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf, "%ld\n", (long) (data->alarms)); @@ -1295,12 +1253,12 @@ static ssize_t show_alarms_reg(struct device *dev, char *buf) static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); -static ssize_t show_alarm_mask(struct device *dev, char *buf) +static ssize_t show_alarm_mask(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%ld\n", data->alarm_mask); } -static ssize_t set_alarm_mask(struct device *dev, const char *buf, +static ssize_t set_alarm_mask(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -1331,12 +1289,12 @@ static DEVICE_ATTR(alarm_mask, S_IRUGO | S_IWUSR, show_alarm_mask, set_alarm_mask); -static ssize_t show_gpio(struct device *dev, char *buf) +static ssize_t show_gpio(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%ld\n", data->gpio); } -static ssize_t set_gpio(struct device *dev, const char *buf, +static ssize_t set_gpio(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -1359,12 +1317,12 @@ static ssize_t set_gpio(struct device *dev, const char *buf, static DEVICE_ATTR(gpio, S_IRUGO | S_IWUSR, show_gpio, set_gpio); -static ssize_t show_gpio_mask(struct device *dev, char *buf) +static ssize_t show_gpio_mask(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%ld\n", data->gpio_mask); } -static ssize_t set_gpio_mask(struct device *dev, const char *buf, +static ssize_t set_gpio_mask(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -1386,12 +1344,12 @@ static ssize_t set_gpio_mask(struct device *dev, const char *buf, static DEVICE_ATTR(gpio_mask, S_IRUGO | S_IWUSR, show_gpio_mask, set_gpio_mask); -static ssize_t show_pwm_reg(struct device *dev, char *buf) +static ssize_t show_pwm_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm1.pwm)); } -static ssize_t set_pwm_reg(struct device *dev, const char *buf, +static ssize_t set_pwm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -1407,12 +1365,12 @@ static ssize_t set_pwm_reg(struct device *dev, const char *buf, } return count; } -static ssize_t show_auto_pwm_min(struct device *dev, char *buf) +static ssize_t show_auto_pwm_min(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", data->pwm1.auto_pwm_min); } -static ssize_t set_auto_pwm_min(struct device *dev, const char *buf, +static ssize_t set_auto_pwm_min(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -1429,16 +1387,16 @@ static ssize_t set_auto_pwm_min(struct device *dev, const char *buf, up(&data->update_lock); return count; } -static ssize_t show_auto_pwm_max(struct device *dev, char *buf) +static ssize_t show_auto_pwm_max(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf,"%d\n", ADM1026_PWM_MAX); } -static ssize_t show_pwm_enable(struct device *dev, char *buf) +static ssize_t show_pwm_enable(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", data->pwm1.enable); } -static ssize_t set_pwm_enable(struct device *dev, const char *buf, +static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -1597,114 +1555,114 @@ int adm1026_detect(struct i2c_adapter *adapter, int address, adm1026_init_client(new_client); /* Register sysfs hooks */ - device_create_file(&new_client->dev, &dev_attr_in0_input); - device_create_file(&new_client->dev, &dev_attr_in0_max); - device_create_file(&new_client->dev, &dev_attr_in0_min); - device_create_file(&new_client->dev, &dev_attr_in1_input); - device_create_file(&new_client->dev, &dev_attr_in1_max); - device_create_file(&new_client->dev, &dev_attr_in1_min); - device_create_file(&new_client->dev, &dev_attr_in2_input); - device_create_file(&new_client->dev, &dev_attr_in2_max); - device_create_file(&new_client->dev, &dev_attr_in2_min); - device_create_file(&new_client->dev, &dev_attr_in3_input); - device_create_file(&new_client->dev, &dev_attr_in3_max); - device_create_file(&new_client->dev, &dev_attr_in3_min); - device_create_file(&new_client->dev, &dev_attr_in4_input); - device_create_file(&new_client->dev, &dev_attr_in4_max); - device_create_file(&new_client->dev, &dev_attr_in4_min); - device_create_file(&new_client->dev, &dev_attr_in5_input); - device_create_file(&new_client->dev, &dev_attr_in5_max); - device_create_file(&new_client->dev, &dev_attr_in5_min); - device_create_file(&new_client->dev, &dev_attr_in6_input); - device_create_file(&new_client->dev, &dev_attr_in6_max); - device_create_file(&new_client->dev, &dev_attr_in6_min); - device_create_file(&new_client->dev, &dev_attr_in7_input); - device_create_file(&new_client->dev, &dev_attr_in7_max); - device_create_file(&new_client->dev, &dev_attr_in7_min); - device_create_file(&new_client->dev, &dev_attr_in8_input); - device_create_file(&new_client->dev, &dev_attr_in8_max); - device_create_file(&new_client->dev, &dev_attr_in8_min); - device_create_file(&new_client->dev, &dev_attr_in9_input); - device_create_file(&new_client->dev, &dev_attr_in9_max); - device_create_file(&new_client->dev, &dev_attr_in9_min); - device_create_file(&new_client->dev, &dev_attr_in10_input); - device_create_file(&new_client->dev, &dev_attr_in10_max); - device_create_file(&new_client->dev, &dev_attr_in10_min); - device_create_file(&new_client->dev, &dev_attr_in11_input); - device_create_file(&new_client->dev, &dev_attr_in11_max); - device_create_file(&new_client->dev, &dev_attr_in11_min); - device_create_file(&new_client->dev, &dev_attr_in12_input); - device_create_file(&new_client->dev, &dev_attr_in12_max); - device_create_file(&new_client->dev, &dev_attr_in12_min); - device_create_file(&new_client->dev, &dev_attr_in13_input); - device_create_file(&new_client->dev, &dev_attr_in13_max); - device_create_file(&new_client->dev, &dev_attr_in13_min); - device_create_file(&new_client->dev, &dev_attr_in14_input); - device_create_file(&new_client->dev, &dev_attr_in14_max); - device_create_file(&new_client->dev, &dev_attr_in14_min); - device_create_file(&new_client->dev, &dev_attr_in15_input); - device_create_file(&new_client->dev, &dev_attr_in15_max); - device_create_file(&new_client->dev, &dev_attr_in15_min); - device_create_file(&new_client->dev, &dev_attr_in16_input); - device_create_file(&new_client->dev, &dev_attr_in16_max); - device_create_file(&new_client->dev, &dev_attr_in16_min); - device_create_file(&new_client->dev, &dev_attr_fan1_input); - device_create_file(&new_client->dev, &dev_attr_fan1_div); - device_create_file(&new_client->dev, &dev_attr_fan1_min); - device_create_file(&new_client->dev, &dev_attr_fan2_input); - device_create_file(&new_client->dev, &dev_attr_fan2_div); - device_create_file(&new_client->dev, &dev_attr_fan2_min); - device_create_file(&new_client->dev, &dev_attr_fan3_input); - device_create_file(&new_client->dev, &dev_attr_fan3_div); - device_create_file(&new_client->dev, &dev_attr_fan3_min); - device_create_file(&new_client->dev, &dev_attr_fan4_input); - device_create_file(&new_client->dev, &dev_attr_fan4_div); - device_create_file(&new_client->dev, &dev_attr_fan4_min); - device_create_file(&new_client->dev, &dev_attr_fan5_input); - device_create_file(&new_client->dev, &dev_attr_fan5_div); - device_create_file(&new_client->dev, &dev_attr_fan5_min); - device_create_file(&new_client->dev, &dev_attr_fan6_input); - device_create_file(&new_client->dev, &dev_attr_fan6_div); - device_create_file(&new_client->dev, &dev_attr_fan6_min); - device_create_file(&new_client->dev, &dev_attr_fan7_input); - device_create_file(&new_client->dev, &dev_attr_fan7_div); - device_create_file(&new_client->dev, &dev_attr_fan7_min); - device_create_file(&new_client->dev, &dev_attr_fan8_input); - device_create_file(&new_client->dev, &dev_attr_fan8_div); - device_create_file(&new_client->dev, &dev_attr_fan8_min); - device_create_file(&new_client->dev, &dev_attr_temp1_input); - device_create_file(&new_client->dev, &dev_attr_temp1_max); - device_create_file(&new_client->dev, &dev_attr_temp1_min); - device_create_file(&new_client->dev, &dev_attr_temp2_input); - device_create_file(&new_client->dev, &dev_attr_temp2_max); - device_create_file(&new_client->dev, &dev_attr_temp2_min); - device_create_file(&new_client->dev, &dev_attr_temp3_input); - device_create_file(&new_client->dev, &dev_attr_temp3_max); - device_create_file(&new_client->dev, &dev_attr_temp3_min); - device_create_file(&new_client->dev, &dev_attr_temp1_offset); - device_create_file(&new_client->dev, &dev_attr_temp2_offset); - device_create_file(&new_client->dev, &dev_attr_temp3_offset); + device_create_file(&new_client->dev, &sensor_dev_attr_in0_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in0_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in0_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in1_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in1_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in1_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in2_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in2_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in2_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in3_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in3_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in3_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in4_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in4_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in4_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in5_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in5_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in5_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in6_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in6_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in6_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in7_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in7_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in7_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in8_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in8_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in8_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in9_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in9_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in9_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in10_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in10_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in10_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in11_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in11_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in11_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in12_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in12_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in12_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in13_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in13_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in13_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in14_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in14_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in14_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in15_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in15_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in15_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in16_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in16_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_in16_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan1_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan1_div.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan1_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan2_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan2_div.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan2_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan3_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan3_div.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan3_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan4_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan4_div.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan4_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan5_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan5_div.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan5_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan6_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan6_div.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan6_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan7_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan7_div.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan7_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan8_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan8_div.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_fan8_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp1_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp1_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp1_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp2_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp2_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp2_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp3_input.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp3_max.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp3_min.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp1_offset.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp2_offset.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp3_offset.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp1_auto_point1_temp); + &sensor_dev_attr_temp1_auto_point1_temp.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp2_auto_point1_temp); + &sensor_dev_attr_temp2_auto_point1_temp.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp3_auto_point1_temp); + &sensor_dev_attr_temp3_auto_point1_temp.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp1_auto_point1_temp_hyst); + &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp2_auto_point1_temp_hyst); + &sensor_dev_attr_temp2_auto_point1_temp_hyst.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp3_auto_point1_temp_hyst); + &sensor_dev_attr_temp3_auto_point1_temp_hyst.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp1_auto_point2_temp); + &sensor_dev_attr_temp1_auto_point2_temp.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp2_auto_point2_temp); + &sensor_dev_attr_temp2_auto_point2_temp.dev_attr); device_create_file(&new_client->dev, - &dev_attr_temp3_auto_point2_temp); - device_create_file(&new_client->dev, &dev_attr_temp1_crit); - device_create_file(&new_client->dev, &dev_attr_temp2_crit); - device_create_file(&new_client->dev, &dev_attr_temp3_crit); + &sensor_dev_attr_temp3_auto_point2_temp.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp1_crit.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp2_crit.dev_attr); + device_create_file(&new_client->dev, &sensor_dev_attr_temp3_crit.dev_attr); device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable); device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable); device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable); diff --git a/drivers/i2c/chips/adm1031.c b/drivers/i2c/chips/adm1031.c index d4385a23f79..2163dba467c 100644 --- a/drivers/i2c/chips/adm1031.c +++ b/drivers/i2c/chips/adm1031.c @@ -292,11 +292,11 @@ set_fan_auto_channel(struct device *dev, const char *buf, size_t count, int nr) } #define fan_auto_channel_offset(offset) \ -static ssize_t show_fan_auto_channel_##offset (struct device *dev, char *buf) \ +static ssize_t show_fan_auto_channel_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_auto_channel(dev, buf, offset - 1); \ } \ -static ssize_t set_fan_auto_channel_##offset (struct device *dev, \ +static ssize_t set_fan_auto_channel_##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_auto_channel(dev, buf, count, offset - 1); \ @@ -357,24 +357,24 @@ set_auto_temp_max(struct device *dev, const char *buf, size_t count, int nr) } #define auto_temp_reg(offset) \ -static ssize_t show_auto_temp_##offset##_off (struct device *dev, char *buf) \ +static ssize_t show_auto_temp_##offset##_off (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_auto_temp_off(dev, buf, offset - 1); \ } \ -static ssize_t show_auto_temp_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_auto_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_auto_temp_min(dev, buf, offset - 1); \ } \ -static ssize_t show_auto_temp_##offset##_max (struct device *dev, char *buf) \ +static ssize_t show_auto_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_auto_temp_max(dev, buf, offset - 1); \ } \ -static ssize_t set_auto_temp_##offset##_min (struct device *dev, \ +static ssize_t set_auto_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_auto_temp_min(dev, buf, count, offset - 1); \ } \ -static ssize_t set_auto_temp_##offset##_max (struct device *dev, \ +static ssize_t set_auto_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_auto_temp_max(dev, buf, count, offset - 1); \ @@ -421,11 +421,11 @@ set_pwm(struct device *dev, const char *buf, size_t count, int nr) } #define pwm_reg(offset) \ -static ssize_t show_pwm_##offset (struct device *dev, char *buf) \ +static ssize_t show_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_pwm(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm_##offset (struct device *dev, \ +static ssize_t set_pwm_##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm(dev, buf, count, offset - 1); \ @@ -557,24 +557,24 @@ set_fan_div(struct device *dev, const char *buf, size_t count, int nr) } #define fan_offset(offset) \ -static ssize_t show_fan_##offset (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_div(dev, buf, offset - 1); \ } \ -static ssize_t set_fan_##offset##_min (struct device *dev, \ +static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_min(dev, buf, count, offset - 1); \ } \ -static ssize_t set_fan_##offset##_div (struct device *dev, \ +static ssize_t set_fan_##offset##_div (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_div(dev, buf, count, offset - 1); \ @@ -667,33 +667,33 @@ set_temp_crit(struct device *dev, const char *buf, size_t count, int nr) } #define temp_reg(offset) \ -static ssize_t show_temp_##offset (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp(dev, buf, offset - 1); \ } \ -static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_min(dev, buf, offset - 1); \ } \ -static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_max(dev, buf, offset - 1); \ } \ -static ssize_t show_temp_##offset##_crit (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset##_crit (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_crit(dev, buf, offset - 1); \ } \ -static ssize_t set_temp_##offset##_min (struct device *dev, \ +static ssize_t set_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_min(dev, buf, count, offset - 1); \ } \ -static ssize_t set_temp_##offset##_max (struct device *dev, \ +static ssize_t set_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_max(dev, buf, count, offset - 1); \ } \ -static ssize_t set_temp_##offset##_crit (struct device *dev, \ +static ssize_t set_temp_##offset##_crit (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_crit(dev, buf, count, offset - 1); \ @@ -712,7 +712,7 @@ temp_reg(2); temp_reg(3); /* Alarms */ -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct adm1031_data *data = adm1031_update_device(dev); return sprintf(buf, "%d\n", data->alarm); diff --git a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c index 7f899002bc5..4a47b4493e3 100644 --- a/drivers/i2c/chips/asb100.c +++ b/drivers/i2c/chips/asb100.c @@ -260,28 +260,28 @@ set_in_reg(MAX, max) #define sysfs_in(offset) \ static ssize_t \ - show_in##offset (struct device *dev, char *buf) \ + show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in(dev, buf, offset); \ } \ static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ show_in##offset, NULL); \ static ssize_t \ - show_in##offset##_min (struct device *dev, char *buf) \ + show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_min(dev, buf, offset); \ } \ static ssize_t \ - show_in##offset##_max (struct device *dev, char *buf) \ + show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_max(dev, buf, offset); \ } \ -static ssize_t set_in##offset##_min (struct device *dev, \ +static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_min(dev, buf, count, offset); \ } \ -static ssize_t set_in##offset##_max (struct device *dev, \ +static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_max(dev, buf, count, offset); \ @@ -389,24 +389,24 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, } #define sysfs_fan(offset) \ -static ssize_t show_fan##offset(struct device *dev, char *buf) \ +static ssize_t show_fan##offset(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset - 1); \ } \ -static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset - 1); \ } \ -static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_div(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_div(dev, buf, offset - 1); \ } \ -static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ +static ssize_t set_fan##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ return set_fan_min(dev, buf, count, offset - 1); \ } \ -static ssize_t set_fan##offset##_div(struct device *dev, const char *buf, \ +static ssize_t set_fan##offset##_div(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ return set_fan_div(dev, buf, count, offset - 1); \ @@ -482,27 +482,27 @@ set_temp_reg(MAX, temp_max); set_temp_reg(HYST, temp_hyst); #define sysfs_temp(num) \ -static ssize_t show_temp##num(struct device *dev, char *buf) \ +static ssize_t show_temp##num(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp(dev, buf, num-1); \ } \ static DEVICE_ATTR(temp##num##_input, S_IRUGO, show_temp##num, NULL); \ -static ssize_t show_temp_max##num(struct device *dev, char *buf) \ +static ssize_t show_temp_max##num(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_max(dev, buf, num-1); \ } \ -static ssize_t set_temp_max##num(struct device *dev, const char *buf, \ +static ssize_t set_temp_max##num(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ return set_temp_max(dev, buf, count, num-1); \ } \ static DEVICE_ATTR(temp##num##_max, S_IRUGO | S_IWUSR, \ show_temp_max##num, set_temp_max##num); \ -static ssize_t show_temp_hyst##num(struct device *dev, char *buf) \ +static ssize_t show_temp_hyst##num(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_hyst(dev, buf, num-1); \ } \ -static ssize_t set_temp_hyst##num(struct device *dev, const char *buf, \ +static ssize_t set_temp_hyst##num(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ return set_temp_hyst(dev, buf, count, num-1); \ @@ -522,7 +522,7 @@ sysfs_temp(4); device_create_file(&client->dev, &dev_attr_temp##num##_max_hyst); \ } while (0) -static ssize_t show_vid(struct device *dev, char *buf) +static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) { struct asb100_data *data = asb100_update_device(dev); return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); @@ -533,13 +533,13 @@ static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); device_create_file(&client->dev, &dev_attr_cpu0_vid) /* VRM */ -static ssize_t show_vrm(struct device *dev, char *buf) +static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) { struct asb100_data *data = asb100_update_device(dev); return sprintf(buf, "%d\n", data->vrm); } -static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) +static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct asb100_data *data = i2c_get_clientdata(client); @@ -553,7 +553,7 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); #define device_create_file_vrm(client) \ device_create_file(&client->dev, &dev_attr_vrm); -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct asb100_data *data = asb100_update_device(dev); return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms)); @@ -564,13 +564,13 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); device_create_file(&client->dev, &dev_attr_alarms) /* 1 PWM */ -static ssize_t show_pwm1(struct device *dev, char *buf) +static ssize_t show_pwm1(struct device *dev, struct device_attribute *attr, char *buf) { struct asb100_data *data = asb100_update_device(dev); return sprintf(buf, "%d\n", ASB100_PWM_FROM_REG(data->pwm & 0x0f)); } -static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) +static ssize_t set_pwm1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct asb100_data *data = i2c_get_clientdata(client); @@ -584,13 +584,13 @@ static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) return count; } -static ssize_t show_pwm_enable1(struct device *dev, char *buf) +static ssize_t show_pwm_enable1(struct device *dev, struct device_attribute *attr, char *buf) { struct asb100_data *data = asb100_update_device(dev); return sprintf(buf, "%d\n", (data->pwm & 0x80) ? 1 : 0); } -static ssize_t set_pwm_enable1(struct device *dev, const char *buf, +static ssize_t set_pwm_enable1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); diff --git a/drivers/i2c/chips/ds1621.c b/drivers/i2c/chips/ds1621.c index bb1fefb2162..4ae15bd5dcf 100644 --- a/drivers/i2c/chips/ds1621.c +++ b/drivers/i2c/chips/ds1621.c @@ -137,7 +137,7 @@ static void ds1621_init_client(struct i2c_client *client) } #define show(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct ds1621_data *data = ds1621_update_client(dev); \ return sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(data->value)); \ @@ -148,7 +148,7 @@ show(temp_min); show(temp_max); #define set_temp(suffix, value, reg) \ -static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ +static ssize_t set_temp_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -165,7 +165,7 @@ static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ set_temp(min, temp_min, DS1621_REG_TEMP_MIN); set_temp(max, temp_max, DS1621_REG_TEMP_MAX); -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct ds1621_data *data = ds1621_update_client(dev); return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->conf)); diff --git a/drivers/i2c/chips/fscher.c b/drivers/i2c/chips/fscher.c index 18e33ac59d0..c3f37dbec11 100644 --- a/drivers/i2c/chips/fscher.c +++ b/drivers/i2c/chips/fscher.c @@ -157,8 +157,8 @@ struct fscher_data { #define sysfs_r(kind, sub, offset, reg) \ static ssize_t show_##kind##sub (struct fscher_data *, char *, int); \ -static ssize_t show_##kind##offset##sub (struct device *, char *); \ -static ssize_t show_##kind##offset##sub (struct device *dev, char *buf) \ +static ssize_t show_##kind##offset##sub (struct device *, struct device_attribute *attr, char *); \ +static ssize_t show_##kind##offset##sub (struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct fscher_data *data = fscher_update_device(dev); \ return show_##kind##sub(data, buf, (offset)); \ @@ -166,8 +166,8 @@ static ssize_t show_##kind##offset##sub (struct device *dev, char *buf) \ #define sysfs_w(kind, sub, offset, reg) \ static ssize_t set_##kind##sub (struct i2c_client *, struct fscher_data *, const char *, size_t, int, int); \ -static ssize_t set_##kind##offset##sub (struct device *, const char *, size_t); \ -static ssize_t set_##kind##offset##sub (struct device *dev, const char *buf, size_t count) \ +static ssize_t set_##kind##offset##sub (struct device *, struct device_attribute *attr, const char *, size_t); \ +static ssize_t set_##kind##offset##sub (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ struct fscher_data *data = i2c_get_clientdata(client); \ diff --git a/drivers/i2c/chips/fscpos.c b/drivers/i2c/chips/fscpos.c index 2cac79145c7..3beaa6191ef 100644 --- a/drivers/i2c/chips/fscpos.c +++ b/drivers/i2c/chips/fscpos.c @@ -245,19 +245,19 @@ static void reset_fan_alarm(struct i2c_client *client, int nr) /* Volts */ #define VOLT_FROM_REG(val, mult) ((val) * (mult) / 255) -static ssize_t show_volt_12(struct device *dev, char *buf) +static ssize_t show_volt_12(struct device *dev, struct device_attribute *attr, char *buf) { struct fscpos_data *data = fscpos_update_device(dev); return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[0], 14200)); } -static ssize_t show_volt_5(struct device *dev, char *buf) +static ssize_t show_volt_5(struct device *dev, struct device_attribute *attr, char *buf) { struct fscpos_data *data = fscpos_update_device(dev); return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[1], 6600)); } -static ssize_t show_volt_batt(struct device *dev, char *buf) +static ssize_t show_volt_batt(struct device *dev, struct device_attribute *attr, char *buf) { struct fscpos_data *data = fscpos_update_device(dev); return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[2], 3300)); @@ -327,7 +327,7 @@ static ssize_t set_wdog_preset(struct i2c_client *client, struct fscpos_data } /* Event */ -static ssize_t show_event(struct device *dev, char *buf) +static ssize_t show_event(struct device *dev, struct device_attribute *attr, char *buf) { /* bits 5..7 reserved => mask with 0x1f */ struct fscpos_data *data = fscpos_update_device(dev); @@ -338,14 +338,14 @@ static ssize_t show_event(struct device *dev, char *buf) * Sysfs stuff */ #define create_getter(kind, sub) \ - static ssize_t sysfs_show_##kind##sub(struct device *dev, char *buf) \ + static ssize_t sysfs_show_##kind##sub(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct fscpos_data *data = fscpos_update_device(dev); \ return show_##kind##sub(data, buf); \ } #define create_getter_n(kind, offset, sub) \ - static ssize_t sysfs_show_##kind##offset##sub(struct device *dev, char\ + static ssize_t sysfs_show_##kind##offset##sub(struct device *dev, struct device_attribute *attr, char\ *buf) \ { \ struct fscpos_data *data = fscpos_update_device(dev); \ @@ -353,7 +353,7 @@ static ssize_t show_event(struct device *dev, char *buf) } #define create_setter(kind, sub, reg) \ - static ssize_t sysfs_set_##kind##sub (struct device *dev, const char \ + static ssize_t sysfs_set_##kind##sub (struct device *dev, struct device_attribute *attr, const char \ *buf, size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -362,7 +362,7 @@ static ssize_t show_event(struct device *dev, char *buf) } #define create_setter_n(kind, offset, sub, reg) \ - static ssize_t sysfs_set_##kind##offset##sub (struct device *dev, \ + static ssize_t sysfs_set_##kind##offset##sub (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ diff --git a/drivers/i2c/chips/gl518sm.c b/drivers/i2c/chips/gl518sm.c index c82d6ce2120..4316a156225 100644 --- a/drivers/i2c/chips/gl518sm.c +++ b/drivers/i2c/chips/gl518sm.c @@ -164,14 +164,14 @@ static struct i2c_driver gl518_driver = { */ #define show(type, suffix, value) \ -static ssize_t show_##suffix(struct device *dev, char *buf) \ +static ssize_t show_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct gl518_data *data = gl518_update_device(dev); \ return sprintf(buf, "%d\n", type##_FROM_REG(data->value)); \ } #define show_fan(suffix, value, index) \ -static ssize_t show_##suffix(struct device *dev, char *buf) \ +static ssize_t show_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct gl518_data *data = gl518_update_device(dev); \ return sprintf(buf, "%d\n", FAN_FROM_REG(data->value[index], \ @@ -205,7 +205,7 @@ show(BOOL, beep_enable, beep_enable); show(BEEP_MASK, beep_mask, beep_mask); #define set(type, suffix, value, reg) \ -static ssize_t set_##suffix(struct device *dev, const char *buf, \ +static ssize_t set_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -220,7 +220,7 @@ static ssize_t set_##suffix(struct device *dev, const char *buf, \ } #define set_bits(type, suffix, value, reg, mask, shift) \ -static ssize_t set_##suffix(struct device *dev, const char *buf, \ +static ssize_t set_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -258,7 +258,7 @@ set_high(IN, in_max3, voltage_max[3], GL518_REG_VIN3_LIMIT); set_bits(BOOL, beep_enable, beep_enable, GL518_REG_CONF, 0x04, 2); set(BEEP_MASK, beep_mask, beep_mask, GL518_REG_ALARM); -static ssize_t set_fan_min1(struct device *dev, const char *buf, size_t count) +static ssize_t set_fan_min1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct gl518_data *data = i2c_get_clientdata(client); @@ -284,7 +284,7 @@ static ssize_t set_fan_min1(struct device *dev, const char *buf, size_t count) return count; } -static ssize_t set_fan_min2(struct device *dev, const char *buf, size_t count) +static ssize_t set_fan_min2(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct gl518_data *data = i2c_get_clientdata(client); diff --git a/drivers/i2c/chips/gl520sm.c b/drivers/i2c/chips/gl520sm.c index 3fd17e46ffc..a13a504f5bf 100644 --- a/drivers/i2c/chips/gl520sm.c +++ b/drivers/i2c/chips/gl520sm.c @@ -148,8 +148,8 @@ struct gl520_data { #define sysfs_r(type, n, item, reg) \ static ssize_t get_##type##item (struct gl520_data *, char *, int); \ -static ssize_t get_##type##n##item (struct device *, char *); \ -static ssize_t get_##type##n##item (struct device *dev, char *buf) \ +static ssize_t get_##type##n##item (struct device *, struct device_attribute *attr, char *); \ +static ssize_t get_##type##n##item (struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct gl520_data *data = gl520_update_device(dev); \ return get_##type##item(data, buf, (n)); \ @@ -157,8 +157,8 @@ static ssize_t get_##type##n##item (struct device *dev, char *buf) \ #define sysfs_w(type, n, item, reg) \ static ssize_t set_##type##item (struct i2c_client *, struct gl520_data *, const char *, size_t, int, int); \ -static ssize_t set_##type##n##item (struct device *, const char *, size_t); \ -static ssize_t set_##type##n##item (struct device *dev, const char *buf, size_t count) \ +static ssize_t set_##type##n##item (struct device *, struct device_attribute *attr, const char *, size_t); \ +static ssize_t set_##type##n##item (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ struct gl520_data *data = i2c_get_clientdata(client); \ diff --git a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c index cf7e6898754..007bdf9e7e2 100644 --- a/drivers/i2c/chips/it87.c +++ b/drivers/i2c/chips/it87.c @@ -290,7 +290,7 @@ static ssize_t set_in_max(struct device *dev, const char *buf, #define show_in_offset(offset) \ static ssize_t \ - show_in##offset (struct device *dev, char *buf) \ + show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in(dev, buf, offset); \ } \ @@ -298,21 +298,21 @@ static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); #define limit_in_offset(offset) \ static ssize_t \ - show_in##offset##_min (struct device *dev, char *buf) \ + show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_min(dev, buf, offset); \ } \ static ssize_t \ - show_in##offset##_max (struct device *dev, char *buf) \ + show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_max(dev, buf, offset); \ } \ -static ssize_t set_in##offset##_min (struct device *dev, \ +static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_min(dev, buf, count, offset); \ } \ -static ssize_t set_in##offset##_max (struct device *dev, \ +static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_max(dev, buf, count, offset); \ @@ -383,26 +383,26 @@ static ssize_t set_temp_min(struct device *dev, const char *buf, return count; } #define show_temp_offset(offset) \ -static ssize_t show_temp_##offset (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp(dev, buf, offset - 1); \ } \ static ssize_t \ -show_temp_##offset##_max (struct device *dev, char *buf) \ +show_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_max(dev, buf, offset - 1); \ } \ static ssize_t \ -show_temp_##offset##_min (struct device *dev, char *buf) \ +show_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_min(dev, buf, offset - 1); \ } \ -static ssize_t set_temp_##offset##_max (struct device *dev, \ +static ssize_t set_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_max(dev, buf, count, offset - 1); \ } \ -static ssize_t set_temp_##offset##_min (struct device *dev, \ +static ssize_t set_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_min(dev, buf, count, offset - 1); \ @@ -453,11 +453,11 @@ static ssize_t set_sensor(struct device *dev, const char *buf, return count; } #define show_sensor_offset(offset) \ -static ssize_t show_sensor_##offset (struct device *dev, char *buf) \ +static ssize_t show_sensor_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_sensor(dev, buf, offset - 1); \ } \ -static ssize_t set_sensor_##offset (struct device *dev, \ +static ssize_t set_sensor_##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_sensor(dev, buf, count, offset - 1); \ @@ -600,24 +600,24 @@ static ssize_t set_pwm(struct device *dev, const char *buf, } #define show_fan_offset(offset) \ -static ssize_t show_fan_##offset (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_div(dev, buf, offset - 1); \ } \ -static ssize_t set_fan_##offset##_min (struct device *dev, \ +static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_min(dev, buf, count, offset - 1); \ } \ -static ssize_t set_fan_##offset##_div (struct device *dev, \ +static ssize_t set_fan_##offset##_div (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_div(dev, buf, count, offset - 1); \ @@ -633,21 +633,21 @@ show_fan_offset(2); show_fan_offset(3); #define show_pwm_offset(offset) \ -static ssize_t show_pwm##offset##_enable (struct device *dev, \ +static ssize_t show_pwm##offset##_enable (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_pwm_enable(dev, buf, offset - 1); \ } \ -static ssize_t show_pwm##offset (struct device *dev, char *buf) \ +static ssize_t show_pwm##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_pwm(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm##offset##_enable (struct device *dev, \ +static ssize_t set_pwm##offset##_enable (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm_enable(dev, buf, count, offset - 1); \ } \ -static ssize_t set_pwm##offset (struct device *dev, \ +static ssize_t set_pwm##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm(dev, buf, count, offset - 1); \ @@ -663,7 +663,7 @@ show_pwm_offset(2); show_pwm_offset(3); /* Alarms */ -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct it87_data *data = it87_update_device(dev); return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); @@ -671,13 +671,13 @@ static ssize_t show_alarms(struct device *dev, char *buf) static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static ssize_t -show_vrm_reg(struct device *dev, char *buf) +show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct it87_data *data = it87_update_device(dev); return sprintf(buf, "%ld\n", (long) data->vrm); } static ssize_t -store_vrm_reg(struct device *dev, const char *buf, size_t count) +store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct it87_data *data = i2c_get_clientdata(client); @@ -693,7 +693,7 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); device_create_file(&client->dev, &dev_attr_vrm) static ssize_t -show_vid_reg(struct device *dev, char *buf) +show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct it87_data *data = it87_update_device(dev); return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); diff --git a/drivers/i2c/chips/lm63.c b/drivers/i2c/chips/lm63.c index 14cc5af0373..bc68e031392 100644 --- a/drivers/i2c/chips/lm63.c +++ b/drivers/i2c/chips/lm63.c @@ -177,7 +177,7 @@ struct lm63_data { */ #define show_fan(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm63_data *data = lm63_update_device(dev); \ return sprintf(buf, "%d\n", FAN_FROM_REG(data->value)); \ @@ -185,7 +185,7 @@ static ssize_t show_##value(struct device *dev, char *buf) \ show_fan(fan1_input); show_fan(fan1_low); -static ssize_t set_fan1_low(struct device *dev, const char *buf, +static ssize_t set_fan1_low(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -202,7 +202,7 @@ static ssize_t set_fan1_low(struct device *dev, const char *buf, return count; } -static ssize_t show_pwm1(struct device *dev, char *buf) +static ssize_t show_pwm1(struct device *dev, struct device_attribute *attr, char *buf) { struct lm63_data *data = lm63_update_device(dev); return sprintf(buf, "%d\n", data->pwm1_value >= 2 * data->pwm1_freq ? @@ -210,7 +210,7 @@ static ssize_t show_pwm1(struct device *dev, char *buf) (2 * data->pwm1_freq)); } -static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) +static ssize_t set_pwm1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct lm63_data *data = i2c_get_clientdata(client); @@ -229,20 +229,20 @@ static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) return count; } -static ssize_t show_pwm1_enable(struct device *dev, char *buf) +static ssize_t show_pwm1_enable(struct device *dev, struct device_attribute *attr, char *buf) { struct lm63_data *data = lm63_update_device(dev); return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); } #define show_temp8(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm63_data *data = lm63_update_device(dev); \ return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->value)); \ } #define show_temp11(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm63_data *data = lm63_update_device(dev); \ return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->value)); \ @@ -255,7 +255,7 @@ show_temp11(temp2_low); show_temp8(temp2_crit); #define set_temp8(value, reg) \ -static ssize_t set_##value(struct device *dev, const char *buf, \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -269,7 +269,7 @@ static ssize_t set_##value(struct device *dev, const char *buf, \ return count; \ } #define set_temp11(value, reg_msb, reg_lsb) \ -static ssize_t set_##value(struct device *dev, const char *buf, \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -289,7 +289,7 @@ set_temp11(temp2_low, LM63_REG_REMOTE_LOW_MSB, LM63_REG_REMOTE_LOW_LSB); /* Hysteresis register holds a relative value, while we want to present an absolute to user-space */ -static ssize_t show_temp2_crit_hyst(struct device *dev, char *buf) +static ssize_t show_temp2_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct lm63_data *data = lm63_update_device(dev); return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp2_crit) @@ -298,7 +298,7 @@ static ssize_t show_temp2_crit_hyst(struct device *dev, char *buf) /* And now the other way around, user-space provides an absolute hysteresis value and we have to store a relative one */ -static ssize_t set_temp2_crit_hyst(struct device *dev, const char *buf, +static ssize_t set_temp2_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -314,7 +314,7 @@ static ssize_t set_temp2_crit_hyst(struct device *dev, const char *buf, return count; } -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct lm63_data *data = lm63_update_device(dev); return sprintf(buf, "%u\n", data->alarms); diff --git a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c index 0e86cc89398..57c51ac37c0 100644 --- a/drivers/i2c/chips/lm75.c +++ b/drivers/i2c/chips/lm75.c @@ -75,7 +75,7 @@ static struct i2c_driver lm75_driver = { }; #define show(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm75_data *data = lm75_update_device(dev); \ return sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(data->value)); \ @@ -85,7 +85,7 @@ show(temp_hyst); show(temp_input); #define set(value, reg) \ -static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ struct lm75_data *data = i2c_get_clientdata(client); \ diff --git a/drivers/i2c/chips/lm77.c b/drivers/i2c/chips/lm77.c index f56b7a37de7..9d15cd5189f 100644 --- a/drivers/i2c/chips/lm77.c +++ b/drivers/i2c/chips/lm77.c @@ -103,7 +103,7 @@ static inline int LM77_TEMP_FROM_REG(u16 reg) /* read routines for temperature limits */ #define show(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm77_data *data = lm77_update_device(dev); \ return sprintf(buf, "%d\n", data->value); \ @@ -116,17 +116,17 @@ show(temp_max); show(alarms); /* read routines for hysteresis values */ -static ssize_t show_temp_crit_hyst(struct device *dev, char *buf) +static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct lm77_data *data = lm77_update_device(dev); return sprintf(buf, "%d\n", data->temp_crit - data->temp_hyst); } -static ssize_t show_temp_min_hyst(struct device *dev, char *buf) +static ssize_t show_temp_min_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct lm77_data *data = lm77_update_device(dev); return sprintf(buf, "%d\n", data->temp_min + data->temp_hyst); } -static ssize_t show_temp_max_hyst(struct device *dev, char *buf) +static ssize_t show_temp_max_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct lm77_data *data = lm77_update_device(dev); return sprintf(buf, "%d\n", data->temp_max - data->temp_hyst); @@ -134,7 +134,7 @@ static ssize_t show_temp_max_hyst(struct device *dev, char *buf) /* write routines */ #define set(value, reg) \ -static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ struct lm77_data *data = i2c_get_clientdata(client); \ @@ -152,7 +152,7 @@ set(temp_max, LM77_REG_TEMP_MAX); /* hysteresis is stored as a relative value on the chip, so it has to be converted first */ -static ssize_t set_temp_crit_hyst(struct device *dev, const char *buf, size_t count) +static ssize_t set_temp_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct lm77_data *data = i2c_get_clientdata(client); @@ -167,7 +167,7 @@ static ssize_t set_temp_crit_hyst(struct device *dev, const char *buf, size_t co } /* preserve hysteresis when setting T_crit */ -static ssize_t set_temp_crit(struct device *dev, const char *buf, size_t count) +static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct lm77_data *data = i2c_get_clientdata(client); diff --git a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c index 6d52d14eb31..21b195ff387 100644 --- a/drivers/i2c/chips/lm78.c +++ b/drivers/i2c/chips/lm78.c @@ -224,28 +224,28 @@ static ssize_t set_in_max(struct device *dev, const char *buf, #define show_in_offset(offset) \ static ssize_t \ - show_in##offset (struct device *dev, char *buf) \ + show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in(dev, buf, offset); \ } \ static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ show_in##offset, NULL); \ static ssize_t \ - show_in##offset##_min (struct device *dev, char *buf) \ + show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_min(dev, buf, offset); \ } \ static ssize_t \ - show_in##offset##_max (struct device *dev, char *buf) \ + show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_max(dev, buf, offset); \ } \ -static ssize_t set_in##offset##_min (struct device *dev, \ +static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_min(dev, buf, count, offset); \ } \ -static ssize_t set_in##offset##_max (struct device *dev, \ +static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_max(dev, buf, count, offset); \ @@ -264,19 +264,19 @@ show_in_offset(5); show_in_offset(6); /* Temperature */ -static ssize_t show_temp(struct device *dev, char *buf) +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) { struct lm78_data *data = lm78_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); } -static ssize_t show_temp_over(struct device *dev, char *buf) +static ssize_t show_temp_over(struct device *dev, struct device_attribute *attr, char *buf) { struct lm78_data *data = lm78_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); } -static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) +static ssize_t set_temp_over(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct lm78_data *data = i2c_get_clientdata(client); @@ -289,13 +289,13 @@ static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) return count; } -static ssize_t show_temp_hyst(struct device *dev, char *buf) +static ssize_t show_temp_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct lm78_data *data = lm78_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst)); } -static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count) +static ssize_t set_temp_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct lm78_data *data = i2c_get_clientdata(client); @@ -398,19 +398,19 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, } #define show_fan_offset(offset) \ -static ssize_t show_fan_##offset (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_div(dev, buf, offset - 1); \ } \ -static ssize_t set_fan_##offset##_min (struct device *dev, \ +static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_min(dev, buf, count, offset - 1); \ @@ -419,13 +419,13 @@ static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL);\ static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ show_fan_##offset##_min, set_fan_##offset##_min); -static ssize_t set_fan_1_div(struct device *dev, const char *buf, +static ssize_t set_fan_1_div(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { return set_fan_div(dev, buf, count, 0) ; } -static ssize_t set_fan_2_div(struct device *dev, const char *buf, +static ssize_t set_fan_2_div(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { return set_fan_div(dev, buf, count, 1) ; @@ -443,7 +443,7 @@ static DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR, static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL); /* VID */ -static ssize_t show_vid(struct device *dev, char *buf) +static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) { struct lm78_data *data = lm78_update_device(dev); return sprintf(buf, "%d\n", VID_FROM_REG(data->vid)); @@ -451,7 +451,7 @@ static ssize_t show_vid(struct device *dev, char *buf) static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); /* Alarms */ -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct lm78_data *data = lm78_update_device(dev); return sprintf(buf, "%u\n", data->alarms); diff --git a/drivers/i2c/chips/lm80.c b/drivers/i2c/chips/lm80.c index a72f431971b..404057b70e9 100644 --- a/drivers/i2c/chips/lm80.c +++ b/drivers/i2c/chips/lm80.c @@ -156,7 +156,7 @@ static struct i2c_driver lm80_driver = { */ #define show_in(suffix, value) \ -static ssize_t show_in_##suffix(struct device *dev, char *buf) \ +static ssize_t show_in_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm80_data *data = lm80_update_device(dev); \ return sprintf(buf, "%d\n", IN_FROM_REG(data->value)); \ @@ -184,7 +184,7 @@ show_in(input5, in[5]); show_in(input6, in[6]); #define set_in(suffix, value, reg) \ -static ssize_t set_in_##suffix(struct device *dev, const char *buf, \ +static ssize_t set_in_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -213,7 +213,7 @@ set_in(max5, in_max[5], LM80_REG_IN_MAX(5)); set_in(max6, in_max[6], LM80_REG_IN_MAX(6)); #define show_fan(suffix, value, div) \ -static ssize_t show_fan_##suffix(struct device *dev, char *buf) \ +static ssize_t show_fan_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm80_data *data = lm80_update_device(dev); \ return sprintf(buf, "%d\n", FAN_FROM_REG(data->value, \ @@ -225,7 +225,7 @@ show_fan(input1, fan[0], fan_div[0]); show_fan(input2, fan[1], fan_div[1]); #define show_fan_div(suffix, value) \ -static ssize_t show_fan_div##suffix(struct device *dev, char *buf) \ +static ssize_t show_fan_div##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm80_data *data = lm80_update_device(dev); \ return sprintf(buf, "%d\n", DIV_FROM_REG(data->value)); \ @@ -234,7 +234,7 @@ show_fan_div(1, fan_div[0]); show_fan_div(2, fan_div[1]); #define set_fan(suffix, value, reg, div) \ -static ssize_t set_fan_##suffix(struct device *dev, const char *buf, \ +static ssize_t set_fan_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -292,7 +292,7 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, } #define set_fan_div(number) \ -static ssize_t set_fan_div##number(struct device *dev, const char *buf, \ +static ssize_t set_fan_div##number(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ return set_fan_div(dev, buf, count, number - 1); \ @@ -300,14 +300,14 @@ static ssize_t set_fan_div##number(struct device *dev, const char *buf, \ set_fan_div(1); set_fan_div(2); -static ssize_t show_temp_input1(struct device *dev, char *buf) +static ssize_t show_temp_input1(struct device *dev, struct device_attribute *attr, char *buf) { struct lm80_data *data = lm80_update_device(dev); return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp)); } #define show_temp(suffix, value) \ -static ssize_t show_temp_##suffix(struct device *dev, char *buf) \ +static ssize_t show_temp_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm80_data *data = lm80_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_LIMIT_FROM_REG(data->value)); \ @@ -318,7 +318,7 @@ show_temp(os_max, temp_os_max); show_temp(os_hyst, temp_os_hyst); #define set_temp(suffix, value, reg) \ -static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ +static ssize_t set_temp_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -336,7 +336,7 @@ set_temp(hot_hyst, temp_hot_hyst, LM80_REG_TEMP_HOT_HYST); set_temp(os_max, temp_os_max, LM80_REG_TEMP_OS_MAX); set_temp(os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST); -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct lm80_data *data = lm80_update_device(dev); return sprintf(buf, "%u\n", data->alarms); diff --git a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c index 3dafe60766a..4d6d7d21e14 100644 --- a/drivers/i2c/chips/lm83.c +++ b/drivers/i2c/chips/lm83.c @@ -155,7 +155,7 @@ struct lm83_data { */ #define show_temp(suffix, value) \ -static ssize_t show_temp_##suffix(struct device *dev, char *buf) \ +static ssize_t show_temp_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm83_data *data = lm83_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ @@ -171,7 +171,7 @@ show_temp(high4, temp_high[3]); show_temp(crit, temp_crit); #define set_temp(suffix, value, reg) \ -static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ +static ssize_t set_temp_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -190,7 +190,7 @@ set_temp(high3, temp_high[2], LM83_REG_W_REMOTE2_HIGH); set_temp(high4, temp_high[3], LM83_REG_W_REMOTE3_HIGH); set_temp(crit, temp_crit, LM83_REG_W_TCRIT); -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct lm83_data *data = lm83_update_device(dev); return sprintf(buf, "%d\n", data->alarms); diff --git a/drivers/i2c/chips/lm85.c b/drivers/i2c/chips/lm85.c index b1a0dc5f6b3..b1976775b4b 100644 --- a/drivers/i2c/chips/lm85.c +++ b/drivers/i2c/chips/lm85.c @@ -426,15 +426,15 @@ static ssize_t set_fan_min(struct device *dev, const char *buf, } #define show_fan_offset(offset) \ -static ssize_t show_fan_##offset (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset - 1); \ } \ -static ssize_t set_fan_##offset##_min (struct device *dev, \ +static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_min(dev, buf, count, offset - 1); \ @@ -451,7 +451,7 @@ show_fan_offset(4); /* vid, vrm, alarms */ -static ssize_t show_vid_reg(struct device *dev, char *buf) +static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct lm85_data *data = lm85_update_device(dev); return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); @@ -459,13 +459,13 @@ static ssize_t show_vid_reg(struct device *dev, char *buf) static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); -static ssize_t show_vrm_reg(struct device *dev, char *buf) +static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct lm85_data *data = lm85_update_device(dev); return sprintf(buf, "%ld\n", (long) data->vrm); } -static ssize_t store_vrm_reg(struct device *dev, const char *buf, size_t count) +static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct lm85_data *data = i2c_get_clientdata(client); @@ -478,7 +478,7 @@ static ssize_t store_vrm_reg(struct device *dev, const char *buf, size_t count) static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); -static ssize_t show_alarms_reg(struct device *dev, char *buf) +static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct lm85_data *data = lm85_update_device(dev); return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); @@ -516,16 +516,16 @@ static ssize_t show_pwm_enable(struct device *dev, char *buf, int nr) } #define show_pwm_reg(offset) \ -static ssize_t show_pwm_##offset (struct device *dev, char *buf) \ +static ssize_t show_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_pwm(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm_##offset (struct device *dev, \ +static ssize_t set_pwm_##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm(dev, buf, count, offset - 1); \ } \ -static ssize_t show_pwm_enable##offset (struct device *dev, char *buf) \ +static ssize_t show_pwm_enable##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_pwm_enable(dev, buf, offset - 1); \ } \ @@ -585,24 +585,24 @@ static ssize_t set_in_max(struct device *dev, const char *buf, return count; } #define show_in_reg(offset) \ -static ssize_t show_in_##offset (struct device *dev, char *buf) \ +static ssize_t show_in_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in(dev, buf, offset); \ } \ -static ssize_t show_in_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_in_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_min(dev, buf, offset); \ } \ -static ssize_t show_in_##offset##_max (struct device *dev, char *buf) \ +static ssize_t show_in_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_max(dev, buf, offset); \ } \ -static ssize_t set_in_##offset##_min (struct device *dev, \ +static ssize_t set_in_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_min(dev, buf, count, offset); \ } \ -static ssize_t set_in_##offset##_max (struct device *dev, \ +static ssize_t set_in_##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_max(dev, buf, count, offset); \ @@ -666,24 +666,24 @@ static ssize_t set_temp_max(struct device *dev, const char *buf, return count; } #define show_temp_reg(offset) \ -static ssize_t show_temp_##offset (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp(dev, buf, offset - 1); \ } \ -static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_min(dev, buf, offset - 1); \ } \ -static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_max(dev, buf, offset - 1); \ } \ -static ssize_t set_temp_##offset##_min (struct device *dev, \ +static ssize_t set_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_min(dev, buf, count, offset - 1); \ } \ -static ssize_t set_temp_##offset##_max (struct device *dev, \ +static ssize_t set_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_max(dev, buf, count, offset - 1); \ @@ -786,42 +786,42 @@ static ssize_t set_pwm_auto_pwm_freq(struct device *dev, const char *buf, return count; } #define pwm_auto(offset) \ -static ssize_t show_pwm##offset##_auto_channels (struct device *dev, \ +static ssize_t show_pwm##offset##_auto_channels (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_pwm_auto_channels(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm##offset##_auto_channels (struct device *dev, \ +static ssize_t set_pwm##offset##_auto_channels (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm_auto_channels(dev, buf, count, offset - 1); \ } \ -static ssize_t show_pwm##offset##_auto_pwm_min (struct device *dev, \ +static ssize_t show_pwm##offset##_auto_pwm_min (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_pwm_auto_pwm_min(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm##offset##_auto_pwm_min (struct device *dev, \ +static ssize_t set_pwm##offset##_auto_pwm_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm_auto_pwm_min(dev, buf, count, offset - 1); \ } \ -static ssize_t show_pwm##offset##_auto_pwm_minctl (struct device *dev, \ +static ssize_t show_pwm##offset##_auto_pwm_minctl (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_pwm_auto_pwm_minctl(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm##offset##_auto_pwm_minctl (struct device *dev, \ +static ssize_t set_pwm##offset##_auto_pwm_minctl (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm_auto_pwm_minctl(dev, buf, count, offset - 1); \ } \ -static ssize_t show_pwm##offset##_auto_pwm_freq (struct device *dev, \ +static ssize_t show_pwm##offset##_auto_pwm_freq (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_pwm_auto_pwm_freq(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm##offset##_auto_pwm_freq(struct device *dev, \ +static ssize_t set_pwm##offset##_auto_pwm_freq(struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm_auto_pwm_freq(dev, buf, count, offset - 1); \ @@ -962,42 +962,42 @@ static ssize_t set_temp_auto_temp_crit(struct device *dev, const char *buf, return count; } #define temp_auto(offset) \ -static ssize_t show_temp##offset##_auto_temp_off (struct device *dev, \ +static ssize_t show_temp##offset##_auto_temp_off (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_temp_auto_temp_off(dev, buf, offset - 1); \ } \ -static ssize_t set_temp##offset##_auto_temp_off (struct device *dev, \ +static ssize_t set_temp##offset##_auto_temp_off (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_auto_temp_off(dev, buf, count, offset - 1); \ } \ -static ssize_t show_temp##offset##_auto_temp_min (struct device *dev, \ +static ssize_t show_temp##offset##_auto_temp_min (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_temp_auto_temp_min(dev, buf, offset - 1); \ } \ -static ssize_t set_temp##offset##_auto_temp_min (struct device *dev, \ +static ssize_t set_temp##offset##_auto_temp_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_auto_temp_min(dev, buf, count, offset - 1); \ } \ -static ssize_t show_temp##offset##_auto_temp_max (struct device *dev, \ +static ssize_t show_temp##offset##_auto_temp_max (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_temp_auto_temp_max(dev, buf, offset - 1); \ } \ -static ssize_t set_temp##offset##_auto_temp_max (struct device *dev, \ +static ssize_t set_temp##offset##_auto_temp_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_auto_temp_max(dev, buf, count, offset - 1); \ } \ -static ssize_t show_temp##offset##_auto_temp_crit (struct device *dev, \ +static ssize_t show_temp##offset##_auto_temp_crit (struct device *dev, struct device_attribute *attr, \ char *buf) \ { \ return show_temp_auto_temp_crit(dev, buf, offset - 1); \ } \ -static ssize_t set_temp##offset##_auto_temp_crit (struct device *dev, \ +static ssize_t set_temp##offset##_auto_temp_crit (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_auto_temp_crit(dev, buf, count, offset - 1); \ diff --git a/drivers/i2c/chips/lm87.c b/drivers/i2c/chips/lm87.c index 98cabd66506..4372b61a088 100644 --- a/drivers/i2c/chips/lm87.c +++ b/drivers/i2c/chips/lm87.c @@ -218,19 +218,19 @@ static inline int lm87_write_value(struct i2c_client *client, u8 reg, u8 value) } #define show_in(offset) \ -static ssize_t show_in##offset##_input(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ data->in_scale[offset])); \ } \ -static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ data->in_scale[offset])); \ } \ -static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ @@ -274,13 +274,13 @@ static void set_in_max(struct device *dev, const char *buf, int nr) } #define set_in(offset) \ -static ssize_t set_in##offset##_min(struct device *dev, \ +static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ set_in_min(dev, buf, offset); \ return count; \ } \ -static ssize_t set_in##offset##_max(struct device *dev, \ +static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ set_in_max(dev, buf, offset); \ @@ -300,17 +300,17 @@ set_in(6); set_in(7); #define show_temp(offset) \ -static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ } \ -static ssize_t show_temp##offset##_low(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_low(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_low[offset-1])); \ } \ -static ssize_t show_temp##offset##_high(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_high(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[offset-1])); \ @@ -346,13 +346,13 @@ static void set_temp_high(struct device *dev, const char *buf, int nr) } #define set_temp(offset) \ -static ssize_t set_temp##offset##_low(struct device *dev, \ +static ssize_t set_temp##offset##_low(struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ set_temp_low(dev, buf, offset-1); \ return count; \ } \ -static ssize_t set_temp##offset##_high(struct device *dev, \ +static ssize_t set_temp##offset##_high(struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ set_temp_high(dev, buf, offset-1); \ @@ -366,13 +366,13 @@ set_temp(1); set_temp(2); set_temp(3); -static ssize_t show_temp_crit_int(struct device *dev, char *buf) +static ssize_t show_temp_crit_int(struct device *dev, struct device_attribute *attr, char *buf) { struct lm87_data *data = lm87_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit_int)); } -static ssize_t show_temp_crit_ext(struct device *dev, char *buf) +static ssize_t show_temp_crit_ext(struct device *dev, struct device_attribute *attr, char *buf) { struct lm87_data *data = lm87_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit_ext)); @@ -383,19 +383,19 @@ static DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit_ext, NULL); static DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit_ext, NULL); #define show_fan(offset) \ -static ssize_t show_fan##offset##_input(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[offset-1], \ FAN_DIV_FROM_REG(data->fan_div[offset-1]))); \ } \ -static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[offset-1], \ FAN_DIV_FROM_REG(data->fan_div[offset-1]))); \ } \ -static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_div(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm87_data *data = lm87_update_device(dev); \ return sprintf(buf, "%d\n", FAN_DIV_FROM_REG(data->fan_div[offset-1])); \ @@ -465,13 +465,13 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, } #define set_fan(offset) \ -static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ +static ssize_t set_fan##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ set_fan_min(dev, buf, offset-1); \ return count; \ } \ -static ssize_t set_fan##offset##_div(struct device *dev, const char *buf, \ +static ssize_t set_fan##offset##_div(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ return set_fan_div(dev, buf, count, offset-1); \ @@ -483,26 +483,26 @@ static DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ set_fan(1); set_fan(2); -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct lm87_data *data = lm87_update_device(dev); return sprintf(buf, "%d\n", data->alarms); } static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); -static ssize_t show_vid(struct device *dev, char *buf) +static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) { struct lm87_data *data = lm87_update_device(dev); return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); } static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); -static ssize_t show_vrm(struct device *dev, char *buf) +static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) { struct lm87_data *data = lm87_update_device(dev); return sprintf(buf, "%d\n", data->vrm); } -static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) +static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct lm87_data *data = i2c_get_clientdata(client); @@ -511,12 +511,12 @@ static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) } static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); -static ssize_t show_aout(struct device *dev, char *buf) +static ssize_t show_aout(struct device *dev, struct device_attribute *attr, char *buf) { struct lm87_data *data = lm87_update_device(dev); return sprintf(buf, "%d\n", AOUT_FROM_REG(data->aout)); } -static ssize_t set_aout(struct device *dev, const char *buf, size_t count) +static ssize_t set_aout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct lm87_data *data = i2c_get_clientdata(client); diff --git a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c index 2c00ff83bab..9b127a07f56 100644 --- a/drivers/i2c/chips/lm90.c +++ b/drivers/i2c/chips/lm90.c @@ -218,7 +218,7 @@ struct lm90_data { */ #define show_temp(value, converter) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm90_data *data = lm90_update_device(dev); \ return sprintf(buf, "%d\n", converter(data->value)); \ @@ -233,7 +233,7 @@ show_temp(temp_crit1, TEMP1_FROM_REG); show_temp(temp_crit2, TEMP1_FROM_REG); #define set_temp1(value, reg) \ -static ssize_t set_##value(struct device *dev, const char *buf, \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -250,7 +250,7 @@ static ssize_t set_##value(struct device *dev, const char *buf, \ return count; \ } #define set_temp2(value, regh, regl) \ -static ssize_t set_##value(struct device *dev, const char *buf, \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -275,7 +275,7 @@ set_temp1(temp_crit1, LM90_REG_W_LOCAL_CRIT); set_temp1(temp_crit2, LM90_REG_W_REMOTE_CRIT); #define show_temp_hyst(value, basereg) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm90_data *data = lm90_update_device(dev); \ return sprintf(buf, "%d\n", TEMP1_FROM_REG(data->basereg) \ @@ -284,7 +284,7 @@ static ssize_t show_##value(struct device *dev, char *buf) \ show_temp_hyst(temp_hyst1, temp_crit1); show_temp_hyst(temp_hyst2, temp_crit2); -static ssize_t set_temp_hyst1(struct device *dev, const char *buf, +static ssize_t set_temp_hyst1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -300,7 +300,7 @@ static ssize_t set_temp_hyst1(struct device *dev, const char *buf, return count; } -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct lm90_data *data = lm90_update_device(dev); return sprintf(buf, "%d\n", data->alarms); diff --git a/drivers/i2c/chips/lm92.c b/drivers/i2c/chips/lm92.c index fe6e83d70a7..215c8e40ffd 100644 --- a/drivers/i2c/chips/lm92.c +++ b/drivers/i2c/chips/lm92.c @@ -140,7 +140,7 @@ static struct lm92_data *lm92_update_device(struct device *dev) } #define show_temp(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct lm92_data *data = lm92_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ @@ -151,7 +151,7 @@ show_temp(temp1_min); show_temp(temp1_max); #define set_temp(value, reg) \ -static ssize_t set_##value(struct device *dev, const char *buf, \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -168,26 +168,26 @@ set_temp(temp1_crit, LM92_REG_TEMP_CRIT); set_temp(temp1_min, LM92_REG_TEMP_LOW); set_temp(temp1_max, LM92_REG_TEMP_HIGH); -static ssize_t show_temp1_crit_hyst(struct device *dev, char *buf) +static ssize_t show_temp1_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct lm92_data *data = lm92_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_crit) - TEMP_FROM_REG(data->temp1_hyst)); } -static ssize_t show_temp1_max_hyst(struct device *dev, char *buf) +static ssize_t show_temp1_max_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct lm92_data *data = lm92_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_max) - TEMP_FROM_REG(data->temp1_hyst)); } -static ssize_t show_temp1_min_hyst(struct device *dev, char *buf) +static ssize_t show_temp1_min_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct lm92_data *data = lm92_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_min) + TEMP_FROM_REG(data->temp1_hyst)); } -static ssize_t set_temp1_crit_hyst(struct device *dev, const char *buf, +static ssize_t set_temp1_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -202,7 +202,7 @@ static ssize_t set_temp1_crit_hyst(struct device *dev, const char *buf, return count; } -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct lm92_data *data = lm92_update_device(dev); return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input)); diff --git a/drivers/i2c/chips/max1619.c b/drivers/i2c/chips/max1619.c index 5afa961a5e1..30a196155fd 100644 --- a/drivers/i2c/chips/max1619.c +++ b/drivers/i2c/chips/max1619.c @@ -122,7 +122,7 @@ struct max1619_data { */ #define show_temp(value) \ -static ssize_t show_##value(struct device *dev, char *buf) \ +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct max1619_data *data = max1619_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ @@ -135,7 +135,7 @@ show_temp(temp_crit2); show_temp(temp_hyst2); #define set_temp2(value, reg) \ -static ssize_t set_##value(struct device *dev, const char *buf, \ +static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -154,7 +154,7 @@ set_temp2(temp_high2, MAX1619_REG_W_REMOTE_HIGH); set_temp2(temp_crit2, MAX1619_REG_W_REMOTE_CRIT); set_temp2(temp_hyst2, MAX1619_REG_W_TCRIT_HYST); -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct max1619_data *data = max1619_update_device(dev); return sprintf(buf, "%d\n", data->alarms); diff --git a/drivers/i2c/chips/pc87360.c b/drivers/i2c/chips/pc87360.c index 6d94c36c921..65637b2cd17 100644 --- a/drivers/i2c/chips/pc87360.c +++ b/drivers/i2c/chips/pc87360.c @@ -282,31 +282,31 @@ static ssize_t set_fan_min(struct device *dev, const char *buf, } #define show_and_set_fan(offset) \ -static ssize_t show_fan##offset##_input(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[offset-1], \ FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ } \ -static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[offset-1], \ FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ } \ -static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_div(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", \ FAN_DIV_FROM_REG(data->fan_status[offset-1])); \ } \ -static ssize_t show_fan##offset##_status(struct device *dev, char *buf) \ +static ssize_t show_fan##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", \ FAN_STATUS_FROM_REG(data->fan_status[offset-1])); \ } \ -static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ +static ssize_t set_fan##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ return set_fan_min(dev, buf, count, offset-1); \ @@ -324,7 +324,7 @@ 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, char *buf) \ +static ssize_t show_pwm##offset(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", \ @@ -332,7 +332,7 @@ static ssize_t show_pwm##offset(struct device *dev, char *buf) \ FAN_CONFIG_INVERT(data->fan_conf, \ offset-1))); \ } \ -static ssize_t set_pwm##offset(struct device *dev, const char *buf, \ +static ssize_t set_pwm##offset(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -354,30 +354,30 @@ show_and_set_pwm(2) show_and_set_pwm(3) #define show_and_set_in(offset) \ -static ssize_t show_in##offset##_input(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ data->in_vref)); \ } \ -static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ data->in_vref)); \ } \ -static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ data->in_vref)); \ } \ -static ssize_t show_in##offset##_status(struct device *dev, char *buf) \ +static ssize_t show_in##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", data->in_status[offset]); \ } \ -static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ +static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -391,7 +391,7 @@ static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ up(&data->update_lock); \ return count; \ } \ -static ssize_t set_in##offset##_max(struct device *dev, const char *buf, \ +static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -427,36 +427,36 @@ show_and_set_in(9) show_and_set_in(10) #define show_and_set_therm(offset) \ -static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset+7], \ data->in_vref)); \ } \ -static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset+7], \ data->in_vref)); \ } \ -static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset+7], \ data->in_vref)); \ } \ -static ssize_t show_temp##offset##_crit(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_crit(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[offset-4], \ data->in_vref)); \ } \ -static ssize_t show_temp##offset##_status(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%u\n", data->in_status[offset+7]); \ } \ -static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ +static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -470,7 +470,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ up(&data->update_lock); \ return count; \ } \ -static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ +static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -484,7 +484,7 @@ static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ up(&data->update_lock); \ return count; \ } \ -static ssize_t set_temp##offset##_crit(struct device *dev, const char *buf, \ +static ssize_t set_temp##offset##_crit(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -512,19 +512,19 @@ show_and_set_therm(4) show_and_set_therm(5) show_and_set_therm(6) -static ssize_t show_vid(struct device *dev, char *buf) +static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) { struct pc87360_data *data = pc87360_update_device(dev); return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); } static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); -static ssize_t show_vrm(struct device *dev, char *buf) +static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) { struct pc87360_data *data = pc87360_update_device(dev); return sprintf(buf, "%u\n", data->vrm); } -static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) +static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct pc87360_data *data = i2c_get_clientdata(client); @@ -533,7 +533,7 @@ static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) } static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); -static ssize_t show_in_alarms(struct device *dev, char *buf) +static ssize_t show_in_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct pc87360_data *data = pc87360_update_device(dev); return sprintf(buf, "%u\n", data->in_alarms); @@ -541,32 +541,32 @@ static ssize_t show_in_alarms(struct device *dev, char *buf) static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL); #define show_and_set_temp(offset) \ -static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ } \ -static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ } \ -static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \ }\ -static ssize_t show_temp##offset##_crit(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_crit(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[offset-1])); \ }\ -static ssize_t show_temp##offset##_status(struct device *dev, char *buf) \ +static ssize_t show_temp##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pc87360_data *data = pc87360_update_device(dev); \ return sprintf(buf, "%d\n", data->temp_status[offset-1]); \ }\ -static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ +static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -580,7 +580,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ up(&data->update_lock); \ return count; \ } \ -static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ +static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -594,7 +594,7 @@ static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ up(&data->update_lock); \ return count; \ } \ -static ssize_t set_temp##offset##_crit(struct device *dev, const char *buf, \ +static ssize_t set_temp##offset##_crit(struct device *dev, struct device_attribute *attr, const char *buf, \ size_t count) \ { \ struct i2c_client *client = to_i2c_client(dev); \ @@ -622,7 +622,7 @@ show_and_set_temp(1) show_and_set_temp(2) show_and_set_temp(3) -static ssize_t show_temp_alarms(struct device *dev, char *buf) +static ssize_t show_temp_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct pc87360_data *data = pc87360_update_device(dev); return sprintf(buf, "%u\n", data->temp_alarms); diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index 48b4e22eaff..4956e9effd7 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c @@ -76,7 +76,7 @@ static struct i2c_driver pcf8574_driver = { }; /* following are the sysfs callback functions */ -static ssize_t show_read(struct device *dev, char *buf) +static ssize_t show_read(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); struct pcf8574_data *data = i2c_get_clientdata(client); @@ -86,13 +86,13 @@ static ssize_t show_read(struct device *dev, char *buf) static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); -static ssize_t show_write(struct device *dev, char *buf) +static ssize_t show_write(struct device *dev, struct device_attribute *attr, char *buf) { struct pcf8574_data *data = i2c_get_clientdata(to_i2c_client(dev)); return sprintf(buf, "%u\n", data->write); } -static ssize_t set_write(struct device *dev, const char *buf, +static ssize_t set_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c index b6b927d8b37..db812ade856 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c @@ -100,7 +100,7 @@ static struct i2c_driver pcf8591_driver = { /* following are the sysfs callback functions */ #define show_in_channel(channel) \ -static ssize_t show_in##channel##_input(struct device *dev, char *buf) \ +static ssize_t show_in##channel##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return sprintf(buf, "%d\n", pcf8591_read_channel(dev, channel));\ } \ @@ -112,13 +112,13 @@ show_in_channel(1); show_in_channel(2); show_in_channel(3); -static ssize_t show_out0_ouput(struct device *dev, char *buf) +static ssize_t show_out0_ouput(struct device *dev, struct device_attribute *attr, char *buf) { struct pcf8591_data *data = i2c_get_clientdata(to_i2c_client(dev)); return sprintf(buf, "%d\n", data->aout * 10); } -static ssize_t set_out0_output(struct device *dev, const char *buf, size_t count) +static ssize_t set_out0_output(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned int value; struct i2c_client *client = to_i2c_client(dev); @@ -134,13 +134,13 @@ static ssize_t set_out0_output(struct device *dev, const char *buf, size_t count static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, show_out0_ouput, set_out0_output); -static ssize_t show_out0_enable(struct device *dev, char *buf) +static ssize_t show_out0_enable(struct device *dev, struct device_attribute *attr, char *buf) { struct pcf8591_data *data = i2c_get_clientdata(to_i2c_client(dev)); return sprintf(buf, "%u\n", !(!(data->control & PCF8591_CONTROL_AOEF))); } -static ssize_t set_out0_enable(struct device *dev, const char *buf, size_t count) +static ssize_t set_out0_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct pcf8591_data *data = i2c_get_clientdata(client); diff --git a/drivers/i2c/chips/sis5595.c b/drivers/i2c/chips/sis5595.c index 7ea84532df3..c6650727a27 100644 --- a/drivers/i2c/chips/sis5595.c +++ b/drivers/i2c/chips/sis5595.c @@ -256,28 +256,28 @@ static ssize_t set_in_max(struct device *dev, const char *buf, #define show_in_offset(offset) \ static ssize_t \ - show_in##offset (struct device *dev, char *buf) \ + show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in(dev, buf, offset); \ } \ static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ show_in##offset, NULL); \ static ssize_t \ - show_in##offset##_min (struct device *dev, char *buf) \ + show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_min(dev, buf, offset); \ } \ static ssize_t \ - show_in##offset##_max (struct device *dev, char *buf) \ + show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_max(dev, buf, offset); \ } \ -static ssize_t set_in##offset##_min (struct device *dev, \ +static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_min(dev, buf, count, offset); \ } \ -static ssize_t set_in##offset##_max (struct device *dev, \ +static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_max(dev, buf, count, offset); \ @@ -294,19 +294,19 @@ show_in_offset(3); show_in_offset(4); /* Temperature */ -static ssize_t show_temp(struct device *dev, char *buf) +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) { struct sis5595_data *data = sis5595_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); } -static ssize_t show_temp_over(struct device *dev, char *buf) +static ssize_t show_temp_over(struct device *dev, struct device_attribute *attr, char *buf) { struct sis5595_data *data = sis5595_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); } -static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) +static ssize_t set_temp_over(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct sis5595_data *data = i2c_get_clientdata(client); @@ -319,13 +319,13 @@ static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) return count; } -static ssize_t show_temp_hyst(struct device *dev, char *buf) +static ssize_t show_temp_hyst(struct device *dev, struct device_attribute *attr, char *buf) { struct sis5595_data *data = sis5595_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst)); } -static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count) +static ssize_t set_temp_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct sis5595_data *data = i2c_get_clientdata(client); @@ -426,19 +426,19 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, } #define show_fan_offset(offset) \ -static ssize_t show_fan_##offset (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_div(dev, buf, offset - 1); \ } \ -static ssize_t set_fan_##offset##_min (struct device *dev, \ +static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_min(dev, buf, count, offset - 1); \ @@ -450,13 +450,13 @@ static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ show_fan_offset(1); show_fan_offset(2); -static ssize_t set_fan_1_div(struct device *dev, const char *buf, +static ssize_t set_fan_1_div(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { return set_fan_div(dev, buf, count, 0) ; } -static ssize_t set_fan_2_div(struct device *dev, const char *buf, +static ssize_t set_fan_2_div(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { return set_fan_div(dev, buf, count, 1) ; @@ -467,7 +467,7 @@ static DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR, show_fan_2_div, set_fan_2_div); /* Alarms */ -static ssize_t show_alarms(struct device *dev, char *buf) +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct sis5595_data *data = sis5595_update_device(dev); return sprintf(buf, "%d\n", data->alarms); diff --git a/drivers/i2c/chips/smsc47b397.c b/drivers/i2c/chips/smsc47b397.c index 1119c76791d..251ac265955 100644 --- a/drivers/i2c/chips/smsc47b397.c +++ b/drivers/i2c/chips/smsc47b397.c @@ -172,7 +172,7 @@ static ssize_t show_temp(struct device *dev, char *buf, int nr) } #define sysfs_temp(num) \ -static ssize_t show_temp##num(struct device *dev, char *buf) \ +static ssize_t show_temp##num(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp(dev, buf, num-1); \ } \ @@ -201,7 +201,7 @@ static ssize_t show_fan(struct device *dev, char *buf, int nr) } #define sysfs_fan(num) \ -static ssize_t show_fan##num(struct device *dev, char *buf) \ +static ssize_t show_fan##num(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, num-1); \ } \ diff --git a/drivers/i2c/chips/smsc47m1.c b/drivers/i2c/chips/smsc47m1.c index 0e12ca36941..13d6d4a8bc7 100644 --- a/drivers/i2c/chips/smsc47m1.c +++ b/drivers/i2c/chips/smsc47m1.c @@ -184,7 +184,7 @@ static ssize_t get_pwm_en(struct device *dev, char *buf, int nr) return sprintf(buf, "%d\n", PWM_EN_FROM_REG(data->pwm[nr])); } -static ssize_t get_alarms(struct device *dev, char *buf) +static ssize_t get_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct smsc47m1_data *data = smsc47m1_update_device(dev, 0); return sprintf(buf, "%d\n", data->alarms); @@ -298,42 +298,42 @@ static ssize_t set_pwm_en(struct device *dev, const char *buf, } #define fan_present(offset) \ -static ssize_t get_fan##offset (struct device *dev, char *buf) \ +static ssize_t get_fan##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return get_fan(dev, buf, offset - 1); \ } \ -static ssize_t get_fan##offset##_min (struct device *dev, char *buf) \ +static ssize_t get_fan##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return get_fan_min(dev, buf, offset - 1); \ } \ -static ssize_t set_fan##offset##_min (struct device *dev, \ +static ssize_t set_fan##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_min(dev, buf, count, offset - 1); \ } \ -static ssize_t get_fan##offset##_div (struct device *dev, char *buf) \ +static ssize_t get_fan##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return get_fan_div(dev, buf, offset - 1); \ } \ -static ssize_t set_fan##offset##_div (struct device *dev, \ +static ssize_t set_fan##offset##_div (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_div(dev, buf, count, offset - 1); \ } \ -static ssize_t get_pwm##offset (struct device *dev, char *buf) \ +static ssize_t get_pwm##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return get_pwm(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm##offset (struct device *dev, \ +static ssize_t set_pwm##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm(dev, buf, count, offset - 1); \ } \ -static ssize_t get_pwm##offset##_en (struct device *dev, char *buf) \ +static ssize_t get_pwm##offset##_en (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return get_pwm_en(dev, buf, offset - 1); \ } \ -static ssize_t set_pwm##offset##_en (struct device *dev, \ +static ssize_t set_pwm##offset##_en (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_pwm_en(dev, buf, count, offset - 1); \ diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c index 6614a59cecd..fefc24a9251 100644 --- a/drivers/i2c/chips/via686a.c +++ b/drivers/i2c/chips/via686a.c @@ -386,26 +386,26 @@ static ssize_t set_in_max(struct device *dev, const char *buf, } #define show_in_offset(offset) \ static ssize_t \ - show_in##offset (struct device *dev, char *buf) \ + show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in(dev, buf, offset); \ } \ static ssize_t \ - show_in##offset##_min (struct device *dev, char *buf) \ + show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_min(dev, buf, offset); \ } \ static ssize_t \ - show_in##offset##_max (struct device *dev, char *buf) \ + show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_max(dev, buf, offset); \ } \ -static ssize_t set_in##offset##_min (struct device *dev, \ +static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_min(dev, buf, count, offset); \ } \ -static ssize_t set_in##offset##_max (struct device *dev, \ +static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_in_max(dev, buf, count, offset); \ @@ -460,26 +460,26 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf, return count; } #define show_temp_offset(offset) \ -static ssize_t show_temp_##offset (struct device *dev, char *buf) \ +static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp(dev, buf, offset - 1); \ } \ static ssize_t \ -show_temp_##offset##_over (struct device *dev, char *buf) \ +show_temp_##offset##_over (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_over(dev, buf, offset - 1); \ } \ static ssize_t \ -show_temp_##offset##_hyst (struct device *dev, char *buf) \ +show_temp_##offset##_hyst (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_hyst(dev, buf, offset - 1); \ } \ -static ssize_t set_temp_##offset##_over (struct device *dev, \ +static ssize_t set_temp_##offset##_over (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_over(dev, buf, count, offset - 1); \ } \ -static ssize_t set_temp_##offset##_hyst (struct device *dev, \ +static ssize_t set_temp_##offset##_hyst (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_temp_hyst(dev, buf, count, offset - 1); \ @@ -538,24 +538,24 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, } #define show_fan_offset(offset) \ -static ssize_t show_fan_##offset (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset - 1); \ } \ -static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ +static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_div(dev, buf, offset - 1); \ } \ -static ssize_t set_fan_##offset##_min (struct device *dev, \ +static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_min(dev, buf, count, offset - 1); \ } \ -static ssize_t set_fan_##offset##_div (struct device *dev, \ +static ssize_t set_fan_##offset##_div (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return set_fan_div(dev, buf, count, offset - 1); \ @@ -570,7 +570,7 @@ show_fan_offset(1); show_fan_offset(2); /* Alarms */ -static ssize_t show_alarms(struct device *dev, char *buf) { +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { struct via686a_data *data = via686a_update_device(dev); return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); } diff --git a/drivers/i2c/chips/w83627hf.c b/drivers/i2c/chips/w83627hf.c index b1da5ed696d..4f1bff572c1 100644 --- a/drivers/i2c/chips/w83627hf.c +++ b/drivers/i2c/chips/w83627hf.c @@ -368,19 +368,19 @@ store_in_reg(MAX, max) #define sysfs_in_offset(offset) \ static ssize_t \ -show_regs_in_##offset (struct device *dev, char *buf) \ +show_regs_in_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in(dev, buf, offset); \ } \ static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL); #define sysfs_in_reg_offset(reg, offset) \ -static ssize_t show_regs_in_##reg##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_in_##reg##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_##reg (dev, buf, offset); \ } \ static ssize_t \ -store_regs_in_##reg##offset (struct device *dev, \ +store_regs_in_##reg##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return store_in_##reg (dev, buf, count, offset); \ @@ -419,25 +419,25 @@ static ssize_t show_in_0(struct w83627hf_data *data, char *buf, u8 reg) return sprintf(buf,"%ld\n", in0); } -static ssize_t show_regs_in_0(struct device *dev, char *buf) +static ssize_t show_regs_in_0(struct device *dev, struct device_attribute *attr, char *buf) { struct w83627hf_data *data = w83627hf_update_device(dev); return show_in_0(data, buf, data->in[0]); } -static ssize_t show_regs_in_min0(struct device *dev, char *buf) +static ssize_t show_regs_in_min0(struct device *dev, struct device_attribute *attr, char *buf) { struct w83627hf_data *data = w83627hf_update_device(dev); return show_in_0(data, buf, data->in_min[0]); } -static ssize_t show_regs_in_max0(struct device *dev, char *buf) +static ssize_t show_regs_in_max0(struct device *dev, struct device_attribute *attr, char *buf) { struct w83627hf_data *data = w83627hf_update_device(dev); return show_in_0(data, buf, data->in_max[0]); } -static ssize_t store_regs_in_min0(struct device *dev, +static ssize_t store_regs_in_min0(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -462,7 +462,7 @@ static ssize_t store_regs_in_min0(struct device *dev, return count; } -static ssize_t store_regs_in_max0(struct device *dev, +static ssize_t store_regs_in_max0(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -531,19 +531,19 @@ store_fan_min(struct device *dev, const char *buf, size_t count, int nr) } #define sysfs_fan_offset(offset) \ -static ssize_t show_regs_fan_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset); \ } \ static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL); #define sysfs_fan_min_offset(offset) \ -static ssize_t show_regs_fan_min##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_fan_min##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset); \ } \ static ssize_t \ -store_regs_fan_min##offset (struct device *dev, const char *buf, size_t count) \ +store_regs_fan_min##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_fan_min(dev, buf, count, offset); \ } \ @@ -608,19 +608,19 @@ store_temp_reg(HYST, max_hyst); #define sysfs_temp_offset(offset) \ static ssize_t \ -show_regs_temp_##offset (struct device *dev, char *buf) \ +show_regs_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp(dev, buf, offset); \ } \ static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL); #define sysfs_temp_reg_offset(reg, offset) \ -static ssize_t show_regs_temp_##reg##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_temp_##reg##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_##reg (dev, buf, offset); \ } \ static ssize_t \ -store_regs_temp_##reg##offset (struct device *dev, \ +store_regs_temp_##reg##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return store_temp_##reg (dev, buf, count, offset); \ @@ -645,7 +645,7 @@ device_create_file(&client->dev, &dev_attr_temp##offset##_max_hyst); \ } while (0) static ssize_t -show_vid_reg(struct device *dev, char *buf) +show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct w83627hf_data *data = w83627hf_update_device(dev); return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); @@ -655,13 +655,13 @@ static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); device_create_file(&client->dev, &dev_attr_cpu0_vid) static ssize_t -show_vrm_reg(struct device *dev, char *buf) +show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct w83627hf_data *data = w83627hf_update_device(dev); return sprintf(buf, "%ld\n", (long) data->vrm); } static ssize_t -store_vrm_reg(struct device *dev, const char *buf, size_t count) +store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct w83627hf_data *data = i2c_get_clientdata(client); @@ -677,7 +677,7 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); device_create_file(&client->dev, &dev_attr_vrm) static ssize_t -show_alarms_reg(struct device *dev, char *buf) +show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct w83627hf_data *data = w83627hf_update_device(dev); return sprintf(buf, "%ld\n", (long) data->alarms); @@ -687,7 +687,7 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); device_create_file(&client->dev, &dev_attr_alarms) #define show_beep_reg(REG, reg) \ -static ssize_t show_beep_##reg (struct device *dev, char *buf) \ +static ssize_t show_beep_##reg (struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct w83627hf_data *data = w83627hf_update_device(dev); \ return sprintf(buf,"%ld\n", \ @@ -732,12 +732,12 @@ store_beep_reg(struct device *dev, const char *buf, size_t count, } #define sysfs_beep(REG, reg) \ -static ssize_t show_regs_beep_##reg (struct device *dev, char *buf) \ +static ssize_t show_regs_beep_##reg (struct device *dev, struct device_attribute *attr, char *buf) \ { \ - return show_beep_##reg(dev, buf); \ + return show_beep_##reg(dev, attr, buf); \ } \ static ssize_t \ -store_regs_beep_##reg (struct device *dev, const char *buf, size_t count) \ +store_regs_beep_##reg (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_beep_reg(dev, buf, count, BEEP_##REG); \ } \ @@ -801,12 +801,12 @@ store_fan_div_reg(struct device *dev, const char *buf, size_t count, int nr) } #define sysfs_fan_div(offset) \ -static ssize_t show_regs_fan_div_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_fan_div_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_div_reg(dev, buf, offset); \ } \ static ssize_t \ -store_regs_fan_div_##offset (struct device *dev, \ +store_regs_fan_div_##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return store_fan_div_reg(dev, buf, count, offset - 1); \ @@ -861,12 +861,12 @@ store_pwm_reg(struct device *dev, const char *buf, size_t count, int nr) } #define sysfs_pwm(offset) \ -static ssize_t show_regs_pwm_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_pwm_reg(dev, buf, offset); \ } \ static ssize_t \ -store_regs_pwm_##offset (struct device *dev, const char *buf, size_t count) \ +store_regs_pwm_##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_pwm_reg(dev, buf, count, offset); \ } \ @@ -937,12 +937,12 @@ store_sensor_reg(struct device *dev, const char *buf, size_t count, int nr) } #define sysfs_sensor(offset) \ -static ssize_t show_regs_sensor_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_sensor_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_sensor_reg(dev, buf, offset); \ } \ static ssize_t \ -store_regs_sensor_##offset (struct device *dev, const char *buf, size_t count) \ +store_regs_sensor_##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_sensor_reg(dev, buf, count, offset); \ } \ diff --git a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c index 4954e465c41..c3926d2d8ac 100644 --- a/drivers/i2c/chips/w83781d.c +++ b/drivers/i2c/chips/w83781d.c @@ -309,18 +309,18 @@ store_in_reg(MAX, max); #define sysfs_in_offset(offset) \ static ssize_t \ -show_regs_in_##offset (struct device *dev, char *buf) \ +show_regs_in_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in(dev, buf, offset); \ } \ static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL); #define sysfs_in_reg_offset(reg, offset) \ -static ssize_t show_regs_in_##reg##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_in_##reg##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_in_##reg (dev, buf, offset); \ } \ -static ssize_t store_regs_in_##reg##offset (struct device *dev, const char *buf, size_t count) \ +static ssize_t store_regs_in_##reg##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_in_##reg (dev, buf, count, offset); \ } \ @@ -378,18 +378,18 @@ store_fan_min(struct device *dev, const char *buf, size_t count, int nr) } #define sysfs_fan_offset(offset) \ -static ssize_t show_regs_fan_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan(dev, buf, offset); \ } \ static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL); #define sysfs_fan_min_offset(offset) \ -static ssize_t show_regs_fan_min##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_fan_min##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_min(dev, buf, offset); \ } \ -static ssize_t store_regs_fan_min##offset (struct device *dev, const char *buf, size_t count) \ +static ssize_t store_regs_fan_min##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_fan_min(dev, buf, count, offset); \ } \ @@ -452,18 +452,18 @@ store_temp_reg(HYST, max_hyst); #define sysfs_temp_offset(offset) \ static ssize_t \ -show_regs_temp_##offset (struct device *dev, char *buf) \ +show_regs_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp(dev, buf, offset); \ } \ static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL); #define sysfs_temp_reg_offset(reg, offset) \ -static ssize_t show_regs_temp_##reg##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_temp_##reg##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_temp_##reg (dev, buf, offset); \ } \ -static ssize_t store_regs_temp_##reg##offset (struct device *dev, const char *buf, size_t count) \ +static ssize_t store_regs_temp_##reg##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_temp_##reg (dev, buf, count, offset); \ } \ @@ -486,7 +486,7 @@ device_create_file(&client->dev, &dev_attr_temp##offset##_max_hyst); \ } while (0) static ssize_t -show_vid_reg(struct device *dev, char *buf) +show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct w83781d_data *data = w83781d_update_device(dev); return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); @@ -497,14 +497,14 @@ DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); #define device_create_file_vid(client) \ device_create_file(&client->dev, &dev_attr_cpu0_vid); static ssize_t -show_vrm_reg(struct device *dev, char *buf) +show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct w83781d_data *data = w83781d_update_device(dev); return sprintf(buf, "%ld\n", (long) data->vrm); } static ssize_t -store_vrm_reg(struct device *dev, const char *buf, size_t count) +store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct w83781d_data *data = i2c_get_clientdata(client); @@ -521,7 +521,7 @@ DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); #define device_create_file_vrm(client) \ device_create_file(&client->dev, &dev_attr_vrm); static ssize_t -show_alarms_reg(struct device *dev, char *buf) +show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct w83781d_data *data = w83781d_update_device(dev); return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); @@ -531,13 +531,13 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); #define device_create_file_alarms(client) \ device_create_file(&client->dev, &dev_attr_alarms); -static ssize_t show_beep_mask (struct device *dev, char *buf) +static ssize_t show_beep_mask (struct device *dev, struct device_attribute *attr, char *buf) { struct w83781d_data *data = w83781d_update_device(dev); return sprintf(buf, "%ld\n", (long)BEEP_MASK_FROM_REG(data->beep_mask, data->type)); } -static ssize_t show_beep_enable (struct device *dev, char *buf) +static ssize_t show_beep_enable (struct device *dev, struct device_attribute *attr, char *buf) { struct w83781d_data *data = w83781d_update_device(dev); return sprintf(buf, "%ld\n", @@ -583,11 +583,11 @@ store_beep_reg(struct device *dev, const char *buf, size_t count, } #define sysfs_beep(REG, reg) \ -static ssize_t show_regs_beep_##reg (struct device *dev, char *buf) \ +static ssize_t show_regs_beep_##reg (struct device *dev, struct device_attribute *attr, char *buf) \ { \ - return show_beep_##reg(dev, buf); \ + return show_beep_##reg(dev, attr, buf); \ } \ -static ssize_t store_regs_beep_##reg (struct device *dev, const char *buf, size_t count) \ +static ssize_t store_regs_beep_##reg (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_beep_reg(dev, buf, count, BEEP_##REG); \ } \ @@ -653,11 +653,11 @@ store_fan_div_reg(struct device *dev, const char *buf, size_t count, int nr) } #define sysfs_fan_div(offset) \ -static ssize_t show_regs_fan_div_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_fan_div_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_fan_div_reg(dev, buf, offset); \ } \ -static ssize_t store_regs_fan_div_##offset (struct device *dev, const char *buf, size_t count) \ +static ssize_t store_regs_fan_div_##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_fan_div_reg(dev, buf, count, offset - 1); \ } \ @@ -737,11 +737,11 @@ store_pwmenable_reg(struct device *dev, const char *buf, size_t count, int nr) } #define sysfs_pwm(offset) \ -static ssize_t show_regs_pwm_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_pwm_reg(dev, buf, offset); \ } \ -static ssize_t store_regs_pwm_##offset (struct device *dev, \ +static ssize_t store_regs_pwm_##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return store_pwm_reg(dev, buf, count, offset); \ @@ -750,11 +750,11 @@ static DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ show_regs_pwm_##offset, store_regs_pwm_##offset); #define sysfs_pwmenable(offset) \ -static ssize_t show_regs_pwmenable_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_pwmenable_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_pwmenable_reg(dev, buf, offset); \ } \ -static ssize_t store_regs_pwmenable_##offset (struct device *dev, \ +static ssize_t store_regs_pwmenable_##offset (struct device *dev, struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return store_pwmenable_reg(dev, buf, count, offset); \ @@ -832,11 +832,11 @@ store_sensor_reg(struct device *dev, const char *buf, size_t count, int nr) } #define sysfs_sensor(offset) \ -static ssize_t show_regs_sensor_##offset (struct device *dev, char *buf) \ +static ssize_t show_regs_sensor_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ { \ return show_sensor_reg(dev, buf, offset); \ } \ -static ssize_t store_regs_sensor_##offset (struct device *dev, const char *buf, size_t count) \ +static ssize_t store_regs_sensor_##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ { \ return store_sensor_reg(dev, buf, count, offset); \ } \ diff --git a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c index 59bbc5881fa..74d4b58e423 100644 --- a/drivers/i2c/chips/w83l785ts.c +++ b/drivers/i2c/chips/w83l785ts.c @@ -118,13 +118,13 @@ struct w83l785ts_data { * Sysfs stuff */ -static ssize_t show_temp(struct device *dev, char *buf) +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) { struct w83l785ts_data *data = w83l785ts_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); } -static ssize_t show_temp_over(struct device *dev, char *buf) +static ssize_t show_temp_over(struct device *dev, struct device_attribute *attr, char *buf) { struct w83l785ts_data *data = w83l785ts_update_device(dev); return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); |