|
|
|
|
|
|
|
|
|
|
xen-ia64-devel
Re: [Xen-ia64-devel] [Patch 4/4] [RFC] Xwindow: Modify pci_acpi_scan_roo
Hi Alex-san,
Thank you for your helpful comments.
I'm going to modify the patch according to your comments.
BTW, I will make some explanation about following your comment.
On Wed, 30 May 2007 23:40:46 -0600
Alex Williamson <alex.williamson@xxxxxx> wrote:
> Please add some comments on what the code below is trying to accomplish.
> Comments are good ;)
>
> > + }
> > +
> > + if (curr_lvl > prev_lvl) {
> > + if (ptr->child != 0) {
> > + ptr = ptr->child;
> > + curr_lvl++;
> > + prev_lvl++;
> > + } else if (ptr->sibling != 0) {
> > + ptr = ptr->sibling;
> > + } else {
> > + ptr = ptr->parent;
> > + curr_lvl--;
> > + prev_lvl++;
> > + if (curr_lvl == 0)
> > + goto out;
This function (__make_issue_list()) traverses all elements of the
resource structure list by depth first algorhithm.
Structure of the list is shown below.
-----
C: Pointer to Child
P: Pointer to Parent
S: Pointer to Sibling
--------------------------------------------------
| |
| |
-->|---|-+-|---| |
| C | P | S + | <== Level i-1
|-+-|---|---| |
| |
-- |
| |
-->|---|-+-|---| |-->|---|-+-|---| |-->|---|-+-|---|
| C | P | S +-- | C | P | S +-- | C | P | S | <== Level i
|-+-|---|---| |-+-|---|---| |-+-|---|---|
|
--
|
-->|---|-+-|---|
| C | P | S + <= Level i+1
|-+-|---|---|
Condition "curr_lvl > prev_lvl" indicates that the "ptr" has gone down
from level i-1 to level i. On that case, "ptr" tries to go down to level
i+1 furthermore (because of depth first) if child exists. However, if
no child exits, "ptr" goes to sibling. If no child and no sibling exist,
"ptr" goes up.
On go up mode (condition "curr_lvl < prev_lvl"), "ptr" tries to go to
sibling and enters go down mode. If no sibling exists, "ptr" goes to
parent.
-----
At this point, I found a bug on the code as shown below. Without the
line, "ptr" cannot go to the other children. I would like to fix it and
re-post.
} else if (curr_lvl < prev_lvl) {
if (ptr->sibling != 0) {
ptr = ptr->sibling;
prev_lvl = curr_lvl - 1; <== We need this line.
} else {
ptr = ptr->parent;
curr_lvl--;
prev_lvl--;
if (curr_lvl == 0)
goto out;
}
Thanks,
-----
Jun Kamada
Virtual Systems Development Div.
Platform Technology Development Unit
Fujitsu Ltd.
kama@xxxxxxxxxxxxxx
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|
|
|
|
|