diff options
| author | Gustavo Padovan <gustavo.padovan@collabora.com> | 2017-12-04 16:04:45 -0200 |
|---|---|---|
| committer | Gustavo Padovan <gustavo.padovan@collabora.com> | 2017-12-04 16:04:45 -0200 |
| commit | 7b47c66cfa203288c43851260edeeb0fae56f692 (patch) | |
| tree | fa729735fdaf1d77fbbf13062fd53c31b59d682d /include/linux/average.h | |
| parent | ca0e68e21aae10220eff71a297e7d794425add77 (diff) | |
| parent | ca797d29cd63e7b71b4eea29aff3b1cefd1ecb59 (diff) | |
Merge arlied/drm-next into drm-misc-next
We need to pull 66660d4cf21b (drm: add connector info/property for
non-desktop displays [v2]) into drm-misc-next to continue the development
of the display rotation series.
Effectively this also pulls 4.15-r2 into drm-misc-next.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Diffstat (limited to 'include/linux/average.h')
| -rw-r--r-- | include/linux/average.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/average.h b/include/linux/average.h index 7ddaf340d2ac..a1a8f09631ce 100644 --- a/include/linux/average.h +++ b/include/linux/average.h @@ -1,6 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_AVERAGE_H #define _LINUX_AVERAGE_H +#include <linux/bug.h> +#include <linux/compiler.h> +#include <linux/log2.h> + /* * Exponentially weighted moving average (EWMA) * @@ -48,7 +53,7 @@ static inline void ewma_##name##_add(struct ewma_##name *e, \ unsigned long val) \ { \ - unsigned long internal = ACCESS_ONCE(e->internal); \ + unsigned long internal = READ_ONCE(e->internal); \ unsigned long weight_rcp = ilog2(_weight_rcp); \ unsigned long precision = _precision; \ \ @@ -57,10 +62,10 @@ BUILD_BUG_ON((_precision) > 30); \ BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ \ - ACCESS_ONCE(e->internal) = internal ? \ + WRITE_ONCE(e->internal, internal ? \ (((internal << weight_rcp) - internal) + \ (val << precision)) >> weight_rcp : \ - (val << precision); \ + (val << precision)); \ } #endif /* _LINUX_AVERAGE_H */ |
