Permalink
Browse files

[EMULATORS] Use vmm_devtree_getattr() to check boolean attributes

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...
1 parent 8de2c33 commit 466d42ea14a21c7917d5aa9e6f4adb1f765f3c8c @avpatel avpatel committed Feb 11, 2014
Showing with 4 additions and 6 deletions.
  1. +1 −2 emulators/pic/gic.c
  2. +1 −1 emulators/pic/pl190.c
  3. +2 −3 emulators/timer/sp804.c
View
@@ -1127,8 +1127,7 @@ static int gic_emulator_probe(struct vmm_guest *guest,
return VMM_ENODEV;
}
- if (vmm_devtree_read_u32(edev->node,
- "child_pic", &parent_irq) == VMM_OK) {
+ if (vmm_devtree_getattr(edev->node, "child_pic")) {
is_child_pic = TRUE;
} else {
is_child_pic = FALSE;
@@ -406,7 +406,7 @@ static int pl190_emulator_probe(struct vmm_guest *guest,
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;
} else {
s->is_child_pic = FALSE;
@@ -581,9 +581,8 @@ static int sp804_emulator_probe(struct vmm_guest *guest,
s->id[7] = ((u8 *)eid->data)[7];
}
- irq = 0;
- vmm_devtree_read_u32(edev->node, "maintain_irq_rate", &irq);
- mrate = (irq) ? TRUE : FALSE;
+ mrate = (vmm_devtree_getattr(edev->node,
+ "maintain_irq_rate")) ? TRUE : FALSE;
rc = vmm_devtree_irq_get(edev->node, &irq, 0);
if (rc) {

0 comments on commit 466d42e

Please sign in to comment.