fix: cpu/hotplug: Remove deprecated CPU-hotplug functions. (v5.15)
[lttng-modules.git] / wrapper / cpu.h
diff --git a/wrapper/cpu.h b/wrapper/cpu.h
new file mode 100644 (file)
index 0000000..f0cfcdf
--- /dev/null
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * wrapper/cpu.h
+ *
+ * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
+ */
+
+#ifndef _LTTNG_WRAPPER_CPU_H
+#define _LTTNG_WRAPPER_CPU_H
+
+#include <linux/cpu.h>
+#include <lttng-kernel-version.h>
+
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0))
+
+static inline
+void lttng_cpus_read_lock(void)
+{
+       cpus_read_lock();
+}
+
+static inline
+void lttng_cpus_read_unlock(void)
+{
+       cpus_read_unlock();
+}
+
+#else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */
+
+static inline
+void lttng_cpus_read_lock(void)
+{
+       get_online_cpus();
+}
+
+static inline
+void lttng_cpus_read_unlock(void)
+{
+       put_online_cpus();
+}
+
+#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */
+
+#endif /* _LTTNG_WRAPPER_CPU_H */
This page took 0.025682 seconds and 4 git commands to generate.