#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/device.h>
#include <linux/string.h>
#include <linux/jiffies.h>
#include "thermal_core.h"
type_show(struct device *dev, struct device_attribute *attr, char *buf)
struct thermal_zone_device *tz = to_thermal_zone(dev);
return sprintf(buf, "%s\n", tz->type);
temp_show(struct device *dev, struct device_attribute *attr, char *buf)
struct thermal_zone_device *tz = to_thermal_zone(dev);
ret = thermal_zone_get_temp(tz, &temperature);
return sprintf(buf, "%d\n", temperature);
mode_show(struct device *dev, struct device_attribute *attr, char *buf)
struct thermal_zone_device *tz = to_thermal_zone(dev);
enum thermal_device_mode mode;
result = tz->ops->get_mode(tz, &mode);
return sprintf(buf, "%s\n", mode == THERMAL_DEVICE_ENABLED ? "enabled"
mode_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
struct thermal_zone_device *tz = to_thermal_zone(dev);
if (!strncmp(buf, "enabled", sizeof("enabled") - 1))
result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED);
else if (!strncmp(buf, "disabled", sizeof("disabled") - 1))
result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED);
trip_point_type_show(struct device *dev, struct device_attribute *attr,