aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2007-01-26 22:07:47 -0500
committerPaul Mackerras <paulus@samba.org>2007-02-06 22:03:17 -0500
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 273a0d621bdd..9ef31a5b7035 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,
257 257
258int ps3_repository_read_dev_intr(unsigned int bus_index, 258int ps3_repository_read_dev_intr(unsigned int bus_index,
259 unsigned int dev_index, unsigned int intr_index, 259 unsigned int dev_index, unsigned int intr_index,
260 unsigned int *intr_type, unsigned int* interrupt_id) 260 enum ps3_interrupt_type *intr_type, unsigned int* interrupt_id)
261{ 261{
262 int result; 262 int result;
263 u64 v1; 263 u64 v1;
@@ -275,7 +275,8 @@ int ps3_repository_read_dev_intr(unsigned int bus_index,
275} 275}
276 276
277int ps3_repository_read_dev_reg_type(unsigned int bus_index, 277int ps3_repository_read_dev_reg_type(unsigned int bus_index,
278 unsigned int dev_index, unsigned int reg_index, unsigned int *reg_type) 278 unsigned int dev_index, unsigned int reg_index,
279 enum ps3_reg_type *reg_type)
279{ 280{
280 int result; 281 int result;
281 u64 v1; 282 u64 v1;
@@ -302,8 +303,8 @@ int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
302} 303}
303 304
304int ps3_repository_read_dev_reg(unsigned int bus_index, 305int ps3_repository_read_dev_reg(unsigned int bus_index,
305 unsigned int dev_index, unsigned int reg_index, unsigned int *reg_type, 306 unsigned int dev_index, unsigned int reg_index,
306 u64 *bus_addr, u64 *len) 307 enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len)
307{ 308{
308 int result = ps3_repository_read_dev_reg_type(bus_index, dev_index, 309 int result = ps3_repository_read_dev_reg_type(bus_index, dev_index,
309 reg_index, reg_type); 310 reg_index, reg_type);
@@ -343,7 +344,7 @@ int ps3_repository_dump_resource_info(unsigned int bus_index,
343 } 344 }
344 345
345 for (res_index = 0; res_index < 10; res_index++) { 346 for (res_index = 0; res_index < 10; res_index++) {
346 enum ps3_region_type reg_type; 347 enum ps3_reg_type reg_type;
347 u64 bus_addr; 348 u64 bus_addr;
348 u64 len; 349 u64 len;
349 350
@@ -487,7 +488,8 @@ static int find_device(unsigned int bus_index, unsigned int num_dev,
487 break; 488 break;
488 } 489 }
489 490
490 BUG_ON(dev_index == num_dev); 491 if (dev_index == num_dev)
492 return -1;
491 493
492 pr_debug("%s:%d: found dev_type %u at dev_index %u\n", 494 pr_debug("%s:%d: found dev_type %u at dev_index %u\n",
493 __func__, __LINE__, dev_type, dev_index); 495 __func__, __LINE__, dev_type, dev_index);
@@ -521,7 +523,7 @@ int ps3_repository_find_device (enum ps3_bus_type bus_type,
521 pr_debug("%s:%d: find bus_type %u, dev_type %u\n", __func__, __LINE__, 523 pr_debug("%s:%d: find bus_type %u, dev_type %u\n", __func__, __LINE__,
522 bus_type, dev_type); 524 bus_type, dev_type);
523 525
524 dev->bus_index = UINT_MAX; 526 BUG_ON(start_dev && start_dev->bus_index > 10);
525 527
526 for (bus_index = start_dev ? start_dev->bus_index : 0; bus_index < 10; 528 for (bus_index = start_dev ? start_dev->bus_index : 0; bus_index < 10;
527 bus_index++) { 529 bus_index++) {
@@ -532,13 +534,15 @@ int ps3_repository_find_device (enum ps3_bus_type bus_type,
532 if (result) { 534 if (result) {
533 pr_debug("%s:%d read_bus_type failed\n", 535 pr_debug("%s:%d read_bus_type failed\n",
534 __func__, __LINE__); 536 __func__, __LINE__);
537 dev->bus_index = UINT_MAX;
535 return result; 538 return result;
536 } 539 }
537 if (x == bus_type) 540 if (x == bus_type)
538 break; 541 break;
539 } 542 }
540 543
541 BUG_ON(bus_index == 10); 544 if (bus_index >= 10)
545 return -ENODEV;
542 546
543 pr_debug("%s:%d: found bus_type %u at bus_index %u\n", 547 pr_debug("%s:%d: found bus_type %u at bus_index %u\n",
544 __func__, __LINE__, bus_type, bus_index); 548 __func__, __LINE__, bus_type, bus_index);
@@ -604,7 +608,8 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
604 } 608 }
605 } 609 }
606 610
607 BUG_ON(res_index == 10); 611 if (res_index == 10)
612 return -ENODEV;
608 613
609 pr_debug("%s:%d: found intr_type %u at res_index %u\n", 614 pr_debug("%s:%d: found intr_type %u at res_index %u\n",
610 __func__, __LINE__, intr_type, res_index); 615 __func__, __LINE__, intr_type, res_index);
@@ -612,8 +617,8 @@ int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
612 return result; 617 return result;
613} 618}
614 619
615int ps3_repository_find_region(const struct ps3_repository_device *dev, 620int ps3_repository_find_reg(const struct ps3_repository_device *dev,
616 enum ps3_region_type reg_type, u64 *bus_addr, u64 *len) 621 enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len)
617{ 622{
618 int result = 0; 623 int result = 0;
619 unsigned int res_index; 624 unsigned int res_index;
@@ -623,7 +628,7 @@ int ps3_repository_find_region(const struct ps3_repository_device *dev,
623 *bus_addr = *len = 0; 628 *bus_addr = *len = 0;
624 629
625 for (res_index = 0; res_index < 10; res_index++) { 630 for (res_index = 0; res_index < 10; res_index++) {
626 enum ps3_region_type t; 631 enum ps3_reg_type t;
627 u64 a; 632 u64 a;
628 u64 l; 633 u64 l;
629 634
@@ -643,7 +648,8 @@ int ps3_repository_find_region(const struct ps3_repository_device *dev,
643 } 648 }
644 } 649 }
645 650
646 BUG_ON(res_index == 10); 651 if (res_index == 10)
652 return -ENODEV;
647 653
648 pr_debug("%s:%d: found reg_type %u at res_index %u\n", 654 pr_debug("%s:%d: found reg_type %u at res_index %u\n",
649 __func__, __LINE__, reg_type, res_index); 655 __func__, __LINE__, reg_type, res_index);
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h
index 52a69ed0d90a..b56aca28b26d 100644
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -277,10 +277,10 @@ enum ps3_interrupt_type {
277 PS3_INTERRUPT_TYPE_OTHER = 5, 277 PS3_INTERRUPT_TYPE_OTHER = 5,
278}; 278};
279 279
280enum ps3_region_type { 280enum ps3_reg_type {
281 PS3_REGION_TYPE_SB_OHCI = 3, 281 PS3_REG_TYPE_SB_OHCI = 3,
282 PS3_REGION_TYPE_SB_EHCI = 4, 282 PS3_REG_TYPE_SB_EHCI = 4,
283 PS3_REGION_TYPE_SB_GPIO = 5, 283 PS3_REG_TYPE_SB_GPIO = 5,
284}; 284};
285 285
286int ps3_repository_read_dev_str(unsigned int bus_index, 286int ps3_repository_read_dev_str(unsigned int bus_index,
@@ -294,13 +294,13 @@ int ps3_repository_read_dev_intr(unsigned int bus_index,
294 enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id); 294 enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id);
295int ps3_repository_read_dev_reg_type(unsigned int bus_index, 295int ps3_repository_read_dev_reg_type(unsigned int bus_index,
296 unsigned int dev_index, unsigned int reg_index, 296 unsigned int dev_index, unsigned int reg_index,
297 enum ps3_region_type *reg_type); 297 enum ps3_reg_type *reg_type);
298int ps3_repository_read_dev_reg_addr(unsigned int bus_index, 298int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
299 unsigned int dev_index, unsigned int reg_index, u64 *bus_addr, 299 unsigned int dev_index, unsigned int reg_index, u64 *bus_addr,
300 u64 *len); 300 u64 *len);
301int ps3_repository_read_dev_reg(unsigned int bus_index, 301int ps3_repository_read_dev_reg(unsigned int bus_index,
302 unsigned int dev_index, unsigned int reg_index, 302 unsigned int dev_index, unsigned int reg_index,
303 enum ps3_region_type *reg_type, u64 *bus_addr, u64 *len); 303 enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len);
304 304
305/* repository bus enumerators */ 305/* repository bus enumerators */
306 306
@@ -322,8 +322,8 @@ static inline int ps3_repository_find_first_device(
322} 322}
323int ps3_repository_find_interrupt(const struct ps3_repository_device *dev, 323int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
324 enum ps3_interrupt_type intr_type, unsigned int *interrupt_id); 324 enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);
325int ps3_repository_find_region(const struct ps3_repository_device *dev, 325int ps3_repository_find_reg(const struct ps3_repository_device *dev,
326 enum ps3_region_type reg_type, u64 *bus_addr, u64 *len); 326 enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len);
327 327
328/* repository block device info */ 328/* repository block device info */
329 329