aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2007-01-26 19:07:47 -0800
committerPaul Mackerras <paulus@samba.org>2007-02-07 14:03:17 +1100
commiteebb81c13aa831a623e903bbae97a23fe9be93eb (patch)
tree5bd1fd1a3abebaf9d99fb028c42347f3918e7fde
parent25c4a46f0ed8ece9ac6699e200fcc83a4642dce7 (diff)
[POWERPC] ps3: repository misc fixes
Various fixes for the PS3 repository code: - Sync signatures of function prototypes and implementations (enum vs. unsigned int) - Correct references to `regions' as `registers': o Correct enum ps3_region_type as enum ps3_reg_type, o Correct PS3_REGION_TYPE_* as PS3_REG_TYPE_*, o Correct ps3_repository_find_region() as ps3_repository_find_reg(). - Correct function name in pr_debug() call - Minor error condition improvements. Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/platforms/ps3/repository.c32
-rw-r--r--include/asm-powerpc/ps3.h16
2 files changed, 27 insertions, 21 deletions
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index 273a0d621bd..9ef31a5b703 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -257,7 +257,7 @@ int ps3_repository_read_dev_type(unsigned int bus_index,
int ps3_repository_read_dev_intr(unsigned int bus_index,
unsigned int dev_index, unsigned int intr_index,
- unsigned int *intr_type, unsigned int* interrupt_id)
+ enum ps3_interrupt_type *intr_type, unsigned int* interrupt_id)
{
int result;
u64 v1;
@@ -275,7 +275,8 @@ int ps3_repository_read_dev_intr(unsigned int bus_index,
}
int ps3_repository_read_dev_reg_type(unsigned int bus_index,
- unsigned int dev_index, unsigned int reg_index, unsigned int *reg_type)
+ unsigned int dev_index, unsigned int reg_index,
+ enum ps3_reg_type *reg_type)
{
int result;
u64 v1;
@@ -302,8 +303,8 @@ int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
}
int ps3_repository_read_dev_reg(unsigned int bus_index,
- unsigned int dev_index, unsigned int reg_index, unsigned int *reg_type,
- u64 *bus_addr, u64 *len)
+ unsigned int dev_index, unsigned int reg_index,
+ enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len)
{
int result = ps3_repository_read_dev_reg_type(bus_index, dev_index,
reg_index, reg_type);
@@ -343,7 +344,7 @@ int ps3_repository_dump_resource_info(unsigned int bus_index,
}
for (res_index = 0; res_index < 10; res_index++) {
- enum ps3_region_type reg_type;
+ enum ps3_reg_type reg_type;
u64 bus_addr;
u64 len;
@@ -487,7 +488,8 @@ static int find_device(unsigned int bus_index, unsigned int num_dev,
break;
}
- BUG_ON(dev_index == num_dev);
+ if (dev_index == num_dev)
+ return -1;
pr_debug("%s:%d: found dev_type %u at dev_index %u\n",
__func__, __LINE__, dev_type, dev_index);
@@ -521,7 +523,7 @@ int ps3_repository_find_device (enum ps3_bus_type bus_type,
pr_debug("%s:%d: find bus_type %u, dev_type %u\n", __func__, __LINE__,
bus_type, dev_type);
- dev->bus_index = UINT_MAX;
+ BUG_ON(start_dev && start_dev->bus_index > 10);
for (bus_index = start_dev ? start_dev->bus_index : 0; bus_index < 10;
bus_index++) {
@@ -532,13 +534,15 @@ int ps3_repository_find_device (enum ps3_bus_type bus_type,
if (result) {
pr_debug("%s:%d read_bus_type failed\n",
__func__, __LINE__);
+ dev->bus_index = UINT_MAX;
return result;
}
if (x == bus_type)
break;
}
- BUG_ON(bus_index == 10);
+ if (bus_index >= 10)
+ return -ENODEV;
pr_debug("%s:%d: found bus_type %u at bus_index %u\n",
__func__, __LINE__, bus_type, bus_index);
@@ -604,7 +608,8 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
}
}
- BUG_ON(res_index == 10);
+ if (res_index == 10)
+ return -ENODEV;
pr_debug("%s:%d: found intr_type %u at res_index %u\n",
__func__, __LINE__, intr_type, res_index);
@@ -612,8 +617,8 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
return result;
}
-int ps3_repository_find_region(const struct ps3_repository_device *dev,
- enum ps3_region_type reg_type, u64 *bus_addr, u64 *len)
+int ps3_repository_find_reg(const struct ps3_repository_device *dev,
+ enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len)
{
int result = 0;
unsigned int res_index;
@@ -623,7 +628,7 @@ int ps3_repository_find_region(const struct ps3_repository_device *dev,
*bus_addr = *len = 0;
for (res_index = 0; res_index < 10; res_index++) {
- enum ps3_region_type t;
+ enum ps3_reg_type t;
u64 a;
u64 l;
@@ -643,7 +648,8 @@ int ps3_repository_find_region(const struct ps3_repository_device *dev,
}
}
- BUG_ON(res_index == 10);
+ if (res_index == 10)
+ return -ENODEV;
pr_debug("%s:%d: found reg_type %u at res_index %u\n",
__func__, __LINE__, reg_type, res_index);
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h
index 52a69ed0d90..b56aca28b26 100644
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -277,10 +277,10 @@ enum ps3_interrupt_type {
PS3_INTERRUPT_TYPE_OTHER = 5,
};
-enum ps3_region_type {
- PS3_REGION_TYPE_SB_OHCI = 3,
- PS3_REGION_TYPE_SB_EHCI = 4,
- PS3_REGION_TYPE_SB_GPIO = 5,
+enum ps3_reg_type {
+ PS3_REG_TYPE_SB_OHCI = 3,
+ PS3_REG_TYPE_SB_EHCI = 4,
+ PS3_REG_TYPE_SB_GPIO = 5,
};
int ps3_repository_read_dev_str(unsigned int bus_index,
@@ -294,13 +294,13 @@ int ps3_repository_read_dev_intr(unsigned int bus_index,
enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id);
int ps3_repository_read_dev_reg_type(unsigned int bus_index,
unsigned int dev_index, unsigned int reg_index,
- enum ps3_region_type *reg_type);
+ enum ps3_reg_type *reg_type);
int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
unsigned int dev_index, unsigned int reg_index, u64 *bus_addr,
u64 *len);
int ps3_repository_read_dev_reg(unsigned int bus_index,
unsigned int dev_index, unsigned int reg_index,
- enum ps3_region_type *reg_type, u64 *bus_addr, u64 *len);
+ enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len);
/* repository bus enumerators */
@@ -322,8 +322,8 @@ static inline int ps3_repository_find_first_device(
}
int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);
-int ps3_repository_find_region(const struct ps3_repository_device *dev,
- enum ps3_region_type reg_type, u64 *bus_addr, u64 *len);
+int ps3_repository_find_reg(const struct ps3_repository_device *dev,
+ enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len);
/* repository block device info */