aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2008-01-18 15:32:10 -0500
committerPaul Mackerras <paulus@samba.org>2008-01-25 06:52:52 -0500
commitad7d8193e49c5534f76f87b22a6fd80e39be96cc (patch)
tree6e3b824a55b0834a280e5a71cf7cfaf95d9a4871 /arch
parent0a4689373915ad7a38e7308538edeef407d1db97 (diff)
[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 <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/ps3/repository.c60
1 files changed, 22 insertions, 38 deletions
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index 782dc895231f..d66902a632ff 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,
445 445
446 pr_debug(" -> %s:%d: find bus_type %u\n", __func__, __LINE__, bus_type); 446 pr_debug(" -> %s:%d: find bus_type %u\n", __func__, __LINE__, bus_type);
447 447
448 for (repo.bus_index = 0; repo.bus_index < 10; repo.bus_index++) { 448 repo.bus_type = bus_type;
449 result = ps3_repository_find_bus(repo.bus_type, 0, &repo.bus_index);
450 if (result) {
451 pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__);
452 return result;
453 }
449 454
450 result = ps3_repository_read_bus_type(repo.bus_index, 455 result = ps3_repository_read_bus_id(repo.bus_index, &repo.bus_id);
451 &repo.bus_type); 456 if (result) {
457 pr_debug("%s:%d read_bus_id(%u) failed\n", __func__, __LINE__,
458 repo.bus_index);
459 return result;
460 }
452 461
453 if (result) { 462 for (repo.dev_index = 0; ; repo.dev_index++) {
454 pr_debug("%s:%d read_bus_type(%u) failed\n", 463 result = ps3_repository_find_device(&repo);
455 __func__, __LINE__, repo.bus_index); 464 if (result == -ENODEV) {
465 result = 0;
466 break;
467 } else if (result)
456 break; 468 break;
457 }
458
459 if (repo.bus_type != bus_type) {
460 pr_debug("%s:%d: skip, bus_type %u\n", __func__,
461 __LINE__, repo.bus_type);
462 continue;
463 }
464
465 result = ps3_repository_read_bus_id(repo.bus_index,
466 &repo.bus_id);
467 469
470 result = callback(&repo);
468 if (result) { 471 if (result) {
469 pr_debug("%s:%d read_bus_id(%u) failed\n", 472 pr_debug("%s:%d: abort at callback\n", __func__,
470 __func__, __LINE__, repo.bus_index); 473 __LINE__);
471 continue; 474 break;
472 }
473
474 for (repo.dev_index = 0; ; repo.dev_index++) {
475 result = ps3_repository_find_device(&repo);
476
477 if (result == -ENODEV) {
478 result = 0;
479 break;
480 } else if (result)
481 break;
482
483 result = callback(&repo);
484
485 if (result) {
486 pr_debug("%s:%d: abort at callback\n", __func__,
487 __LINE__);
488 break;
489 }
490 } 475 }
491 break;
492 } 476 }
493 477
494 pr_debug(" <- %s:%d\n", __func__, __LINE__); 478 pr_debug(" <- %s:%d\n", __func__, __LINE__);