Commit 648c7fb1 authored by Eric Biggers's avatar Eric Biggers
Browse files

lib/crc: make arch-optimized code use subsys_initcall

Make the architecture-optimized CRC code do its CPU feature checks in
subsys_initcalls instead of arch_initcalls.  This makes it consistent
with arch/*/lib/crypto/ and ensures that it runs after initcalls that
possibly could be a prerequisite for kernel-mode FPU, such as x86's
xfd_update_static_branch() and loongarch's init_euen_mask().

Note: as far as I can tell, x86's xfd_update_static_branch() isn't
*actually* needed for kernel-mode FPU.  loongarch's init_euen_mask() is
needed to enable save/restore of the vector registers, but loongarch
doesn't yet have any CRC or crypto code that uses vector registers
anyway.  Regardless, let's be consistent with arch/*/lib/crypto/ and
robust against any potential future dependency on an arch_initcall.

Link: https://lore.kernel.org/r/20250510035959.87995-1-ebiggers@kernel.org


Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
parent 46e33116
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ static int __init crc_t10dif_arm_init(void)
	}
	return 0;
}
arch_initcall(crc_t10dif_arm_init);
subsys_initcall(crc_t10dif_arm_init);

static void __exit crc_t10dif_arm_exit(void)
{
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ static int __init crc32_arm_init(void)
		static_branch_enable(&have_pmull);
	return 0;
}
arch_initcall(crc32_arm_init);
subsys_initcall(crc32_arm_init);

static void __exit crc32_arm_exit(void)
{
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ static int __init crc_t10dif_arm64_init(void)
	}
	return 0;
}
arch_initcall(crc_t10dif_arm64_init);
subsys_initcall(crc_t10dif_arm64_init);

static void __exit crc_t10dif_arm64_exit(void)
{
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ static int __init crc32_loongarch_init(void)
		static_branch_enable(&have_crc32);
	return 0;
}
arch_initcall(crc32_loongarch_init);
subsys_initcall(crc32_loongarch_init);

static void __exit crc32_loongarch_exit(void)
{
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ static int __init crc32_mips_init(void)
		static_branch_enable(&have_crc32);
	return 0;
}
arch_initcall(crc32_mips_init);
subsys_initcall(crc32_mips_init);

static void __exit crc32_mips_exit(void)
{
Loading