Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

reset: remove legacy reset lookup code

There are no more users of this code. Let's remove the exported symbols
and the implementation from reset core.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
[p.zabel@pengutronix.de: folded in 8e6ec20e-8965-4b42-99fc-0462269ff2f1@paulmck-laptop]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

authored by

Bartosz Golaszewski and committed by
Philipp Zabel
8bffbfdc a86aaf2b

+3 -154
+3 -121
drivers/reset/core.c
··· 25 25 static DEFINE_MUTEX(reset_list_mutex); 26 26 static LIST_HEAD(reset_controller_list); 27 27 28 - static DEFINE_MUTEX(reset_lookup_mutex); 29 - static LIST_HEAD(reset_lookup_list); 30 - 31 28 /* Protects reset_gpio_lookup_list */ 32 29 static DEFINE_MUTEX(reset_gpio_lookup_mutex); 33 30 static LIST_HEAD(reset_gpio_lookup_list); ··· 186 189 return ret; 187 190 } 188 191 EXPORT_SYMBOL_GPL(devm_reset_controller_register); 189 - 190 - /** 191 - * reset_controller_add_lookup - register a set of lookup entries 192 - * @lookup: array of reset lookup entries 193 - * @num_entries: number of entries in the lookup array 194 - */ 195 - void reset_controller_add_lookup(struct reset_control_lookup *lookup, 196 - unsigned int num_entries) 197 - { 198 - struct reset_control_lookup *entry; 199 - unsigned int i; 200 - 201 - mutex_lock(&reset_lookup_mutex); 202 - for (i = 0; i < num_entries; i++) { 203 - entry = &lookup[i]; 204 - 205 - if (!entry->dev_id || !entry->provider) { 206 - pr_warn("%s(): reset lookup entry badly specified, skipping\n", 207 - __func__); 208 - continue; 209 - } 210 - 211 - list_add_tail(&entry->list, &reset_lookup_list); 212 - } 213 - mutex_unlock(&reset_lookup_mutex); 214 - } 215 - EXPORT_SYMBOL_GPL(reset_controller_add_lookup); 216 192 217 193 static inline struct reset_control_array * 218 194 rstc_to_array(struct reset_control *rstc) { ··· 1051 1081 } 1052 1082 EXPORT_SYMBOL_GPL(__of_reset_control_get); 1053 1083 1054 - static struct reset_controller_dev * 1055 - __reset_controller_by_name(const char *name) 1056 - { 1057 - struct reset_controller_dev *rcdev; 1058 - 1059 - lockdep_assert_held(&reset_list_mutex); 1060 - 1061 - list_for_each_entry(rcdev, &reset_controller_list, list) { 1062 - if (!rcdev->dev) 1063 - continue; 1064 - 1065 - if (!strcmp(name, dev_name(rcdev->dev))) 1066 - return rcdev; 1067 - } 1068 - 1069 - return NULL; 1070 - } 1071 - 1072 - static struct reset_control * 1073 - __reset_control_get_from_lookup(struct device *dev, const char *con_id, 1074 - enum reset_control_flags flags) 1075 - { 1076 - bool optional = flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; 1077 - const struct reset_control_lookup *lookup; 1078 - struct reset_controller_dev *rcdev; 1079 - const char *dev_id = dev_name(dev); 1080 - struct reset_control *rstc = NULL; 1081 - 1082 - mutex_lock(&reset_lookup_mutex); 1083 - 1084 - list_for_each_entry(lookup, &reset_lookup_list, list) { 1085 - if (strcmp(lookup->dev_id, dev_id)) 1086 - continue; 1087 - 1088 - if ((!con_id && !lookup->con_id) || 1089 - ((con_id && lookup->con_id) && 1090 - !strcmp(con_id, lookup->con_id))) { 1091 - mutex_lock(&reset_list_mutex); 1092 - rcdev = __reset_controller_by_name(lookup->provider); 1093 - if (!rcdev) { 1094 - mutex_unlock(&reset_list_mutex); 1095 - mutex_unlock(&reset_lookup_mutex); 1096 - /* Reset provider may not be ready yet. */ 1097 - return ERR_PTR(-EPROBE_DEFER); 1098 - } 1099 - 1100 - flags &= ~RESET_CONTROL_FLAGS_BIT_OPTIONAL; 1101 - 1102 - rstc = __reset_control_get_internal(rcdev, 1103 - lookup->index, 1104 - flags); 1105 - mutex_unlock(&reset_list_mutex); 1106 - break; 1107 - } 1108 - } 1109 - 1110 - mutex_unlock(&reset_lookup_mutex); 1111 - 1112 - if (!rstc) 1113 - return optional ? NULL : ERR_PTR(-ENOENT); 1114 - 1115 - return rstc; 1116 - } 1117 - 1118 1084 struct reset_control *__reset_control_get(struct device *dev, const char *id, 1119 1085 int index, enum reset_control_flags flags) 1120 1086 { 1121 1087 bool shared = flags & RESET_CONTROL_FLAGS_BIT_SHARED; 1122 1088 bool acquired = flags & RESET_CONTROL_FLAGS_BIT_ACQUIRED; 1089 + bool optional = flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL; 1123 1090 1124 1091 if (WARN_ON(shared && acquired)) 1125 1092 return ERR_PTR(-EINVAL); ··· 1064 1157 if (dev->of_node) 1065 1158 return __of_reset_control_get(dev->of_node, id, index, flags); 1066 1159 1067 - return __reset_control_get_from_lookup(dev, id, flags); 1160 + return optional ? NULL : ERR_PTR(-ENOENT); 1068 1161 } 1069 1162 EXPORT_SYMBOL_GPL(__reset_control_get); 1070 1163 ··· 1399 1492 } 1400 1493 EXPORT_SYMBOL_GPL(devm_reset_control_array_get); 1401 1494 1402 - static int reset_control_get_count_from_lookup(struct device *dev) 1403 - { 1404 - const struct reset_control_lookup *lookup; 1405 - const char *dev_id; 1406 - int count = 0; 1407 - 1408 - if (!dev) 1409 - return -EINVAL; 1410 - 1411 - dev_id = dev_name(dev); 1412 - mutex_lock(&reset_lookup_mutex); 1413 - 1414 - list_for_each_entry(lookup, &reset_lookup_list, list) { 1415 - if (!strcmp(lookup->dev_id, dev_id)) 1416 - count++; 1417 - } 1418 - 1419 - mutex_unlock(&reset_lookup_mutex); 1420 - 1421 - if (count == 0) 1422 - count = -ENOENT; 1423 - 1424 - return count; 1425 - } 1426 - 1427 1495 /** 1428 1496 * reset_control_get_count - Count number of resets available with a device 1429 1497 * ··· 1412 1530 if (dev->of_node) 1413 1531 return of_reset_control_get_count(dev->of_node); 1414 1532 1415 - return reset_control_get_count_from_lookup(dev); 1533 + return -ENOENT; 1416 1534 } 1417 1535 EXPORT_SYMBOL_GPL(reset_control_get_count);
-33
include/linux/reset-controller.h
··· 27 27 struct of_phandle_args; 28 28 29 29 /** 30 - * struct reset_control_lookup - represents a single lookup entry 31 - * 32 - * @list: internal list of all reset lookup entries 33 - * @provider: name of the reset controller device controlling this reset line 34 - * @index: ID of the reset controller in the reset controller device 35 - * @dev_id: name of the device associated with this reset line 36 - * @con_id: name of the reset line (can be NULL) 37 - */ 38 - struct reset_control_lookup { 39 - struct list_head list; 40 - const char *provider; 41 - unsigned int index; 42 - const char *dev_id; 43 - const char *con_id; 44 - }; 45 - 46 - #define RESET_LOOKUP(_provider, _index, _dev_id, _con_id) \ 47 - { \ 48 - .provider = _provider, \ 49 - .index = _index, \ 50 - .dev_id = _dev_id, \ 51 - .con_id = _con_id, \ 52 - } 53 - 54 - /** 55 30 * struct reset_controller_dev - reset controller entity that might 56 31 * provide multiple reset controls 57 32 * @ops: a pointer to device specific struct reset_control_ops ··· 65 90 struct device; 66 91 int devm_reset_controller_register(struct device *dev, 67 92 struct reset_controller_dev *rcdev); 68 - 69 - void reset_controller_add_lookup(struct reset_control_lookup *lookup, 70 - unsigned int num_entries); 71 93 #else 72 94 static inline int reset_controller_register(struct reset_controller_dev *rcdev) 73 95 { ··· 79 107 struct reset_controller_dev *rcdev) 80 108 { 81 109 return 0; 82 - } 83 - 84 - static inline void reset_controller_add_lookup(struct reset_control_lookup *lookup, 85 - unsigned int num_entries) 86 - { 87 110 } 88 111 #endif 89 112