/* * Return the storage size of a structure with a variable length array. * The array is nelem elements of elem_size, where the base structure * is defined by base. If the size overflows size_t, return zero.
*/ staticinline size_t size_vstruct(size_t nelem, size_t elem_size, size_t base)
{ if (elem_size && nelem > (SIZE_MAX - base) / elem_size) return 0; return base + nelem * elem_size;
}
/* * Etnaviv timeouts are specified wrt CLOCK_MONOTONIC, not jiffies. * We need to calculate the timeout in terms of number of jiffies * between the specified timeout and the current CLOCK_MONOTONIC time.
*/ staticinlineunsignedlong etnaviv_timeout_to_jiffies( conststruct drm_etnaviv_timespec *timeout)
{ struct timespec64 ts, to = {
.tv_sec = timeout->tv_sec,
.tv_nsec = timeout->tv_nsec,
};
ktime_get_ts64(&ts);
/* timeouts before "now" have already expired */ if (timespec64_compare(&to, &ts) <= 0) return 0;
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.