Commit ad7d8193 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Paul Mackerras

[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: default avatarGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: default avatarGeoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 0a468937
...@@ -445,35 +445,22 @@ int __devinit ps3_repository_find_devices(enum ps3_bus_type bus_type, ...@@ -445,35 +445,22 @@ 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); 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);
result = ps3_repository_read_bus_type(repo.bus_index,
&repo.bus_type);
if (result) { if (result) {
pr_debug("%s:%d read_bus_type(%u) failed\n", pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__);
__func__, __LINE__, repo.bus_index); return 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, result = ps3_repository_read_bus_id(repo.bus_index, &repo.bus_id);
&repo.bus_id);
if (result) { if (result) {
pr_debug("%s:%d read_bus_id(%u) failed\n", pr_debug("%s:%d read_bus_id(%u) failed\n", __func__, __LINE__,
__func__, __LINE__, repo.bus_index); repo.bus_index);
continue; return result;
} }
for (repo.dev_index = 0; ; repo.dev_index++) { for (repo.dev_index = 0; ; repo.dev_index++) {
result = ps3_repository_find_device(&repo); result = ps3_repository_find_device(&repo);
if (result == -ENODEV) { if (result == -ENODEV) {
result = 0; result = 0;
break; break;
...@@ -481,15 +468,12 @@ int __devinit ps3_repository_find_devices(enum ps3_bus_type bus_type, ...@@ -481,15 +468,12 @@ int __devinit ps3_repository_find_devices(enum ps3_bus_type bus_type,
break; break;
result = callback(&repo); result = callback(&repo);
if (result) { if (result) {
pr_debug("%s:%d: abort at callback\n", __func__, pr_debug("%s:%d: abort at callback\n", __func__,
__LINE__); __LINE__);
break; break;
} }
} }
break;
}
pr_debug(" <- %s:%d\n", __func__, __LINE__); pr_debug(" <- %s:%d\n", __func__, __LINE__);
return result; return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment