{
struct thermal_zone_device *tz = to_thermal_zone(dev);
- return sprintf(buf, "%s\n", tz->type);
+ return sysfs_emit(buf, "%s\n", tz->type);
}
static ssize_t
ret = thermal_zone_get_temp(tz, &temperature);
if (!ret)
- return sprintf(buf, "%d\n", temperature);
+ return sysfs_emit(buf, "%d\n", temperature);
if (ret == -EAGAIN)
return -ENODATA;
guard(thermal_zone)(tz);
if (tz->mode == THERMAL_DEVICE_ENABLED)
- return sprintf(buf, "enabled\n");
+ return sysfs_emit(buf, "enabled\n");
- return sprintf(buf, "disabled\n");
+ return sysfs_emit(buf, "disabled\n");
}
static ssize_t
{
struct thermal_trip *trip = thermal_trip_of_attr(attr, type);
- return sprintf(buf, "%s\n", thermal_trip_type_name(trip->type));
+ return sysfs_emit(buf, "%s\n", thermal_trip_type_name(trip->type));
}
static ssize_t
{
struct thermal_trip *trip = thermal_trip_of_attr(attr, temp);
- return sprintf(buf, "%d\n", READ_ONCE(trip->temperature));
+ return sysfs_emit(buf, "%d\n", READ_ONCE(trip->temperature));
}
static ssize_t
{
struct thermal_trip *trip = thermal_trip_of_attr(attr, hyst);
- return sprintf(buf, "%d\n", READ_ONCE(trip->hysteresis));
+ return sysfs_emit(buf, "%d\n", READ_ONCE(trip->hysteresis));
}
static ssize_t
{
struct thermal_zone_device *tz = to_thermal_zone(dev);
- return sprintf(buf, "%s\n", tz->governor->name);
+ return sysfs_emit(buf, "%s\n", tz->governor->name);
}
static ssize_t
struct thermal_zone_device *tz = to_thermal_zone(dev);
if (tz->tzp)
- return sprintf(buf, "%u\n", tz->tzp->sustainable_power);
+ return sysfs_emit(buf, "%u\n", tz->tzp->sustainable_power);
else
return -EIO;
}
struct thermal_zone_device *tz = to_thermal_zone(dev); \
\
if (tz->tzp) \
- return sprintf(buf, "%d\n", tz->tzp->name); \
+ return sysfs_emit(buf, "%d\n", tz->tzp->name); \
else \
return -EIO; \
} \
{
struct thermal_cooling_device *cdev = to_cooling_device(dev);
- return sprintf(buf, "%s\n", cdev->type);
+ return sysfs_emit(buf, "%s\n", cdev->type);
}
static ssize_t max_state_show(struct device *dev, struct device_attribute *attr,
{
struct thermal_cooling_device *cdev = to_cooling_device(dev);
- return sprintf(buf, "%ld\n", cdev->max_state);
+ return sysfs_emit(buf, "%ld\n", cdev->max_state);
}
static ssize_t cur_state_show(struct device *dev, struct device_attribute *attr,
ret = cdev->ops->get_cur_state(cdev, &state);
if (ret)
return ret;
- return sprintf(buf, "%ld\n", state);
+ return sysfs_emit(buf, "%ld\n", state);
}
static ssize_t
return 0;
spin_lock(&stats->lock);
- ret = sprintf(buf, "%u\n", stats->total_trans);
+ ret = sysfs_emit(buf, "%u\n", stats->total_trans);
spin_unlock(&stats->lock);
return ret;
update_time_in_state(stats);
for (i = 0; i <= cdev->max_state; i++) {
- len += sprintf(buf + len, "state%u\t%llu\n", i,
- ktime_to_ms(stats->time_in_state[i]));
+ len += sysfs_emit_at(buf, len, "state%u\t%llu\n", i,
+ ktime_to_ms(stats->time_in_state[i]));
}
spin_unlock(&stats->lock);
instance = container_of(attr, struct thermal_instance, attr);
- return sprintf(buf, "%d\n", thermal_zone_trip_id(tz, instance->trip));
+ return sysfs_emit(buf, "%d\n", thermal_zone_trip_id(tz, instance->trip));
}
ssize_t
instance = container_of(attr, struct thermal_instance, weight_attr);
- return sprintf(buf, "%d\n", instance->weight);
+ return sysfs_emit(buf, "%d\n", instance->weight);
}
ssize_t weight_store(struct device *dev, struct device_attribute *attr,