/* * We need a second update in order to detect a threshold being crossed
*/ if (last_temperature == THERMAL_TEMP_INVALID) return;
/* * The temperature is stable, so obviously we can not have * crossed a threshold.
*/ if (last_temperature == temperature) return;
/* * Since last update the temperature: * - increased : thresholds are crossed the way up * - decreased : thresholds are crossed the way down
*/ if (temperature > last_temperature) { if (thermal_thresholds_handle_raising(thresholds,
temperature, last_temperature))
thermal_notify_threshold_up(tz);
} else { if (thermal_thresholds_handle_dropping(thresholds,
temperature, last_temperature))
thermal_notify_threshold_down(tz);
}
}
int thermal_thresholds_add(struct thermal_zone_device *tz, int temperature, int direction)
{ struct list_head *thresholds = &tz->user_thresholds; struct user_threshold *t;
lockdep_assert_held(&tz->lock);
t = __thermal_thresholds_find(thresholds, temperature); if (t) { if (t->direction == direction) return -EEXIST;
t->direction |= direction;
} else {
t = kmalloc(sizeof(*t), GFP_KERNEL); if (!t) return -ENOMEM;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.