| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * POWER platform energy management driver |
|---|
| 3 | 4 | * 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. |
|---|
| 8 | 5 | * |
|---|
| 9 | 6 | * This pseries platform device driver provides access to |
|---|
| 10 | 7 | * platform energy management capabilities. |
|---|
| .. | .. |
|---|
| 39 | 36 | static u32 cpu_to_drc_index(int cpu) |
|---|
| 40 | 37 | { |
|---|
| 41 | 38 | struct device_node *dn = NULL; |
|---|
| 39 | + struct property *info; |
|---|
| 42 | 40 | int thread_index; |
|---|
| 43 | 41 | int rc = 1; |
|---|
| 44 | 42 | u32 ret = 0; |
|---|
| .. | .. |
|---|
| 50 | 48 | /* Convert logical cpu number to core number */ |
|---|
| 51 | 49 | thread_index = cpu_core_index_of_thread(cpu); |
|---|
| 52 | 50 | |
|---|
| 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) { |
|---|
| 55 | 53 | struct of_drc_info drc; |
|---|
| 56 | 54 | int j; |
|---|
| 57 | 55 | u32 num_set_entries; |
|---|
| 58 | 56 | const __be32 *value; |
|---|
| 59 | 57 | |
|---|
| 60 | | - info = of_find_property(dn, "ibm,drc-info", NULL); |
|---|
| 61 | | - if (info == NULL) |
|---|
| 62 | | - goto err_of_node_put; |
|---|
| 63 | | - |
|---|
| 64 | 58 | value = of_prop_next_u32(info, NULL, &num_set_entries); |
|---|
| 65 | 59 | if (!value) |
|---|
| 66 | 60 | goto err_of_node_put; |
|---|
| 61 | + else |
|---|
| 62 | + value++; |
|---|
| 67 | 63 | |
|---|
| 68 | 64 | for (j = 0; j < num_set_entries; j++) { |
|---|
| 69 | 65 | |
|---|
| .. | .. |
|---|
| 113 | 109 | static int drc_index_to_cpu(u32 drc_index) |
|---|
| 114 | 110 | { |
|---|
| 115 | 111 | struct device_node *dn = NULL; |
|---|
| 112 | + struct property *info; |
|---|
| 116 | 113 | const int *indexes; |
|---|
| 117 | 114 | int thread_index = 0, cpu = 0; |
|---|
| 118 | 115 | int rc = 1; |
|---|
| .. | .. |
|---|
| 120 | 117 | dn = of_find_node_by_path("/cpus"); |
|---|
| 121 | 118 | if (dn == NULL) |
|---|
| 122 | 119 | 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) { |
|---|
| 126 | 122 | struct of_drc_info drc; |
|---|
| 127 | 123 | int j; |
|---|
| 128 | 124 | u32 num_set_entries; |
|---|
| 129 | 125 | const __be32 *value; |
|---|
| 130 | 126 | |
|---|
| 131 | | - info = of_find_property(dn, "ibm,drc-info", NULL); |
|---|
| 132 | | - if (info == NULL) |
|---|
| 133 | | - goto err_of_node_put; |
|---|
| 134 | | - |
|---|
| 135 | 127 | value = of_prop_next_u32(info, NULL, &num_set_entries); |
|---|
| 136 | 128 | if (!value) |
|---|
| 137 | 129 | goto err_of_node_put; |
|---|
| 130 | + else |
|---|
| 131 | + value++; |
|---|
| 138 | 132 | |
|---|
| 139 | 133 | for (j = 0; j < num_set_entries; j++) { |
|---|
| 140 | 134 | |
|---|