Commit 7ef377c4 authored by Eric Biggers's avatar Eric Biggers
Browse files

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: default avatar"Martin K. Petersen" <martin.petersen@oracle.com>
Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
Acked-by: Heiko Carstens <hca@linux.ibm.com> # s390
Link: https://lore.kernel.org/r/20250413154350.10819-1-ebiggers@kernel.org


Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
parent 8ffd015d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@
#include <asm/neon.h>
#include <asm/simd.h>

static DEFINE_STATIC_KEY_FALSE(have_neon);
static DEFINE_STATIC_KEY_FALSE(have_pmull);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull);

#define CRC_T10DIF_PMULL_CHUNK_SIZE	16U

+2 −2
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@
#include <asm/neon.h>
#include <asm/simd.h>

static DEFINE_STATIC_KEY_FALSE(have_crc32);
static DEFINE_STATIC_KEY_FALSE(have_pmull);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull);

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

+2 −2
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@
#include <asm/neon.h>
#include <asm/simd.h>

static DEFINE_STATIC_KEY_FALSE(have_asimd);
static DEFINE_STATIC_KEY_FALSE(have_pmull);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_asimd);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull);

#define CRC_T10DIF_PMULL_CHUNK_SIZE	16U

+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ do { \
#define CRC32(crc, value, size)		_CRC32(crc, value, size, crc)
#define CRC32C(crc, value, size)	_CRC32(crc, value, size, crcc)

static DEFINE_STATIC_KEY_FALSE(have_crc32);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32);

u32 crc32_le_arch(u32 crc, const u8 *p, size_t len)
{
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ do { \
#define CRC32C(crc, value, size) \
	_CRC32(crc, value, size, crc32c)

static DEFINE_STATIC_KEY_FALSE(have_crc32);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32);

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