From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
To: Linux/PPC Development <linuxppc-dev@ozlabs.org>
Cc: Linux kernel mailing list <linux-kernel@vger.kernel.org>,
Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Subject: [patch 6/7] ps3: Refactor ps3_repository_find_device()
Date: Wed, 28 Nov 2007 15:31:48 +0100 [thread overview]
Message-ID: <20071128143438.613525000@pademelon.sonytel.be> (raw)
In-Reply-To: 20071128143142.580732000@pademelon.sonytel.be
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: ps3-wip/ps3-refactor-ps3_repository_find_device.diff --]
[-- Type: text/plain, Size: 2898 bytes --]
From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
ps3: Refactor ps3_repository_find_device() to use the existing
ps3_repository_read_bus_id()
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.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__);
--
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
next prev parent reply other threads:[~2007-11-28 14:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-28 14:31 [patch 0/7] PS3 notification device patches for 2.6.25 Geert Uytterhoeven
2007-11-28 14:31 ` [patch 1/7] ps3: Make bus_id and dev_id u64 Geert Uytterhoeven
2007-11-28 22:16 ` Geoff Levand
2007-11-28 14:31 ` [patch 2/7] ps3: Add ps3_repository_find_device_by_id() Geert Uytterhoeven
2007-11-28 22:18 ` Geoff Levand
2007-11-28 14:31 ` [patch 3/7] ps3: Use the HVs storage device notification mechanism properly Geert Uytterhoeven
2007-11-28 22:25 ` Geoff Levand
2007-12-20 16:56 ` [patch/rfc " Geert Uytterhoeven
2007-11-28 14:31 ` [patch 4/7] ps3: Add repository polling loop to work around hypervisor bug Geert Uytterhoeven
2007-11-28 22:28 ` Geoff Levand
2007-11-28 14:31 ` [patch 5/7] ps3: Kill unused ps3_repository_bump_device() Geert Uytterhoeven
2007-11-28 22:46 ` Geoff Levand
2007-11-28 14:31 ` Geert Uytterhoeven [this message]
2007-11-28 22:48 ` [patch 6/7] ps3: Refactor ps3_repository_find_device() Geoff Levand
2007-11-28 14:31 ` [patch 7/7] ps3: denoise arch/powerpc/platforms/ps3/repository.c Geert Uytterhoeven
2007-11-28 22:49 ` 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=20071128143438.613525000@pademelon.sonytel.be \
--to=geert.uytterhoeven@sonycom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).