From 6c3e787f9107ef5b8bde81ca49bf5567647fac70 Mon Sep 17 00:00:00 2001 From: "Siddha, Suresh B" Date: Sun, 30 Oct 2005 14:59:30 -0800 Subject: [PATCH] --- yaml --- r: 11755 b: refs/heads/master c: d16aafff2570abb557a5cb18c98027aabd602e22 h: refs/heads/master i: 11753: 93ae4cd8be2650b0092c50e7f4b3923308274309 11751: 5bc0b7fd9102bcdb9836c6371a64f6b81a64776f v: v3 --- [refs] | 2 +- trunk/arch/i386/kernel/cpu/intel_cacheinfo.c | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 762ec2cd3753..71f057d8f44c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d5cd4aadd3d220afac8e3e6d922e333592551f7d +refs/heads/master: d16aafff2570abb557a5cb18c98027aabd602e22 diff --git a/trunk/arch/i386/kernel/cpu/intel_cacheinfo.c b/trunk/arch/i386/kernel/cpu/intel_cacheinfo.c index 9e0d5f83cb9f..c802206274c2 100644 --- a/trunk/arch/i386/kernel/cpu/intel_cacheinfo.c +++ b/trunk/arch/i386/kernel/cpu/intel_cacheinfo.c @@ -117,7 +117,6 @@ struct _cpuid4_info { cpumask_t shared_cpu_map; }; -#define MAX_CACHE_LEAVES 4 static unsigned short num_cache_leaves; static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) @@ -144,20 +143,15 @@ static int __init find_num_cache_leaves(void) { unsigned int eax, ebx, ecx, edx; union _cpuid4_leaf_eax cache_eax; - int i; - int retval; + int i = -1; - retval = MAX_CACHE_LEAVES; - /* Do cpuid(4) loop to find out num_cache_leaves */ - for (i = 0; i < MAX_CACHE_LEAVES; i++) { + do { + ++i; + /* Do cpuid(4) loop to find out num_cache_leaves */ cpuid_count(4, i, &eax, &ebx, &ecx, &edx); cache_eax.full = eax; - if (cache_eax.split.type == CACHE_TYPE_NULL) { - retval = i; - break; - } - } - return retval; + } while (cache_eax.split.type != CACHE_TYPE_NULL); + return i; } unsigned int __devinit init_intel_cacheinfo(struct cpuinfo_x86 *c)