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 <[EMAIL PROTECTED]>

---

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;
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to