ps3: repository misc fixes
Subsystems (2)
PATCH 1/14 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
- Export repository functions needed by the PS3 storage driver
- Minor error condition improvements.
--- arch/powerpc/platforms/ps3/repository.c | 41 +++++++++++++++++++++----------- include/asm-powerpc/ps3.h | 16 ++++++------ 2 files changed, 36 insertions(+), 21 deletions(-)
arch/powerpc/platforms/ps3/repository.c +28 -13
@@ -181,6 +181,7 @@ int ps3_repository_read_bus_id(unsigned *bus_id = v1;return result; } +EXPORT_SYMBOL_GPL (ps3_repository_read_bus_id);int ps3_repository_read_bus_type (unsigned int bus_index,enum ps3_bus_type *bus_type)
@@ -196,6 +197,7 @@ int ps3_repository_read_bus_type(unsigne *bus_type = v1;return result; } +EXPORT_SYMBOL_GPL (ps3_repository_read_bus_type);int ps3_repository_read_bus_num_dev (unsigned int bus_index,unsigned int *num_dev)
@@ -211,6 +213,7 @@ int ps3_repository_read_bus_num_dev(unsi *num_dev = v1;return result; } +EXPORT_SYMBOL_GPL (ps3_repository_read_bus_num_dev);int ps3_repository_read_dev_str (unsigned int bus_index,unsigned int dev_index,const char *dev_str,u64 *value)
@@ -238,6 +241,7 @@ int ps3_repository_read_dev_id(unsigned *dev_id = v1;return result; } +EXPORT_SYMBOL_GPL (ps3_repository_read_dev_id);int ps3_repository_read_dev_type (unsigned int bus_index,unsigned int dev_index,enum ps3_dev_type *dev_type)
@@ -254,10 +258,11 @@ int ps3_repository_read_dev_type(unsigne *dev_type = v1;return result; } +EXPORT_SYMBOL_GPL (ps3_repository_read_dev_type);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;
@@ -273,9 +278,11 @@ int ps3_repository_read_dev_intr(unsigne *interrupt_id = v2;return result; } +EXPORT_SYMBOL_GPL (ps3_repository_read_dev_intr);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 +309,8 @@ int ps3_repository_read_dev_reg_addr(uns }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 +350,7 @@ int ps3_repository_dump_resource_info(un }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 +494,8 @@ static int find_device(unsigned int bus_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 +529,7 @@ int ps3_repository_find_device (enum ps3pr_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 +540,15 @@ int ps3_repository_find_device (enum ps3if (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);
@@ -574,6 +584,7 @@ int ps3_repository_find_device (enum ps3return result; } +EXPORT_SYMBOL_GPL (ps3_repository_find_device);int ps3_repository_find_interrupt (const struct ps3_repository_device *dev,enum ps3_interrupt_type intr_type,unsigned int *interrupt_id)
@@ -604,7 +615,8 @@ int ps3_repository_find_interrupt(const } } -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 +624,8 @@ int ps3_repository_find_interrupt(constreturn 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 +635,7 @@ int ps3_repository_find_region(const str *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 +655,8 @@ int ps3_repository_find_region(const str } } -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);
@@ -761,6 +774,7 @@ int ps3_repository_read_boot_dat_address0 , address, 0); } +EXPORT_SYMBOL_GPL (ps3_repository_read_stor_dev_info);int ps3_repository_read_boot_dat_size (unsigned int *size) {
@@ -827,6 +841,7 @@ int ps3_repository_read_tb_freq(u64 node0 , tb_freq, 0); } +EXPORT_SYMBOL_GPL (ps3_repository_read_stor_dev_region);int ps3_repository_read_be_tb_freq (unsigned int be_index,u64 *tb_freq) {
include/asm-powerpc/ps3.h +8 -8
@@ -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(unsigne 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_fi }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 */
Quoted 2 lines · Geoff Levand
Signed-off-by Geert Uytterhoeven <[email protected]>Signed-off-by Geoff Levand <[email protected]>
Quoted 7 lines · Geoff Levand
(quoted diff) +4
-0+EXPORT_SYMBOL_GPL(ps3_repository_read_bus_id); +EXPORT_SYMBOL_GPL(ps3_repository_read_bus_type); +EXPORT_SYMBOL_GPL(ps3_repository_read_bus_num_dev); +EXPORT_SYMBOL_GPL(ps3_repository_read_dev_id);
Review
Quoted 10 lines
(quoted diff) +5
-0+EXPORT_SYMBOL_GPL(ps3_repository_read_dev_type); +EXPORT_SYMBOL_GPL(ps3_repository_read_dev_intr); +EXPORT_SYMBOL_GPL(ps3_repository_find_device); +EXPORT_SYMBOL_GPL(ps3_repository_read_stor_dev_info); +EXPORT_SYMBOL_GPL(ps3_repository_read_stor_dev_region);
Exporting all these as procedural interfaces is very wrong. Please implement a proper bustype for your hypervisor devices where all this information is an attribute of the hv1_device object.
Quoted 15 lines · Christoph Hellwig
Quoted 13 lines · Geoff Levand
(quoted diff) +7
-0+EXPORT_SYMBOL_GPL(ps3_repository_read_bus_id); +EXPORT_SYMBOL_GPL(ps3_repository_read_bus_type); +EXPORT_SYMBOL_GPL(ps3_repository_read_bus_num_dev); +EXPORT_SYMBOL_GPL(ps3_repository_read_dev_id); +EXPORT_SYMBOL_GPL(ps3_repository_read_dev_type); +EXPORT_SYMBOL_GPL(ps3_repository_read_dev_intr); +EXPORT_SYMBOL_GPL(ps3_repository_find_device);
Quoted 8 lines
arch/powerpc/platforms/ps3/repository.c int ps3_repository_read_boot_dat_address
Quoted 3 lines
arch/powerpc/platforms/ps3/repository.c +2
-0+EXPORT_SYMBOL_GPL (ps3_repository_read_stor_dev_info); +EXPORT_SYMBOL_GPL (ps3_repository_read_stor_dev_region);Exporting all these as procedural interfaces is very wrong. Please implement a proper bustype for your hypervisor devices where all this information is an attribute of the
hv1_deviceobject.
In addition to that there's no user of these exports in this patch, so there is no point in adding any kind of export for this type of information at all yet. (until we have a proper storage driver)
Quoted 21 lines · Christoph Hellwig
Quoted 20 lines · Christoph Hellwig
Quoted 17 lines · Geoff Levand
(quoted diff) +9
-0+EXPORT_SYMBOL_GPL(ps3_repository_read_bus_id); +EXPORT_SYMBOL_GPL(ps3_repository_read_bus_type); +EXPORT_SYMBOL_GPL(ps3_repository_read_bus_num_dev); +EXPORT_SYMBOL_GPL(ps3_repository_read_dev_id); +EXPORT_SYMBOL_GPL(ps3_repository_read_dev_type); +EXPORT_SYMBOL_GPL(ps3_repository_read_dev_intr); +EXPORT_SYMBOL_GPL(ps3_repository_find_device); +EXPORT_SYMBOL_GPL(ps3_repository_read_stor_dev_info); +EXPORT_SYMBOL_GPL(ps3_repository_read_stor_dev_region);
Quoted 7 lines
Quoted 3 lines
Exporting all these as procedural interfaces is very wrong. Please implement a proper bustype for your hypervisor devices where all this information is an attribute of the
hv1_deviceobject.In addition to that there's no user of these exports in this patch, so there is no point in adding any kind of export for this type of information at all yet. (until we have a proper storage driver)
Both good points. I'll remove this from the patch and rework it for later submission.
-Geoff