Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 123370
b: refs/heads/master
c: b9e5567
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Dec 6, 2008
1 parent c70d619 commit 5558db4
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 127 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e5ff0fe31d69e716f2599bcfb297ca3757e957c5
refs/heads/master: b9e5567cda6387e0f4061bfceebbc1bd63ee42a6
2 changes: 2 additions & 0 deletions trunk/arch/sparc/kernel/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ extern void irq_trans_init(struct device_node *dp);

extern unsigned int prom_unique_id;

extern struct property * __init build_prop_list(phandle node);

#endif /* __PROM_H */
66 changes: 0 additions & 66 deletions trunk/arch/sparc/kernel/prom_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,72 +196,6 @@ static char * __init build_full_name(struct device_node *dp)
return n;
}

static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
{
static struct property *tmp = NULL;
struct property *p;
int len;
const char *name;

if (tmp) {
p = tmp;
memset(p, 0, sizeof(*p) + 32);
tmp = NULL;
} else {
p = prom_early_alloc(sizeof(struct property) + 32);
p->unique_id = prom_unique_id++;
}

p->name = (char *) (p + 1);
if (special_name) {
strcpy(p->name, special_name);
p->length = special_len;
p->value = prom_early_alloc(special_len);
memcpy(p->value, special_val, special_len);
} else {
if (prev == NULL) {
name = prom_firstprop(node, NULL);
} else {
name = prom_nextprop(node, prev, NULL);
}
if (strlen(name) == 0) {
tmp = p;
return NULL;
}
strcpy(p->name, name);
p->length = prom_getproplen(node, p->name);
if (p->length <= 0) {
p->length = 0;
} else {
p->value = prom_early_alloc(p->length + 1);
len = prom_getproperty(node, p->name, p->value,
p->length);
if (len <= 0)
p->length = 0;
((unsigned char *)p->value)[p->length] = '\0';
}
}
return p;
}

static struct property * __init build_prop_list(phandle node)
{
struct property *head, *tail;

head = tail = build_one_prop(node, NULL,
".node", &node, sizeof(node));

tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
tail = tail->next;
while(tail) {
tail->next = build_one_prop(node, tail->name,
NULL, NULL, 0);
tail = tail->next;
}

return head;
}

static char * __init get_one_property(phandle node, char *name)
{
char *buf = "<NULL>";
Expand Down
60 changes: 0 additions & 60 deletions trunk/arch/sparc/kernel/prom_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,66 +399,6 @@ static char * __init build_full_name(struct device_node *dp)
return n;
}

static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
{
static struct property *tmp = NULL;
struct property *p;

if (tmp) {
p = tmp;
memset(p, 0, sizeof(*p) + 32);
tmp = NULL;
} else {
p = prom_early_alloc(sizeof(struct property) + 32);
p->unique_id = prom_unique_id++;
}

p->name = (char *) (p + 1);
if (special_name) {
strcpy(p->name, special_name);
p->length = special_len;
p->value = prom_early_alloc(special_len);
memcpy(p->value, special_val, special_len);
} else {
if (prev == NULL) {
prom_firstprop(node, p->name);
} else {
prom_nextprop(node, prev, p->name);
}
if (strlen(p->name) == 0) {
tmp = p;
return NULL;
}
p->length = prom_getproplen(node, p->name);
if (p->length <= 0) {
p->length = 0;
} else {
p->value = prom_early_alloc(p->length + 1);
prom_getproperty(node, p->name, p->value, p->length);
((unsigned char *)p->value)[p->length] = '\0';
}
}
return p;
}

static struct property * __init build_prop_list(phandle node)
{
struct property *head, *tail;

head = tail = build_one_prop(node, NULL,
".node", &node, sizeof(node));

tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
tail = tail->next;
while(tail) {
tail->next = build_one_prop(node, tail->name,
NULL, NULL, 0);
tail = tail->next;
}

return head;
}

static char * __init get_one_property(phandle node, const char *name)
{
char *buf = "<NULL>";
Expand Down
81 changes: 81 additions & 0 deletions trunk/arch/sparc/kernel/prom_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,84 @@ int of_find_in_proplist(const char *list, const char *match, int len)
EXPORT_SYMBOL(of_find_in_proplist);

unsigned int prom_unique_id;

static struct property * __init build_one_prop(phandle node, char *prev,
char *special_name,
void *special_val,
int special_len)
{
static struct property *tmp = NULL;
struct property *p;
const char *name;

if (tmp) {
p = tmp;
memset(p, 0, sizeof(*p) + 32);
tmp = NULL;
} else {
p = prom_early_alloc(sizeof(struct property) + 32);
p->unique_id = prom_unique_id++;
}

p->name = (char *) (p + 1);
if (special_name) {
strcpy(p->name, special_name);
p->length = special_len;
p->value = prom_early_alloc(special_len);
memcpy(p->value, special_val, special_len);
} else {
#ifdef CONFIG_SPARC32
if (prev == NULL) {
name = prom_firstprop(node, NULL);
} else {
name = prom_nextprop(node, prev, NULL);
}
#else
if (prev == NULL) {
prom_firstprop(node, p->name);
} else {
prom_nextprop(node, prev, p->name);
}
name = p->name;
#endif
if (strlen(name) == 0) {
tmp = p;
return NULL;
}
#ifdef CONFIG_SPARC32
strcpy(p->name, name);
#endif
p->length = prom_getproplen(node, p->name);
if (p->length <= 0) {
p->length = 0;
} else {
int len;

p->value = prom_early_alloc(p->length + 1);
len = prom_getproperty(node, p->name, p->value,
p->length);
if (len <= 0)
p->length = 0;
((unsigned char *)p->value)[p->length] = '\0';
}
}
return p;
}

struct property * __init build_prop_list(phandle node)
{
struct property *head, *tail;

head = tail = build_one_prop(node, NULL,
".node", &node, sizeof(node));

tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
tail = tail->next;
while(tail) {
tail->next = build_one_prop(node, tail->name,
NULL, NULL, 0);
tail = tail->next;
}

return head;
}

0 comments on commit 5558db4

Please sign in to comment.