Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30f74292 authored by Yani Ioannou's avatar Yani Ioannou Committed by Greg Kroah-Hartman
Browse files

[PATCH] Driver Core: drivers/i2c/chips/adm1031.c - lm75.c: update device attribute callbacks

parent 74880c06
Loading
Loading
Loading
Loading
+22 −22
Original line number Diff line number Diff line
@@ -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);
+23 −23
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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));
+4 −4
Original line number Diff line number Diff line
@@ -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); \
+8 −8
Original line number Diff line number Diff line
@@ -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); \
Loading