diff options
| author | Alex Shi <alex.shi@linaro.org> | 2016-05-12 12:20:36 +0800 |
|---|---|---|
| committer | Alex Shi <alex.shi@linaro.org> | 2016-05-12 12:20:36 +0800 |
| commit | e37ddf27108a992e191b27df9bd532cb9157dc89 (patch) | |
| tree | dd86e72414ae0b235679a992dfd408cc19fd2ab6 /include/linux | |
| parent | 9ba733e2628196c5f211875122c8fc6de108c19e (diff) | |
| parent | 4c2795dd50f98fa162cb53190eb557be44f92f58 (diff) | |
Merge tag 'v4.4.10' into linux-linaro-lsk-v4.4
This is the 4.4.10 stable release
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/clk-provider.h | 1 | ||||
| -rw-r--r-- | include/linux/hash.h | 20 |
2 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index c56988ac63f7..7cd0171963ae 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -384,6 +384,7 @@ struct clk_divider { #define CLK_DIVIDER_MAX_AT_ZERO BIT(6) extern const struct clk_ops clk_divider_ops; +extern const struct clk_ops clk_divider_ro_ops; unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, unsigned int val, const struct clk_div_table *table, diff --git a/include/linux/hash.h b/include/linux/hash.h index 1afde47e1528..79c52fa81cac 100644 --- a/include/linux/hash.h +++ b/include/linux/hash.h @@ -32,12 +32,28 @@ #error Wordsize not 32 or 64 #endif +/* + * The above primes are actively bad for hashing, since they are + * too sparse. The 32-bit one is mostly ok, the 64-bit one causes + * real problems. Besides, the "prime" part is pointless for the + * multiplicative hash. + * + * Although a random odd number will do, it turns out that the golden + * ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice + * properties. + * + * These are the negative, (1 - phi) = (phi^2) = (3 - sqrt(5))/2. + * (See Knuth vol 3, section 6.4, exercise 9.) + */ +#define GOLDEN_RATIO_32 0x61C88647 +#define GOLDEN_RATIO_64 0x61C8864680B583EBull + static __always_inline u64 hash_64(u64 val, unsigned int bits) { u64 hash = val; -#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 - hash = hash * GOLDEN_RATIO_PRIME_64; +#if BITS_PER_LONG == 64 + hash = hash * GOLDEN_RATIO_64; #else /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ u64 n = hash; |
