diff options
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
| -rw-r--r-- | arch/powerpc/kernel/prom.c | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 1280f3484ad3..7f8856655144 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
| @@ -1130,120 +1130,6 @@ static int __init prom_reconfig_setup(void) | |||
| 1130 | __initcall(prom_reconfig_setup); | 1130 | __initcall(prom_reconfig_setup); |
| 1131 | #endif | 1131 | #endif |
| 1132 | 1132 | ||
| 1133 | /* | ||
| 1134 | * Add a property to a node | ||
| 1135 | */ | ||
| 1136 | int prom_add_property(struct device_node* np, struct property* prop) | ||
| 1137 | { | ||
| 1138 | struct property **next; | ||
| 1139 | unsigned long flags; | ||
| 1140 | |||
| 1141 | prop->next = NULL; | ||
| 1142 | write_lock_irqsave(&devtree_lock, flags); | ||
| 1143 | next = &np->properties; | ||
| 1144 | while (*next) { | ||
| 1145 | if (strcmp(prop->name, (*next)->name) == 0) { | ||
| 1146 | /* duplicate ! don't insert it */ | ||
| 1147 | write_unlock_irqrestore(&devtree_lock, flags); | ||
| 1148 | return -1; | ||
| 1149 | } | ||
| 1150 | next = &(*next)->next; | ||
| 1151 | } | ||
| 1152 | *next = prop; | ||
| 1153 | write_unlock_irqrestore(&devtree_lock, flags); | ||
| 1154 | |||
| 1155 | #ifdef CONFIG_PROC_DEVICETREE | ||
| 1156 | /* try to add to proc as well if it was initialized */ | ||
| 1157 | if (np->pde) | ||
| 1158 | proc_device_tree_add_prop(np->pde, prop); | ||
| 1159 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
| 1160 | |||
| 1161 | return 0; | ||
| 1162 | } | ||
| 1163 | |||
| 1164 | /* | ||
| 1165 | * Remove a property from a node. Note that we don't actually | ||
| 1166 | * remove it, since we have given out who-knows-how-many pointers | ||
| 1167 | * to the data using get-property. Instead we just move the property | ||
| 1168 | * to the "dead properties" list, so it won't be found any more. | ||
| 1169 | */ | ||
| 1170 | int prom_remove_property(struct device_node *np, struct property *prop) | ||
| 1171 | { | ||
| 1172 | struct property **next; | ||
| 1173 | unsigned long flags; | ||
| 1174 | int found = 0; | ||
| 1175 | |||
| 1176 | write_lock_irqsave(&devtree_lock, flags); | ||
| 1177 | next = &np->properties; | ||
| 1178 | while (*next) { | ||
| 1179 | if (*next == prop) { | ||
| 1180 | /* found the node */ | ||
| 1181 | *next = prop->next; | ||
| 1182 | prop->next = np->deadprops; | ||
| 1183 | np->deadprops = prop; | ||
| 1184 | found = 1; | ||
| 1185 | break; | ||
| 1186 | } | ||
| 1187 | next = &(*next)->next; | ||
| 1188 | } | ||
| 1189 | write_unlock_irqrestore(&devtree_lock, flags); | ||
| 1190 | |||
| 1191 | if (!found) | ||
| 1192 | return -ENODEV; | ||
| 1193 | |||
| 1194 | #ifdef CONFIG_PROC_DEVICETREE | ||
| 1195 | /* try to remove the proc node as well */ | ||
| 1196 | if (np->pde) | ||
| 1197 | proc_device_tree_remove_prop(np->pde, prop); | ||
| 1198 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
| 1199 | |||
| 1200 | return 0; | ||
| 1201 | } | ||
| 1202 | |||
| 1203 | /* | ||
| 1204 | * Update a property in a node. Note that we don't actually | ||
| 1205 | * remove it, since we have given out who-knows-how-many pointers | ||
| 1206 | * to the data using get-property. Instead we just move the property | ||
| 1207 | * to the "dead properties" list, and add the new property to the | ||
| 1208 | * property list | ||
| 1209 | */ | ||
| 1210 | int prom_update_property(struct device_node *np, | ||
| 1211 | struct property *newprop, | ||
| 1212 | struct property *oldprop) | ||
| 1213 | { | ||
| 1214 | struct property **next; | ||
| 1215 | unsigned long flags; | ||
| 1216 | int found = 0; | ||
| 1217 | |||
| 1218 | write_lock_irqsave(&devtree_lock, flags); | ||
| 1219 | next = &np->properties; | ||
| 1220 | while (*next) { | ||
| 1221 | if (*next == oldprop) { | ||
| 1222 | /* found the node */ | ||
| 1223 | newprop->next = oldprop->next; | ||
| 1224 | *next = newprop; | ||
| 1225 | oldprop->next = np->deadprops; | ||
| 1226 | np->deadprops = oldprop; | ||
| 1227 | found = 1; | ||
| 1228 | break; | ||
| 1229 | } | ||
| 1230 | next = &(*next)->next; | ||
| 1231 | } | ||
| 1232 | write_unlock_irqrestore(&devtree_lock, flags); | ||
| 1233 | |||
| 1234 | if (!found) | ||
| 1235 | return -ENODEV; | ||
| 1236 | |||
| 1237 | #ifdef CONFIG_PROC_DEVICETREE | ||
| 1238 | /* try to add to proc as well if it was initialized */ | ||
| 1239 | if (np->pde) | ||
| 1240 | proc_device_tree_update_prop(np->pde, newprop, oldprop); | ||
| 1241 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
| 1242 | |||
| 1243 | return 0; | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | |||
| 1247 | /* Find the device node for a given logical cpu number, also returns the cpu | 1133 | /* Find the device node for a given logical cpu number, also returns the cpu |
| 1248 | * local thread number (index in ibm,interrupt-server#s) if relevant and | 1134 | * local thread number (index in ibm,interrupt-server#s) if relevant and |
| 1249 | * asked for (non NULL) | 1135 | * asked for (non NULL) |
