printf: Remove unused 'bprintf'
[drm/drm-misc.git] / include / linux / win_minmax.h
blob6a5bb052fcc27f3820ddfc095f89100f8f5f12cb
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * win_minmax.h: windowed min/max tracker by Kathleen Nichols.
5 */
6 #ifndef MINMAX_H
7 #define MINMAX_H
9 #include <linux/types.h>
11 /* A single data point for our parameterized min-max tracker */
12 struct minmax_sample {
13 u32 t; /* time measurement was taken */
14 u32 v; /* value measured */
17 /* State for the parameterized min-max tracker */
18 struct minmax {
19 struct minmax_sample s[3];
22 static inline u32 minmax_get(const struct minmax *m)
24 return m->s[0].v;
27 static inline u32 minmax_reset(struct minmax *m, u32 t, u32 meas)
29 struct minmax_sample val = { .t = t, .v = meas };
31 m->s[2] = m->s[1] = m->s[0] = val;
32 return m->s[0].v;
35 u32 minmax_running_max(struct minmax *m, u32 win, u32 t, u32 meas);
36 u32 minmax_running_min(struct minmax *m, u32 win, u32 t, u32 meas);
38 #endif