hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/powerpc/platforms/pseries/pseries_energy.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * POWER platform energy management driver
34 * Copyright (C) 2010 IBM Corporation
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License
7
- * version 2 as published by the Free Software Foundation.
85 *
96 * This pseries platform device driver provides access to
107 * platform energy management capabilities.
....@@ -39,6 +36,7 @@
3936 static u32 cpu_to_drc_index(int cpu)
4037 {
4138 struct device_node *dn = NULL;
39
+ struct property *info;
4240 int thread_index;
4341 int rc = 1;
4442 u32 ret = 0;
....@@ -50,20 +48,18 @@
5048 /* Convert logical cpu number to core number */
5149 thread_index = cpu_core_index_of_thread(cpu);
5250
53
- if (firmware_has_feature(FW_FEATURE_DRC_INFO)) {
54
- struct property *info = NULL;
51
+ info = of_find_property(dn, "ibm,drc-info", NULL);
52
+ if (info) {
5553 struct of_drc_info drc;
5654 int j;
5755 u32 num_set_entries;
5856 const __be32 *value;
5957
60
- info = of_find_property(dn, "ibm,drc-info", NULL);
61
- if (info == NULL)
62
- goto err_of_node_put;
63
-
6458 value = of_prop_next_u32(info, NULL, &num_set_entries);
6559 if (!value)
6660 goto err_of_node_put;
61
+ else
62
+ value++;
6763
6864 for (j = 0; j < num_set_entries; j++) {
6965
....@@ -113,6 +109,7 @@
113109 static int drc_index_to_cpu(u32 drc_index)
114110 {
115111 struct device_node *dn = NULL;
112
+ struct property *info;
116113 const int *indexes;
117114 int thread_index = 0, cpu = 0;
118115 int rc = 1;
....@@ -120,21 +117,18 @@
120117 dn = of_find_node_by_path("/cpus");
121118 if (dn == NULL)
122119 goto err;
123
-
124
- if (firmware_has_feature(FW_FEATURE_DRC_INFO)) {
125
- struct property *info = NULL;
120
+ info = of_find_property(dn, "ibm,drc-info", NULL);
121
+ if (info) {
126122 struct of_drc_info drc;
127123 int j;
128124 u32 num_set_entries;
129125 const __be32 *value;
130126
131
- info = of_find_property(dn, "ibm,drc-info", NULL);
132
- if (info == NULL)
133
- goto err_of_node_put;
134
-
135127 value = of_prop_next_u32(info, NULL, &num_set_entries);
136128 if (!value)
137129 goto err_of_node_put;
130
+ else
131
+ value++;
138132
139133 for (j = 0; j < num_set_entries; j++) {
140134