Merge to kernel-2.6.20-1.2949.fc6.vs2.2.0.1
[linux-2.6.git] / drivers / video / aty / radeon_monitor.c
index ea7c863..38c7dbf 100644 (file)
@@ -64,13 +64,13 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
 {
         static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID",
                                     "EDID1", "EDID2",  NULL };
-       u8 *pedid = NULL;
-       u8 *pmt = NULL;
+       const u8 *pedid = NULL;
+       const u8 *pmt = NULL;
        u8 *tmp;
         int i, mt = MT_NONE;  
        
        RTRACE("analyzing OF properties...\n");
-       pmt = (u8 *)get_property(dp, "display-type", NULL);
+       pmt = get_property(dp, "display-type", NULL);
        if (!pmt)
                return MT_NONE;
        RTRACE("display-type: %s\n", pmt);
@@ -89,7 +89,7 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
        }
 
        for (i = 0; propnames[i] != NULL; ++i) {
-               pedid = (u8 *)get_property(dp, propnames[i], NULL);
+               pedid = get_property(dp, propnames[i], NULL);
                if (pedid != NULL)
                        break;
        }
@@ -104,10 +104,9 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
        if (pedid == NULL)
                return mt;
 
-       tmp = (u8 *)kmalloc(EDID_LENGTH, GFP_KERNEL);
+       tmp = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
        if (!tmp)
                return mt;
-       memcpy(tmp, pedid, EDID_LENGTH);
        *out_EDID = tmp;
        return mt;
 }
@@ -124,14 +123,14 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_
                return MT_NONE;
 
        if (rinfo->has_CRTC2) {
-               char *pname;
+               const char *pname;
                int len, second = 0;
 
                dp = dp->child;
                do {
                        if (!dp)
                                return MT_NONE;
-                       pname = (char *)get_property(dp, "name", NULL);
+                       pname = get_property(dp, "name", NULL);
                        if (!pname)
                                return MT_NONE;
                        len = strlen(pname);
@@ -396,6 +395,10 @@ static int __devinit radeon_parse_monitor_layout(struct radeonfb_info *rinfo,
                                s1[i] = *s;
                        i++;
                }
+
+               if (i > 4)
+                       i = 4;
+
        } while (*s++);
        if (second)
                s2[i] = 0;
@@ -423,7 +426,7 @@ static int __devinit radeon_parse_monitor_layout(struct radeonfb_info *rinfo,
 /*
  * Probe display on both primary and secondary card's connector (if any)
  * by various available techniques (i2c, OF device tree, BIOS, ...) and
- * try to retreive EDID. The algorithm here comes from XFree's radeon
+ * try to retrieve EDID. The algorithm here comes from XFree's radeon
  * driver
  */
 void __devinit radeon_probe_screens(struct radeonfb_info *rinfo,