public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Geoff Levand <geoffrey.levand@am•sony.com>
To: paulus@samba•org
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom•com>,
	linuxppc-dev@ozlabs•org
Subject: [patch 07/16] PS3: Refactor ps3_repository_find_device()
Date: Fri, 18 Jan 2008 12:32:10 -0800	[thread overview]
Message-ID: <47910CCA.8070602@am.sony.com> (raw)
In-Reply-To: <20080118202612.422185192@am.sony.com>

From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom•com>

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>
---
 arch/powerpc/platforms/ps3/repository.c |   60 +++++++++++---------------------
 1 files changed, 22 insertions(+), 38 deletions(-)

--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -445,50 +445,34 @@ int __devinit ps3_repository_find_device
 
 	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__);

-- 

  parent reply	other threads:[~2008-01-18 20:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080118202612.422185192@am.sony.com>
2008-01-18 20:29 ` [patch 01/16] POWERPC: Add Cell SPRN bookmark register Geoff Levand
2008-01-18 20:30 ` [patch 02/16] PS3: Make bus_id and dev_id u64 Geoff Levand
2008-01-18 20:30 ` [patch 03/16] PS3: Add ps3_repository_find_device_by_id() Geoff Levand
2008-01-18 20:30 ` [patch 04/16] PS3: Use the HVs storage device notification mechanism properly Geoff Levand
2008-01-18 20:30 ` [patch 05/16] PS3: Add repository polling loop to work around timing bug Geoff Levand
2008-01-18 20:32 ` [patch 06/16] PS3: Kill unused ps3_repository_bump_device() Geoff Levand
2008-01-18 20:32 ` Geoff Levand [this message]
2008-01-18 20:32 ` [patch 08/16] PS3: Checkpatch cleanups for drivers/ps3/ps3-sys-manager.c Geoff Levand
2008-01-18 20:32 ` [patch 09/16] PS3: Checkpatch cleanups for drivers/ps3/ps3-vuart.c Geoff Levand
2008-01-18 20:32 ` [patch 10/16] PS3: Checkpatch cleanups for arch/powerpc/platforms/ps3/repository.c Geoff Levand
2008-01-18 20:32 ` [patch 11/16] PS3: Add logical performance monitor repository routines Geoff Levand
2008-01-18 20:32 ` [patch 12/16] PS3: Add logical performance monitor device support Geoff Levand
2008-01-18 20:32 ` [patch 13/16] PS3: Add logical performance monitor driver support Geoff Levand
2008-01-18 20:32 ` [patch 14/16] PS3: Vuart change semaphore to mutex Geoff Levand
2008-01-18 20:32 ` [patch 15/16] PS3: Revove use lpar address workaround Geoff Levand
2008-01-18 20:33 ` [patch 16/16] PS3: Update ps3_defconfig Geoff Levand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47910CCA.8070602@am.sony.com \
    --to=geoffrey.levand@am$(echo .)sony.com \
    --cc=Geert.Uytterhoeven@sonycom$(echo .)com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox