Skip to content

Commit 7a5917e

Browse files
jbeulichH. Peter Anvin
authored andcommitted
x86, hash: Simplify switch, add __init annotation
Minor cleanups: - simplify switch statement - add __init annotation to setup_arch_fast_hash() Signed-off-by: Jan Beulich <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Cc: Francesco Fusco <[email protected]> Cc: Thomas Graf <[email protected]> Cc: David S. Miller <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: H. Peter Anvin <[email protected]>
1 parent c5cdfdf commit 7a5917e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/x86/lib/hash.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
*/
3333

3434
#include <linux/hash.h>
35+
#include <linux/init.h>
3536

3637
#include <asm/processor.h>
3738
#include <asm/cpufeature.h>
@@ -55,17 +56,16 @@ static u32 intel_crc4_2_hash(const void *data, u32 len, u32 seed)
5556
for (i = 0; i < len / 4; i++)
5657
seed = crc32_u32(seed, *p32++);
5758

58-
switch (3 - (len & 0x03)) {
59-
case 0:
59+
switch (len & 3) {
60+
case 3:
6061
tmp |= *((const u8 *) p32 + 2) << 16;
6162
/* fallthrough */
62-
case 1:
63+
case 2:
6364
tmp |= *((const u8 *) p32 + 1) << 8;
6465
/* fallthrough */
65-
case 2:
66+
case 1:
6667
tmp |= *((const u8 *) p32);
6768
seed = crc32_u32(seed, tmp);
68-
default:
6969
break;
7070
}
7171

@@ -83,7 +83,7 @@ static u32 intel_crc4_2_hash2(const u32 *data, u32 len, u32 seed)
8383
return seed;
8484
}
8585

86-
void setup_arch_fast_hash(struct fast_hash_ops *ops)
86+
void __init setup_arch_fast_hash(struct fast_hash_ops *ops)
8787
{
8888
if (cpu_has_xmm4_2) {
8989
ops->hash = intel_crc4_2_hash;

0 commit comments

Comments
 (0)