char *buf)
{
struct thermal_zone_device *tz = to_thermal_zone(dev);
- enum thermal_trip_type type;
int trip_id;
if (sscanf(attr->attr.name, "trip_point_%d_type", &trip_id) != 1)
return -EINVAL;
- mutex_lock(&tz->lock);
-
- if (!device_is_registered(dev)) {
- mutex_unlock(&tz->lock);
- return -ENODEV;
- }
-
- type = tz->trips[trip_id].type;
-
- mutex_unlock(&tz->lock);
-
- switch (type) {
+ switch (tz->trips[trip_id].type) {
case THERMAL_TRIP_CRITICAL:
return sprintf(buf, "critical\n");
case THERMAL_TRIP_HOT:
mutex_lock(&tz->lock);
- if (!device_is_registered(dev)) {
- ret = -ENODEV;
- goto unlock;
- }
-
trip = &tz->trips[trip_id];
if (temp != trip->temperature) {
char *buf)
{
struct thermal_zone_device *tz = to_thermal_zone(dev);
- int trip_id, temp;
+ int trip_id;
if (sscanf(attr->attr.name, "trip_point_%d_temp", &trip_id) != 1)
return -EINVAL;
- mutex_lock(&tz->lock);
-
- if (!device_is_registered(dev)) {
- mutex_unlock(&tz->lock);
- return -ENODEV;
- }
-
- temp = tz->trips[trip_id].temperature;
-
- mutex_unlock(&tz->lock);
-
- return sprintf(buf, "%d\n", temp);
+ return sprintf(buf, "%d\n", tz->trips[trip_id].temperature);
}
static ssize_t
mutex_lock(&tz->lock);
- if (!device_is_registered(dev)) {
- ret = -ENODEV;
- goto unlock;
- }
-
trip = &tz->trips[trip_id];
if (hyst != trip->hysteresis) {
char *buf)
{
struct thermal_zone_device *tz = to_thermal_zone(dev);
- int trip_id, hyst;
+ int trip_id;
if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1)
return -EINVAL;
- mutex_lock(&tz->lock);
-
- if (!device_is_registered(dev)) {
- mutex_unlock(&tz->lock);
- return -ENODEV;
- }
-
- hyst = tz->trips[trip_id].hysteresis;
-
- mutex_unlock(&tz->lock);
-
- return sprintf(buf, "%d\n", hyst);
+ return sprintf(buf, "%d\n", tz->trips[trip_id].hysteresis);
}
static ssize_t
mutex_lock(&tz->lock);
- if (!device_is_registered(dev)) {
- ret = -ENODEV;
- goto unlock;
- }
-
if (!tz->ops->set_emul_temp)
tz->emul_temperature = temperature;
else
if (!ret)
__thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
-unlock:
mutex_unlock(&tz->lock);
return ret ? ret : count;