Lines Matching +full:int +full:- +full:property
1 // SPDX-License-Identifier: GPL-2.0-only
3 * pSeries_reconfig.c - support for dynamic reconfiguration (including PCI
23 static int pSeries_reconfig_add_node(const char *path, struct property *proplist) in pSeries_reconfig_add_node()
26 int err = -ENOMEM; in pSeries_reconfig_add_node()
32 np->full_name = kstrdup(kbasename(path), GFP_KERNEL); in pSeries_reconfig_add_node()
33 if (!np->full_name) in pSeries_reconfig_add_node()
36 np->properties = proplist; in pSeries_reconfig_add_node()
40 np->parent = pseries_of_derive_parent(path); in pSeries_reconfig_add_node()
41 if (IS_ERR(np->parent)) { in pSeries_reconfig_add_node()
42 err = PTR_ERR(np->parent); in pSeries_reconfig_add_node()
52 of_node_put(np->parent); in pSeries_reconfig_add_node()
58 of_node_put(np->parent); in pSeries_reconfig_add_node()
59 kfree(np->full_name); in pSeries_reconfig_add_node()
65 static int pSeries_reconfig_remove_node(struct device_node *np) in pSeries_reconfig_remove_node()
71 return -EINVAL; in pSeries_reconfig_remove_node()
76 return -EBUSY; in pSeries_reconfig_remove_node()
85 * /proc/powerpc/ofdt - yucky binary interface for adding and removing
87 * in-kernel wrapper for the RTAS ibm,configure-connector call.
90 static void release_prop_list(const struct property *prop) in release_prop_list()
92 struct property *next; in release_prop_list()
94 next = prop->next; in release_prop_list()
95 kfree(prop->name); in release_prop_list()
96 kfree(prop->value); in release_prop_list()
103 * parse_next_property - process the next property from raw input buffer
104 * @buf: input buffer, must be nul-terminated
106 * @name: return value; set to property name in buf
108 * @value: return value; set to the property value in buf
114 static char * parse_next_property(char *buf, char *end, char **name, int *length, in parse_next_property()
123 printk(KERN_ERR "property parse failed in %s at line %d\n", in parse_next_property()
130 printk(KERN_ERR "property parse failed in %s at line %d\n", in parse_next_property()
136 *length = -1; in parse_next_property()
138 if (*length == -1) { in parse_next_property()
139 printk(KERN_ERR "property parse failed in %s at line %d\n", in parse_next_property()
144 printk(KERN_ERR "property parse failed in %s at line %d\n", in parse_next_property()
153 printk(KERN_ERR "property parse failed in %s at line %d\n", in parse_next_property()
158 printk(KERN_ERR "property parse failed in %s at line %d\n", in parse_next_property()
168 static struct property *new_property(const char *name, const int length, in new_property()
169 const unsigned char *value, struct property *last) in new_property()
171 struct property *new = kzalloc(sizeof(*new), GFP_KERNEL); in new_property()
176 if (!(new->name = kstrdup(name, GFP_KERNEL))) in new_property()
178 if (!(new->value = kmalloc(length + 1, GFP_KERNEL))) in new_property()
181 memcpy(new->value, value, length); in new_property()
182 *(((char *)new->value) + length) = 0; in new_property()
183 new->length = length; in new_property()
184 new->next = last; in new_property()
188 kfree(new->name); in new_property()
189 kfree(new->value); in new_property()
194 static int do_add_node(char *buf, size_t bufsize) in do_add_node()
198 struct property *prop = NULL; in do_add_node()
200 int length, rv = 0; in do_add_node()
206 return -EINVAL; in do_add_node()
212 return -EINVAL; in do_add_node()
215 /* rv = build_prop_list(tmp, bufsize - (tmp - buf), &proplist); */ in do_add_node()
218 struct property *last = prop; in do_add_node()
222 rv = -ENOMEM; in do_add_node()
228 rv = -EINVAL; in do_add_node()
240 static int do_remove_node(char *buf) in do_remove_node()
243 int rv = -ENODEV; in do_remove_node()
272 static int do_add_property(char *buf, size_t bufsize) in do_add_property()
274 struct property *prop = NULL; in do_add_property()
278 int length; in do_add_property()
283 return -ENODEV; in do_add_property()
286 return -EINVAL; in do_add_property()
290 return -ENOMEM; in do_add_property()
297 static int do_remove_property(char *buf, size_t bufsize) in do_remove_property()
304 return -ENODEV; in do_remove_property()
311 return -EINVAL; in do_remove_property()
316 static int do_update_property(char *buf, size_t bufsize) in do_update_property()
321 int length; in do_update_property()
322 struct property *newprop; in do_update_property()
327 return -ENODEV; in do_update_property()
331 return -EINVAL; in do_update_property()
334 return -ENODEV; in do_update_property()
338 return -ENOMEM; in do_update_property()
340 if (!strcmp(name, "slb-size") || !strcmp(name, "ibm,slb-size")) in do_update_property()
341 slb_set_size(*(int *)value); in do_update_property()
347 * ofdt_write - perform operations on the Open Firmware device tree
361 int rv; in ofdt_write()
375 rv = -EINVAL; in ofdt_write()
382 rv = do_add_node(tmp, count - (tmp - kbuf)); in ofdt_write()
386 rv = do_add_property(tmp, count - (tmp - kbuf)); in ofdt_write()
388 rv = do_remove_property(tmp, count - (tmp - kbuf)); in ofdt_write()
390 rv = do_update_property(tmp, count - (tmp - kbuf)); in ofdt_write()
392 rv = -EINVAL; in ofdt_write()
403 /* create /proc/powerpc/ofdt write-only by root */
404 static int proc_ppc64_create_ofdt(void) in proc_ppc64_create_ofdt()