1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright(c) 2022 Intel Corporation. All rights reserved. */
3 #include <linux/atomic.h>
4 #include <linux/export.h>
5 #include "cxlmem.h"
6 
7 static atomic_t mem_active;
8 
cxl_mem_active(void)9 bool cxl_mem_active(void)
10 {
11 	return atomic_read(&mem_active) != 0;
12 }
13 
cxl_mem_active_inc(void)14 void cxl_mem_active_inc(void)
15 {
16 	atomic_inc(&mem_active);
17 }
18 EXPORT_SYMBOL_NS_GPL(cxl_mem_active_inc, CXL);
19 
cxl_mem_active_dec(void)20 void cxl_mem_active_dec(void)
21 {
22 	atomic_dec(&mem_active);
23 }
24 EXPORT_SYMBOL_NS_GPL(cxl_mem_active_dec, CXL);
25