diff options
author | Ahmed S. Darwish <a.darwish@linutronix.de> | 2021-10-16 10:49:06 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-10-18 12:54:41 +0100 |
commit | f2efdb17928924c9c935c136dea764a081032006 (patch) | |
tree | 1f58fd6320ef4622b06166a4d52fa56d53a8c0bf /include/linux/u64_stats_sync.h | |
parent | 10940eb746d417734fb9e5eba6df927e593e4f13 (diff) |
u64_stats: Introduce u64_stats_set()
Allow to directly set a u64_stats_t value which is used to provide an init
function which sets it directly to zero intead of memset() the value.
Add u64_stats_set() to the u64_stats API.
[bigeasy: commit message. ]
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/u64_stats_sync.h')
-rw-r--r-- | include/linux/u64_stats_sync.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h index e81856c0ba13..e8ec116c916b 100644 --- a/include/linux/u64_stats_sync.h +++ b/include/linux/u64_stats_sync.h @@ -83,6 +83,11 @@ static inline u64 u64_stats_read(const u64_stats_t *p) return local64_read(&p->v); } +static inline void u64_stats_set(u64_stats_t *p, u64 val) +{ + local64_set(&p->v, val); +} + static inline void u64_stats_add(u64_stats_t *p, unsigned long val) { local64_add(val, &p->v); @@ -104,6 +109,11 @@ static inline u64 u64_stats_read(const u64_stats_t *p) return p->v; } +static inline void u64_stats_set(u64_stats_t *p, u64 val) +{ + p->v = val; +} + static inline void u64_stats_add(u64_stats_t *p, unsigned long val) { p->v += val; |