Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ad7d8193e49c5534f76f87b22a6fd80e39be96cc
Commit:     ad7d8193e49c5534f76f87b22a6fd80e39be96cc
Parent:     0a4689373915ad7a38e7308538edeef407d1db97
Author:     Geert Uytterhoeven <[EMAIL PROTECTED]>
AuthorDate: Sat Jan 19 07:32:10 2008 +1100
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 22:52:52 2008 +1100

    [POWERPC] PS3: Refactor ps3_repository_find_device()
    
    PS3: Refactor ps3_repository_find_device() to use the existing
    ps3_repository_read_bus_id() routine.
    
    Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
    Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/repository.c |   60 +++++++++++-------------------
 1 files changed, 22 insertions(+), 38 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/repository.c 
b/arch/powerpc/platforms/ps3/repository.c
index 782dc89..d66902a 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -445,50 +445,34 @@ int __devinit ps3_repository_find_devices(enum 
ps3_bus_type bus_type,
 
        pr_debug(" -> %s:%d: find bus_type %u\n", __func__, __LINE__, bus_type);
 
-       for (repo.bus_index = 0; repo.bus_index < 10; repo.bus_index++) {
+       repo.bus_type = bus_type;
+       result = ps3_repository_find_bus(repo.bus_type, 0, &repo.bus_index);
+       if (result) {
+               pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__);
+               return result;
+       }
 
-               result = ps3_repository_read_bus_type(repo.bus_index,
-                       &repo.bus_type);
+       result = ps3_repository_read_bus_id(repo.bus_index, &repo.bus_id);
+       if (result) {
+               pr_debug("%s:%d read_bus_id(%u) failed\n", __func__, __LINE__,
+                        repo.bus_index);
+               return result;
+       }
 
-               if (result) {
-                       pr_debug("%s:%d read_bus_type(%u) failed\n",
-                               __func__, __LINE__, repo.bus_index);
+       for (repo.dev_index = 0; ; repo.dev_index++) {
+               result = ps3_repository_find_device(&repo);
+               if (result == -ENODEV) {
+                       result = 0;
+                       break;
+               } else if (result)
                        break;
-               }
-
-               if (repo.bus_type != bus_type) {
-                       pr_debug("%s:%d: skip, bus_type %u\n", __func__,
-                               __LINE__, repo.bus_type);
-                       continue;
-               }
-
-               result = ps3_repository_read_bus_id(repo.bus_index,
-                       &repo.bus_id);
 
+               result = callback(&repo);
                if (result) {
-                       pr_debug("%s:%d read_bus_id(%u) failed\n",
-                               __func__, __LINE__, repo.bus_index);
-                       continue;
-               }
-
-               for (repo.dev_index = 0; ; repo.dev_index++) {
-                       result = ps3_repository_find_device(&repo);
-
-                       if (result == -ENODEV) {
-                               result = 0;
-                               break;
-                       } else if (result)
-                               break;
-
-                       result = callback(&repo);
-
-                       if (result) {
-                               pr_debug("%s:%d: abort at callback\n", __func__,
-                                       __LINE__);
-                               break;
-                       }
+                       pr_debug("%s:%d: abort at callback\n", __func__,
+                               __LINE__);
+                       break;
                }
-               break;
        }
 
        pr_debug(" <- %s:%d\n", __func__, __LINE__);
-
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