Patchwork infiniband/ehca: use consistent type

login
register
mail settings
Submitter Stephen Rothwell
Date Dec. 31, 2008, 3:14 a.m.
Message ID <20081231141453.45d7f2c1.sfr@canb.auug.org.au>
Download mbox | patch
Permalink /patch/16109/
State Not Applicable
Headers show

Comments

Stephen Rothwell - Dec. 31, 2008, 3:14 a.m.
ehca_plpar_hcall9() takes an unsigned long array, so pass that.

This change will avoid some warnings when we change u64 to unsigned
long long.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/infiniband/hw/ehca/hcp_if.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
Roland Dreier - Jan. 7, 2009, 7:32 p.m.
If we're going to clean this code up, does it make sense to take it
further?  More precisely, your patch does:

@@ -226,7 +226,7 @@ u64 hipz_h_alloc_resource_eq(const struct ipz_adapter_handle adapter_handle,
 			     u32 *eq_ist)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 	u64 allocate_controls;

but every parameter of ehca_plpar_hcall9() is unsigned long, and the
return value is a signed long.  So should we change ret to long and all
these other declarations to unsigned long while we're touching the code
here?

 - R.
Stephen Rothwell - Jan. 7, 2009, 11:47 p.m.
Hi Roland,

On Wed, 07 Jan 2009 11:32:13 -0800 Roland Dreier <rdreier@cisco.com> wrote:
>
> If we're going to clean this code up, does it make sense to take it
> further?  More precisely, your patch does:
> 
> @@ -226,7 +226,7 @@ u64 hipz_h_alloc_resource_eq(const struct ipz_adapter_handle adapter_handle,
>  			     u32 *eq_ist)
>  {
>  	u64 ret;
> -	u64 outs[PLPAR_HCALL9_BUFSIZE];
> +	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
>  	u64 allocate_controls;
> 
> but every parameter of ehca_plpar_hcall9() is unsigned long, and the
> return value is a signed long.  So should we change ret to long and all
> these other declarations to unsigned long while we're touching the code
> here?

At least all the others are passed by value and the normal arithmetic
promotion rules apply so no warnings are issued.  I will see how much of
a pain it is to change the others.

Patch

diff --git a/drivers/infiniband/hw/ehca/hcp_if.c b/drivers/infiniband/hw/ehca/hcp_if.c
index 415d3a4..79d95d9 100644
--- a/drivers/infiniband/hw/ehca/hcp_if.c
+++ b/drivers/infiniband/hw/ehca/hcp_if.c
@@ -226,7 +226,7 @@  u64 hipz_h_alloc_resource_eq(const struct ipz_adapter_handle adapter_handle,
 			     u32 *eq_ist)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 	u64 allocate_controls;
 
 	/* resource type */
@@ -270,7 +270,7 @@  u64 hipz_h_alloc_resource_cq(const struct ipz_adapter_handle adapter_handle,
 			     struct ehca_alloc_cq_parms *param)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_ALLOC_RESOURCE, outs,
 				adapter_handle.handle,   /* r4  */
@@ -297,7 +297,7 @@  u64 hipz_h_alloc_resource_qp(const struct ipz_adapter_handle adapter_handle,
 {
 	u64 ret;
 	u64 allocate_controls, max_r10_reg, r11, r12;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	allocate_controls =
 		EHCA_BMASK_SET(H_ALL_RES_QP_ENHANCED_OPS, parms->ext_type)
@@ -525,7 +525,7 @@  u64 hipz_h_disable_and_get_wqe(const struct ipz_adapter_handle adapter_handle,
 			       int dis_and_get_function_code)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_DISABLE_AND_GETC, outs,
 				adapter_handle.handle,     /* r4 */
@@ -548,7 +548,7 @@  u64 hipz_h_modify_qp(const struct ipz_adapter_handle adapter_handle,
 		     struct h_galpa gal)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 	ret = ehca_plpar_hcall9(H_MODIFY_QP, outs,
 				adapter_handle.handle, /* r4 */
 				qp_handle.handle,      /* r5 */
@@ -579,7 +579,7 @@  u64 hipz_h_destroy_qp(const struct ipz_adapter_handle adapter_handle,
 		      struct ehca_qp *qp)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = hcp_galpas_dtor(&qp->galpas);
 	if (ret) {
@@ -625,7 +625,7 @@  u64 hipz_h_define_aqp1(const struct ipz_adapter_handle adapter_handle,
 		       u32 * bma_qp_nr)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_DEFINE_AQP1, outs,
 				adapter_handle.handle, /* r4 */
@@ -733,7 +733,7 @@  u64 hipz_h_alloc_resource_mr(const struct ipz_adapter_handle adapter_handle,
 			     struct ehca_mr_hipzout_parms *outparms)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_ALLOC_RESOURCE, outs,
 				adapter_handle.handle,            /* r4 */
@@ -794,7 +794,7 @@  u64 hipz_h_query_mr(const struct ipz_adapter_handle adapter_handle,
 		    struct ehca_mr_hipzout_parms *outparms)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_QUERY_MR, outs,
 				adapter_handle.handle,     /* r4 */
@@ -828,7 +828,7 @@  u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle,
 			  struct ehca_mr_hipzout_parms *outparms)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_REREGISTER_PMR, outs,
 				adapter_handle.handle,    /* r4 */
@@ -855,7 +855,7 @@  u64 hipz_h_register_smr(const struct ipz_adapter_handle adapter_handle,
 			struct ehca_mr_hipzout_parms *outparms)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_REGISTER_SMR, outs,
 				adapter_handle.handle,            /* r4 */
@@ -877,7 +877,7 @@  u64 hipz_h_alloc_resource_mw(const struct ipz_adapter_handle adapter_handle,
 			     struct ehca_mw_hipzout_parms *outparms)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_ALLOC_RESOURCE, outs,
 				adapter_handle.handle,      /* r4 */
@@ -895,7 +895,7 @@  u64 hipz_h_query_mw(const struct ipz_adapter_handle adapter_handle,
 		    struct ehca_mw_hipzout_parms *outparms)
 {
 	u64 ret;
-	u64 outs[PLPAR_HCALL9_BUFSIZE];
+	unsigned long outs[PLPAR_HCALL9_BUFSIZE];
 
 	ret = ehca_plpar_hcall9(H_QUERY_MW, outs,
 				adapter_handle.handle,    /* r4 */