- patches.apparmor/remove_suid_new_case_in_2.6.22.diff: Merge fix.
[linux-flexiantxendom0-3.2.10.git] / arch / powerpc / kernel / lparcfg.c
index 89486b6..c492cee 100644 (file)
@@ -130,30 +130,31 @@ static int iseries_lparcfg_data(struct seq_file *m, void *v)
 /*
  * Methods used to fetch LPAR data when running on a pSeries platform.
  */
-/* find a better place for this function... */
 static void log_plpar_hcall_return(unsigned long rc, char *tag)
 {
-       if (rc == 0)            /* success, return */
+       switch(rc) {
+       case 0:
                return;
-/* check for null tag ? */
-       if (rc == H_HARDWARE)
-               printk(KERN_INFO
-                      "plpar-hcall (%s) failed with hardware fault\n", tag);
-       else if (rc == H_FUNCTION)
-               printk(KERN_INFO
-                      "plpar-hcall (%s) failed; function not allowed\n", tag);
-       else if (rc == H_AUTHORITY)
-               printk(KERN_INFO
-                      "plpar-hcall (%s) failed; not authorized to this"
-                      " function\n", tag);
-       else if (rc == H_PARAMETER)
-               printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n",
-                      tag);
-       else
-               printk(KERN_INFO
-                      "plpar-hcall (%s) failed with unexpected rc(0x%lx)\n",
-                      tag, rc);
-
+       case H_HARDWARE:
+               printk(KERN_INFO "plpar-hcall (%s) "
+                               "Hardware fault\n", tag);
+               return;
+       case H_FUNCTION:
+               printk(KERN_INFO "plpar-hcall (%s) "
+                               "Function not allowed\n", tag);
+               return;
+       case H_AUTHORITY:
+               printk(KERN_INFO "plpar-hcall (%s) "
+                               "Not authorized to this function\n", tag);
+               return;
+       case H_PARAMETER:
+               printk(KERN_INFO "plpar-hcall (%s) "
+                               "Bad parameter(s)\n",tag);
+               return;
+       default:
+               printk(KERN_INFO "plpar-hcall (%s) "
+                               "Unexpected rc(0x%lx)\n", tag, rc);
+       }
 }
 
 /*
@@ -321,15 +322,16 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
        struct device_node *rtas_node;
        const int *lrdrp = NULL;
 
-       rtas_node = find_path_device("/rtas");
+       rtas_node = of_find_node_by_path("/rtas");
        if (rtas_node)
-               lrdrp = get_property(rtas_node, "ibm,lrdr-capacity", NULL);
+               lrdrp = of_get_property(rtas_node, "ibm,lrdr-capacity", NULL);
 
        if (lrdrp == NULL) {
                partition_potential_processors = vdso_data->processorCount;
        } else {
                partition_potential_processors = *(lrdrp + 4);
        }
+       of_node_put(rtas_node);
 
        partition_active_processors = lparcfg_count_active_processors();
 
@@ -537,25 +539,27 @@ static int lparcfg_data(struct seq_file *m, void *v)
 
        seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
 
-       rootdn = find_path_device("/");
+       rootdn = of_find_node_by_path("/");
        if (rootdn) {
-               tmp = get_property(rootdn, "model", NULL);
+               tmp = of_get_property(rootdn, "model", NULL);
                if (tmp) {
                        model = tmp;
                        /* Skip "IBM," - see platforms/iseries/dt.c */
                        if (firmware_has_feature(FW_FEATURE_ISERIES))
                                model += 4;
                }
-               tmp = get_property(rootdn, "system-id", NULL);
+               tmp = of_get_property(rootdn, "system-id", NULL);
                if (tmp) {
                        system_id = tmp;
                        /* Skip "IBM," - see platforms/iseries/dt.c */
                        if (firmware_has_feature(FW_FEATURE_ISERIES))
                                system_id += 4;
                }
-               lp_index_ptr = get_property(rootdn, "ibm,partition-no", NULL);
+               lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
+                                       NULL);
                if (lp_index_ptr)
                        lp_index = *lp_index_ptr;
+               of_node_put(rootdn);
        }
        seq_printf(m, "serial_number=%s\n", system_id);
        seq_printf(m, "system_type=%s\n", model);