summaryrefslogtreecommitdiffstats
path: root/kernel/platform-feature.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-06-10 15:55:32 -0700
committerJakub Kicinski <kuba@kernel.org>2022-06-10 15:55:32 -0700
commit5c281b4e529cd5a73b32ac561d79f448d18dda6f (patch)
tree30c3126d9015754c8cdb0bd77fae22ba36086f81 /kernel/platform-feature.c
parentb97dcb85750b7e8bc5aaed5403ddf4b0552c7993 (diff)
parentaa3398fb4b3f67d89688976098ad93721b6d7852 (diff)
downloadlinux-5c281b4e529cd5a73b32ac561d79f448d18dda6f.tar.gz
linux-5c281b4e529cd5a73b32ac561d79f448d18dda6f.tar.bz2
linux-5c281b4e529cd5a73b32ac561d79f448d18dda6f.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
No conflicts. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'kernel/platform-feature.c')
-rw-r--r--kernel/platform-feature.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/platform-feature.c b/kernel/platform-feature.c
new file mode 100644
index 000000000000..cb6a6c3e4fed
--- /dev/null
+++ b/kernel/platform-feature.c
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/bitops.h>
+#include <linux/cache.h>
+#include <linux/export.h>
+#include <linux/platform-feature.h>
+
+#define PLATFORM_FEAT_ARRAY_SZ BITS_TO_LONGS(PLATFORM_FEAT_N)
+static unsigned long __read_mostly platform_features[PLATFORM_FEAT_ARRAY_SZ];
+
+void platform_set(unsigned int feature)
+{
+ set_bit(feature, platform_features);
+}
+EXPORT_SYMBOL_GPL(platform_set);
+
+void platform_clear(unsigned int feature)
+{
+ clear_bit(feature, platform_features);
+}
+EXPORT_SYMBOL_GPL(platform_clear);
+
+bool platform_has(unsigned int feature)
+{
+ return test_bit(feature, platform_features);
+}
+EXPORT_SYMBOL_GPL(platform_has);