Skip to content

Commit

Permalink
u64_stats: Introduce u64_stats_set()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
a-darwish authored and davem330 committed Oct 18, 2021
1 parent 10940eb commit f2efdb1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/linux/u64_stats_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit f2efdb1

Please sign in to comment.