Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b85cdd490ac52ee039636f809b9b98b1300fcf3d
Commit:     b85cdd490ac52ee039636f809b9b98b1300fcf3d
Parent:     562aa1d4c6a874373f9a48ac184f662fbbb06a04
Author:     David S. Miller <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 28 23:20:12 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Fri Mar 2 15:22:49 2007 -0800

    [SPARC]: Fix bus handling in build_device_resources().
    
    We mistakedly modify 'bus' in the innermost loop.  What
    should happen is that at each register index iteration,
    we start with the same 'bus'.
    
    So preserve it's value at the top level, and use a loop
    local variable 'dbus' for iteration.
    
    This bug causes registers other than the first to be
    decoded improperly.
    
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 arch/sparc/kernel/of_device.c   |    7 ++++---
 arch/sparc64/kernel/of_device.c |    7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index dab6169..798b140 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -495,7 +495,7 @@ static void __init build_device_resources(struct of_device 
*op,
                u32 *reg = (preg + (index * ((na + ns) * 4)));
                struct device_node *dp = op->node;
                struct device_node *pp = p_op->node;
-               struct of_bus *pbus;
+               struct of_bus *pbus, *dbus;
                u64 size, result = OF_BAD_ADDR;
                unsigned long flags;
                int dna, dns;
@@ -516,6 +516,7 @@ static void __init build_device_resources(struct of_device 
*op,
 
                dna = na;
                dns = ns;
+               dbus = bus;
 
                while (1) {
                        dp = pp;
@@ -528,13 +529,13 @@ static void __init build_device_resources(struct 
of_device *op,
                        pbus = of_match_bus(pp);
                        pbus->count_cells(dp, &pna, &pns);
 
-                       if (build_one_resource(dp, bus, pbus, addr,
+                       if (build_one_resource(dp, dbus, pbus, addr,
                                               dna, dns, pna))
                                break;
 
                        dna = pna;
                        dns = pns;
-                       bus = pbus;
+                       dbus = pbus;
                }
 
        build_res:
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index ad74e5e..1f45985 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -581,7 +581,7 @@ static void __init build_device_resources(struct of_device 
*op,
                u32 *reg = (preg + (index * ((na + ns) * 4)));
                struct device_node *dp = op->node;
                struct device_node *pp = p_op->node;
-               struct of_bus *pbus;
+               struct of_bus *pbus, *dbus;
                u64 size, result = OF_BAD_ADDR;
                unsigned long flags;
                int dna, dns;
@@ -599,6 +599,7 @@ static void __init build_device_resources(struct of_device 
*op,
 
                dna = na;
                dns = ns;
+               dbus = bus;
 
                while (1) {
                        dp = pp;
@@ -611,13 +612,13 @@ static void __init build_device_resources(struct 
of_device *op,
                        pbus = of_match_bus(pp);
                        pbus->count_cells(dp, &pna, &pns);
 
-                       if (build_one_resource(dp, bus, pbus, addr,
+                       if (build_one_resource(dp, dbus, pbus, addr,
                                               dna, dns, pna))
                                break;
 
                        dna = pna;
                        dns = pns;
-                       bus = pbus;
+                       dbus = pbus;
                }
 
        build_res:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to