* [PATCH] i386: remove extra spaces from cpu model id
@ 2005-03-06 7:32 Daniel Rozsnyo
2005-03-06 8:09 ` Dominik Brodowski
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Rozsnyo @ 2005-03-06 7:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Daniel Rozsnyo
Removes extra spaces which separate the frequency string from the cpu model id
itself (noticable e.g. on Intel Tualatin processors in /proc/cpuinfo)
Signed-off-by: Daniel Rozsnyo <daniel@rozsnyo.com>
---
diff -urN linux-2.6.11.orig/arch/i386/kernel/cpu/common.c linux-2.6.11/arch/i386/kernel/cpu/common.c
--- linux-2.6.11.orig/arch/i386/kernel/cpu/common.c 2005-03-02 08:37:47.000000000 +0100
+++ linux-2.6.11/arch/i386/kernel/cpu/common.c 2005-03-06 07:46:16.000000000 +0100
@@ -59,7 +59,7 @@
int __init get_model_name(struct cpuinfo_x86 *c)
{
unsigned int *v;
- char *p, *q;
+ char *src, *dst;
if (cpuid_eax(0x80000000) < 0x80000004)
return 0;
@@ -71,17 +71,25 @@
c->x86_model_id[48] = 0;
/* Intel chips right-justify this string for some dumb reason;
- undo that brain damage */
- p = q = &c->x86_model_id[0];
- while ( *p == ' ' )
- p++;
- if ( p != q ) {
- while ( *p )
- *q++ = *p++;
- while ( q <= &c->x86_model_id[48] )
- *q++ = '\0'; /* Zero-pad the rest */
+ undo that, and also remove multiple spaces from the middle */
+ src = dst = &c->x86_model_id[0];
+
+ while ( *src == ' ' ) /* find the start */
+ src++;
+
+ while ( *src ) {
+ *dst++ = *src++;
+ if ( *src == ' ' ) { /* first space: copy */
+ *dst++ = *src++;
+ }
+ while ( *src == ' ' ) { /* next spaces: skip */
+ src++;
+ }
}
+ while ( dst <= &c->x86_model_id[48] )
+ *dst++ = '\0'; /* zero-pad the rest */
+
return 1;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] i386: remove extra spaces from cpu model id
2005-03-06 7:32 [PATCH] i386: remove extra spaces from cpu model id Daniel Rozsnyo
@ 2005-03-06 8:09 ` Dominik Brodowski
0 siblings, 0 replies; 2+ messages in thread
From: Dominik Brodowski @ 2005-03-06 8:09 UTC (permalink / raw)
To: Daniel Rozsnyo; +Cc: Linus Torvalds, linux-kernel, Daniel Rozsnyo
On Sun, Mar 06, 2005 at 08:32:22AM +0100, Daniel Rozsnyo wrote:
> Removes extra spaces which separate the frequency string from the cpu model
> id itself (noticable e.g. on Intel Tualatin processors in /proc/cpuinfo)
>
> Signed-off-by: Daniel Rozsnyo <daniel@rozsnyo.com>
This patch breaks speedstep-centrino for 900 MHz Banias CPUs. Also,
I'd prefer to keep this the way it is reported by the CPU itself [except the
left/right padding], of course.
Dominik
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-03-06 8:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-06 7:32 [PATCH] i386: remove extra spaces from cpu model id Daniel Rozsnyo
2005-03-06 8:09 ` Dominik Brodowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®