int dlpar_attach_node(struct device_node *dn) { struct proc_dir_entry *ent; int rc; of_node_set_flag(dn, OF_DYNAMIC); kref_init(&dn->kref); dn->parent = derive_parent(dn->full_name); if (!dn->parent) return -ENOMEM; rc = blocking_notifier_call_chain(&pSeries_reconfig_chain, PSERIES_RECONFIG_ADD, dn); if (rc == NOTIFY_BAD) { printk(KERN_ERR "Failed to add device node %s\n", dn->full_name); return -ENOMEM; /* For now, safe to assume kmalloc failure */ } of_attach_node(dn); #ifdef CONFIG_PROC_DEVICETREE ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde); if (ent) proc_device_tree_add_node(dn, ent); #endif of_node_put(dn->parent); return 0; }
int dlpar_attach_node(struct device_node *dn) { #ifdef CONFIG_PROC_DEVICETREE struct proc_dir_entry *ent; #endif int rc; of_node_set_flag(dn, OF_DYNAMIC); kref_init(&dn->kref); dn->parent = derive_parent(dn->full_name); if (!dn->parent) return -ENOMEM; rc = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, dn); if (rc) { printk(KERN_ERR "Failed to add device node %s\n", dn->full_name); return rc; } of_attach_node(dn); #ifdef CONFIG_PROC_DEVICETREE ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde); if (ent) proc_device_tree_add_node(dn, ent); #endif of_node_put(dn->parent); return 0; }
int dlpar_attach_node(struct device_node *dn, struct device_node *parent) { int rc; dn->parent = parent; rc = of_attach_node(dn); if (rc) { printk(KERN_ERR "Failed to add device node %pOF\n", dn); return rc; } return 0; }
static struct device_node *do_device_node(struct device_node *parent, const char *name, u32 reg, u32 unit, const char *type, const char *compat, struct vio_resource *res) { struct device_node *np; char path[32]; snprintf(path, sizeof(path), "/vdevice/%s@%08x", name, reg); np = new_node(path, parent); if (!np) return NULL; if (!add_string_property(np, "name", name) || !add_string_property(np, "device_type", type) || !add_string_property(np, "compatible", compat) || !add_raw_property(np, "reg", sizeof(reg), ®) || !add_raw_property(np, "linux,unit_address", sizeof(unit), &unit)) { goto node_free; } if (res) { if (!add_raw_property(np, "linux,vio_rsrcname", sizeof(res->rsrcname), res->rsrcname) || !add_raw_property(np, "linux,vio_type", sizeof(res->type), res->type) || !add_raw_property(np, "linux,vio_model", sizeof(res->model), res->model)) goto node_free; } np->name = of_get_property(np, "name", NULL); np->type = of_get_property(np, "device_type", NULL); of_attach_node(np); #ifdef CONFIG_PROC_DEVICETREE if (parent->pde) { struct proc_dir_entry *ent; ent = proc_mkdir(strrchr(np->full_name, '/') + 1, parent->pde); if (ent) proc_device_tree_add_node(np, ent); } #endif return np; node_free: free_node(np); return NULL; }
int dlpar_attach_node(struct device_node *dn) { int rc; dn->parent = derive_parent(dn->full_name); if (!dn->parent) return -ENOMEM; rc = of_attach_node(dn); if (rc) { printk(KERN_ERR "Failed to add device node %s\n", dn->full_name); return rc; } of_node_put(dn->parent); return 0; }
int dlpar_attach_node(struct device_node *dn) { int rc; dn->parent = pseries_of_derive_parent(dn->full_name); if (IS_ERR(dn->parent)) return PTR_ERR(dn->parent); rc = of_attach_node(dn); if (rc) { printk(KERN_ERR "Failed to add device node %s\n", dn->full_name); return rc; } of_node_put(dn->parent); return 0; }
int dlpar_attach_node(struct device_node *dn) { int rc; of_node_set_flag(dn, OF_DYNAMIC); kref_init(&dn->kref); dn->parent = derive_parent(dn->full_name); if (!dn->parent) return -ENOMEM; rc = of_attach_node(dn); if (rc) { printk(KERN_ERR "Failed to add device node %s\n", dn->full_name); return rc; } of_node_put(dn->parent); return 0; }
/* returns added device node so it can be added to procfs in the case * of hotpluging */ static struct device_node *xen_add_vcpu_node(struct device_node *boot_cpu, uint cpu) { struct device_node *new_cpu; struct property *pp; void *p; int sz; int type_sz; int name_sz; DBG("%s: boot cpu: %s\n", __func__, boot_cpu->full_name); /* allocate in one shot in case we fail */ name_sz = strlen(boot_cpu->name) + 1; type_sz = strlen(boot_cpu->type) + 1; sz = sizeof (*new_cpu); /* the node */ sz += strlen(boot_cpu->full_name) + 3; /* full_name */ sz += name_sz; /* name */ sz += type_sz; /* type */ p = xen_of_alloc(sz); if (!p) return NULL; memset(p, 0, sz); /* the node */ new_cpu = p; p += sizeof (*new_cpu); /* name */ new_cpu->name = p; strcpy(new_cpu->name, boot_cpu->name); p += name_sz; /* type */ new_cpu->type = p; strcpy(new_cpu->type, boot_cpu->type); p += type_sz; /* full_name */ new_cpu->full_name = p; /* assemble new full_name */ pp = of_find_property(boot_cpu, "name", NULL); if (!pp) panic("%s: no name prop\n", __func__); DBG("%s: name is: %s = %s\n", __func__, pp->name, pp->value); sprintf(new_cpu->full_name, "/cpus/%s@%u", pp->value, cpu); if (dup_properties(new_cpu, boot_cpu)) { xen_of_free(new_cpu); return NULL; } /* fixup reg property */ DBG("%s: updating reg: %d\n", __func__, cpu); pp = of_find_property(new_cpu, "reg", NULL); if (!pp) panic("%s: no reg prop\n", __func__); *(int *)pp->value = cpu; if (mem_init_done) OF_MARK_DYNAMIC(new_cpu); kref_init(&new_cpu->kref); /* insert the node */ new_cpu->parent = of_get_parent(boot_cpu); of_attach_node(new_cpu); of_node_put(new_cpu->parent); return new_cpu; }