Skip to content

Commit

Permalink
[EMULATORS] Use vmm_devtree_getattr() to check boolean attributes
Browse files Browse the repository at this point in the history
We cannot use vmm_devtree_read_u32() API for checking value of
boolean attributes because boolean attributes have attribute
value length equals zero.

The correct API in this case is vmm_devtree_getattr() API.

Signed-off-by: Anup Patel <anup@brainfault.org>
  • Loading branch information
avpatel committed Feb 11, 2014
1 parent 8de2c33 commit 466d42e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions emulators/pic/gic.c
Expand Up @@ -1127,8 +1127,7 @@ static int gic_emulator_probe(struct vmm_guest *guest,
return VMM_ENODEV; return VMM_ENODEV;
} }


if (vmm_devtree_read_u32(edev->node, if (vmm_devtree_getattr(edev->node, "child_pic")) {
"child_pic", &parent_irq) == VMM_OK) {
is_child_pic = TRUE; is_child_pic = TRUE;
} else { } else {
is_child_pic = FALSE; is_child_pic = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion emulators/pic/pl190.c
Expand Up @@ -406,7 +406,7 @@ static int pl190_emulator_probe(struct vmm_guest *guest,
goto pl190_emulator_probe_freestate_fail; goto pl190_emulator_probe_freestate_fail;
} }


if (vmm_devtree_read_u32(edev->node, "child_pic", &i) == VMM_OK) { if (vmm_devtree_getattr(edev->node, "child_pic")) {
s->is_child_pic = TRUE; s->is_child_pic = TRUE;
} else { } else {
s->is_child_pic = FALSE; s->is_child_pic = FALSE;
Expand Down
5 changes: 2 additions & 3 deletions emulators/timer/sp804.c
Expand Up @@ -581,9 +581,8 @@ static int sp804_emulator_probe(struct vmm_guest *guest,
s->id[7] = ((u8 *)eid->data)[7]; s->id[7] = ((u8 *)eid->data)[7];
} }


irq = 0; mrate = (vmm_devtree_getattr(edev->node,
vmm_devtree_read_u32(edev->node, "maintain_irq_rate", &irq); "maintain_irq_rate")) ? TRUE : FALSE;
mrate = (irq) ? TRUE : FALSE;


rc = vmm_devtree_irq_get(edev->node, &irq, 0); rc = vmm_devtree_irq_get(edev->node, &irq, 0);
if (rc) { if (rc) {
Expand Down

0 comments on commit 466d42e

Please sign in to comment.