Replace sprintf with sysfs_emit
Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
parent
dd00fe93ca
commit
cc4802bd26
|
|
@ -53,7 +53,7 @@ static struct led_classdev ap_led = {
|
||||||
|
|
||||||
static ssize_t ap_led_invert_show(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t ap_led_invert_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%d\n", (int)ap_led_invert);
|
return sysfs_emit(buf, "%d\n", (int)ap_led_invert);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t ap_led_invert_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
|
static ssize_t ap_led_invert_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
|
||||||
|
|
|
||||||
20
src/hwmon.c
20
src/hwmon.c
|
|
@ -56,7 +56,7 @@ static int s76_write_pwm_auto(int idx)
|
||||||
static ssize_t s76_hwmon_show_name(struct device *dev,
|
static ssize_t s76_hwmon_show_name(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, S76_DRIVER_NAME "\n");
|
return sysfs_emit(buf, S76_DRIVER_NAME "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_fan_input(struct device *dev,
|
static ssize_t s76_hwmon_show_fan_input(struct device *dev,
|
||||||
|
|
@ -64,7 +64,7 @@ static ssize_t s76_hwmon_show_fan_input(struct device *dev,
|
||||||
{
|
{
|
||||||
int index = to_sensor_dev_attr(attr)->index;
|
int index = to_sensor_dev_attr(attr)->index;
|
||||||
|
|
||||||
return sprintf(buf, "%i\n", s76_read_fan(index));
|
return sysfs_emit(buf, "%i\n", s76_read_fan(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_fan_label(struct device *dev,
|
static ssize_t s76_hwmon_show_fan_label(struct device *dev,
|
||||||
|
|
@ -72,9 +72,9 @@ static ssize_t s76_hwmon_show_fan_label(struct device *dev,
|
||||||
{
|
{
|
||||||
switch (to_sensor_dev_attr(attr)->index) {
|
switch (to_sensor_dev_attr(attr)->index) {
|
||||||
case 0:
|
case 0:
|
||||||
return sprintf(buf, "CPU fan\n");
|
return sysfs_emit(buf, "CPU fan\n");
|
||||||
case 1:
|
case 1:
|
||||||
return sprintf(buf, "GPU fan\n");
|
return sysfs_emit(buf, "GPU fan\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +86,7 @@ static ssize_t s76_hwmon_show_pwm(struct device *dev,
|
||||||
{
|
{
|
||||||
int index = to_sensor_dev_attr(attr)->index;
|
int index = to_sensor_dev_attr(attr)->index;
|
||||||
|
|
||||||
return sprintf(buf, "%i\n", s76_read_pwm(index));
|
return sysfs_emit(buf, "%i\n", s76_read_pwm(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_set_pwm(struct device *dev,
|
static ssize_t s76_hwmon_set_pwm(struct device *dev,
|
||||||
|
|
@ -113,7 +113,7 @@ static ssize_t s76_hwmon_show_pwm_enable(struct device *dev,
|
||||||
{
|
{
|
||||||
int index = to_sensor_dev_attr(attr)->index;
|
int index = to_sensor_dev_attr(attr)->index;
|
||||||
|
|
||||||
return sprintf(buf, "%i\n", pwm_enabled[index]);
|
return sysfs_emit(buf, "%i\n", pwm_enabled[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_set_pwm_enable(struct device *dev,
|
static ssize_t s76_hwmon_set_pwm_enable(struct device *dev,
|
||||||
|
|
@ -156,13 +156,13 @@ static ssize_t s76_hwmon_show_temp1_input(struct device *dev,
|
||||||
u8 value;
|
u8 value;
|
||||||
|
|
||||||
ec_read(0x07, &value);
|
ec_read(0x07, &value);
|
||||||
return sprintf(buf, "%i\n", value * 1000);
|
return sysfs_emit(buf, "%i\n", value * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_temp1_label(struct device *dev,
|
static ssize_t s76_hwmon_show_temp1_label(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "CPU temperature\n");
|
return sysfs_emit(buf, "CPU temperature\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL
|
#ifdef EXPERIMENTAL
|
||||||
|
|
@ -172,13 +172,13 @@ static ssize_t s76_hwmon_show_temp2_input(struct device *dev,
|
||||||
u8 value;
|
u8 value;
|
||||||
|
|
||||||
ec_read(0xcd, &value);
|
ec_read(0xcd, &value);
|
||||||
return sprintf(buf, "%i\n", value * 1000);
|
return sysfs_emit(buf, "%i\n", value * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_temp2_label(struct device *dev,
|
static ssize_t s76_hwmon_show_temp2_label(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "GPU temperature\n");
|
return sysfs_emit(buf, "GPU temperature\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ static struct led_classdev kb_led = {
|
||||||
|
|
||||||
static ssize_t kb_led_color_show(enum kb_led_region region, char *buf)
|
static ssize_t kb_led_color_show(enum kb_led_region region, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%06X\n", (int)kb_led_regions[region].rgb);
|
return sysfs_emit(buf, "%06X\n", (int)kb_led_regions[region].rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t kb_led_color_store(enum kb_led_region region, const char *buf, size_t size)
|
static ssize_t kb_led_color_store(enum kb_led_region region, const char *buf, size_t size)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue