Skip to content

Commit 7ef377c

Browse files
committed
lib/crc: make the CPU feature static keys __ro_after_init
All of the CRC library's CPU feature static_keys are initialized by initcalls and never change afterwards, so there's no need for them to be in the regular .data section. Put them in .data..ro_after_init instead. Reviewed-by: "Martin K. Petersen" <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Acked-by: Heiko Carstens <[email protected]> # s390 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 8ffd015 commit 7ef377c

File tree

12 files changed

+16
-16
lines changed

12 files changed

+16
-16
lines changed

arch/arm/lib/crc-t10dif-glue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include <asm/neon.h>
1717
#include <asm/simd.h>
1818

19-
static DEFINE_STATIC_KEY_FALSE(have_neon);
20-
static DEFINE_STATIC_KEY_FALSE(have_pmull);
19+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon);
20+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull);
2121

2222
#define CRC_T10DIF_PMULL_CHUNK_SIZE 16U
2323

arch/arm/lib/crc32-glue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <asm/neon.h>
1919
#include <asm/simd.h>
2020

21-
static DEFINE_STATIC_KEY_FALSE(have_crc32);
22-
static DEFINE_STATIC_KEY_FALSE(have_pmull);
21+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32);
22+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull);
2323

2424
#define PMULL_MIN_LEN 64 /* min size of buffer for pmull functions */
2525

arch/arm64/lib/crc-t10dif-glue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#include <asm/neon.h>
1818
#include <asm/simd.h>
1919

20-
static DEFINE_STATIC_KEY_FALSE(have_asimd);
21-
static DEFINE_STATIC_KEY_FALSE(have_pmull);
20+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_asimd);
21+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull);
2222

2323
#define CRC_T10DIF_PMULL_CHUNK_SIZE 16U
2424

arch/loongarch/lib/crc32-loongarch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ do { \
2626
#define CRC32(crc, value, size) _CRC32(crc, value, size, crc)
2727
#define CRC32C(crc, value, size) _CRC32(crc, value, size, crcc)
2828

29-
static DEFINE_STATIC_KEY_FALSE(have_crc32);
29+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32);
3030

3131
u32 crc32_le_arch(u32 crc, const u8 *p, size_t len)
3232
{

arch/mips/lib/crc32-mips.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ do { \
6262
#define CRC32C(crc, value, size) \
6363
_CRC32(crc, value, size, crc32c)
6464

65-
static DEFINE_STATIC_KEY_FALSE(have_crc32);
65+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32);
6666

6767
u32 crc32_le_arch(u32 crc, const u8 *p, size_t len)
6868
{

arch/powerpc/lib/crc-t10dif-glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#define VECTOR_BREAKPOINT 64
2323

24-
static DEFINE_STATIC_KEY_FALSE(have_vec_crypto);
24+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_vec_crypto);
2525

2626
u32 __crct10dif_vpmsum(u32 crc, unsigned char const *p, size_t len);
2727

arch/powerpc/lib/crc32-glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#define VECTOR_BREAKPOINT 512
1515

16-
static DEFINE_STATIC_KEY_FALSE(have_vec_crypto);
16+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_vec_crypto);
1717

1818
u32 __crc32c_vpmsum(u32 crc, const u8 *p, size_t len);
1919

arch/s390/lib/crc32-glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define VX_ALIGNMENT 16L
1919
#define VX_ALIGN_MASK (VX_ALIGNMENT - 1)
2020

21-
static DEFINE_STATIC_KEY_FALSE(have_vxrs);
21+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_vxrs);
2222

2323
/*
2424
* DEFINE_CRC32_VX() - Define a CRC-32 function using the vector extension

arch/sparc/lib/crc32_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <asm/pstate.h>
1818
#include <asm/elf.h>
1919

20-
static DEFINE_STATIC_KEY_FALSE(have_crc32c_opcode);
20+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32c_opcode);
2121

2222
u32 crc32_le_arch(u32 crc, const u8 *data, size_t len)
2323
{

arch/x86/lib/crc-t10dif-glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <linux/module.h>
1010
#include "crc-pclmul-template.h"
1111

12-
static DEFINE_STATIC_KEY_FALSE(have_pclmulqdq);
12+
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pclmulqdq);
1313

1414
DECLARE_CRC_PCLMUL_FUNCS(crc16_msb, u16);
1515

0 commit comments

Comments
 (0)