Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b94397a authored by Hoang-Nam Nguyen's avatar Hoang-Nam Nguyen Committed by Roland Dreier
Browse files

IB/ehca: Fix warnings issued by checkpatch.pl



Run the existing ehca code through checkpatch.pl and clean up the
worst of the coding style violations.

Signed-off-by: default avatarJoachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 187c72e3
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -96,7 +96,8 @@ int ehca_create_eq(struct ehca_shca *shca,
	for (i = 0; i < nr_pages; i++) {
	for (i = 0; i < nr_pages; i++) {
		u64 rpage;
		u64 rpage;


		if (!(vpage = ipz_qpageit_get_inc(&eq->ipz_queue))) {
		vpage = ipz_qpageit_get_inc(&eq->ipz_queue);
		if (!vpage) {
			ret = H_RESOURCE;
			ret = H_RESOURCE;
			goto create_eq_exit2;
			goto create_eq_exit2;
		}
		}
+20 −8
Original line number Original line Diff line number Diff line
@@ -127,6 +127,7 @@ int ehca_query_port(struct ib_device *ibdev,
		    u8 port, struct ib_port_attr *props)
		    u8 port, struct ib_port_attr *props)
{
{
	int ret = 0;
	int ret = 0;
	u64 h_ret;
	struct ehca_shca *shca = container_of(ibdev, struct ehca_shca,
	struct ehca_shca *shca = container_of(ibdev, struct ehca_shca,
					      ib_device);
					      ib_device);
	struct hipz_query_port *rblock;
	struct hipz_query_port *rblock;
@@ -137,7 +138,8 @@ int ehca_query_port(struct ib_device *ibdev,
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	if (hipz_h_query_port(shca->ipz_hca_handle, port, rblock) != H_SUCCESS) {
	h_ret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock);
	if (h_ret != H_SUCCESS) {
		ehca_err(&shca->ib_device, "Can't query port properties");
		ehca_err(&shca->ib_device, "Can't query port properties");
		ret = -EINVAL;
		ret = -EINVAL;
		goto query_port1;
		goto query_port1;
@@ -197,6 +199,7 @@ int ehca_query_sma_attr(struct ehca_shca *shca,
			u8 port, struct ehca_sma_attr *attr)
			u8 port, struct ehca_sma_attr *attr)
{
{
	int ret = 0;
	int ret = 0;
	u64 h_ret;
	struct hipz_query_port *rblock;
	struct hipz_query_port *rblock;


	rblock = ehca_alloc_fw_ctrlblock(GFP_ATOMIC);
	rblock = ehca_alloc_fw_ctrlblock(GFP_ATOMIC);
@@ -205,7 +208,8 @@ int ehca_query_sma_attr(struct ehca_shca *shca,
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	if (hipz_h_query_port(shca->ipz_hca_handle, port, rblock) != H_SUCCESS) {
	h_ret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock);
	if (h_ret != H_SUCCESS) {
		ehca_err(&shca->ib_device, "Can't query port properties");
		ehca_err(&shca->ib_device, "Can't query port properties");
		ret = -EINVAL;
		ret = -EINVAL;
		goto query_sma_attr1;
		goto query_sma_attr1;
@@ -230,9 +234,11 @@ int ehca_query_sma_attr(struct ehca_shca *shca,
int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
{
{
	int ret = 0;
	int ret = 0;
	struct ehca_shca *shca = container_of(ibdev, struct ehca_shca, ib_device);
	u64 h_ret;
	struct ehca_shca *shca;
	struct hipz_query_port *rblock;
	struct hipz_query_port *rblock;


	shca = container_of(ibdev, struct ehca_shca, ib_device);
	if (index > 16) {
	if (index > 16) {
		ehca_err(&shca->ib_device, "Invalid index: %x.", index);
		ehca_err(&shca->ib_device, "Invalid index: %x.", index);
		return -EINVAL;
		return -EINVAL;
@@ -244,7 +250,8 @@ int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	if (hipz_h_query_port(shca->ipz_hca_handle, port, rblock) != H_SUCCESS) {
	h_ret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock);
	if (h_ret != H_SUCCESS) {
		ehca_err(&shca->ib_device, "Can't query port properties");
		ehca_err(&shca->ib_device, "Can't query port properties");
		ret = -EINVAL;
		ret = -EINVAL;
		goto query_pkey1;
		goto query_pkey1;
@@ -262,6 +269,7 @@ int ehca_query_gid(struct ib_device *ibdev, u8 port,
		   int index, union ib_gid *gid)
		   int index, union ib_gid *gid)
{
{
	int ret = 0;
	int ret = 0;
	u64 h_ret;
	struct ehca_shca *shca = container_of(ibdev, struct ehca_shca,
	struct ehca_shca *shca = container_of(ibdev, struct ehca_shca,
					      ib_device);
					      ib_device);
	struct hipz_query_port *rblock;
	struct hipz_query_port *rblock;
@@ -277,7 +285,8 @@ int ehca_query_gid(struct ib_device *ibdev, u8 port,
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	if (hipz_h_query_port(shca->ipz_hca_handle, port, rblock) != H_SUCCESS) {
	h_ret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock);
	if (h_ret != H_SUCCESS) {
		ehca_err(&shca->ib_device, "Can't query port properties");
		ehca_err(&shca->ib_device, "Can't query port properties");
		ret = -EINVAL;
		ret = -EINVAL;
		goto query_gid1;
		goto query_gid1;
@@ -302,11 +311,12 @@ int ehca_modify_port(struct ib_device *ibdev,
		     struct ib_port_modify *props)
		     struct ib_port_modify *props)
{
{
	int ret = 0;
	int ret = 0;
	struct ehca_shca *shca = container_of(ibdev, struct ehca_shca, ib_device);
	struct ehca_shca *shca;
	struct hipz_query_port *rblock;
	struct hipz_query_port *rblock;
	u32 cap;
	u32 cap;
	u64 hret;
	u64 hret;


	shca = container_of(ibdev, struct ehca_shca, ib_device);
	if ((props->set_port_cap_mask | props->clr_port_cap_mask)
	if ((props->set_port_cap_mask | props->clr_port_cap_mask)
	    & ~allowed_port_caps) {
	    & ~allowed_port_caps) {
		ehca_err(&shca->ib_device, "Non-changeable bits set in masks  "
		ehca_err(&shca->ib_device, "Non-changeable bits set in masks  "
@@ -325,7 +335,8 @@ int ehca_modify_port(struct ib_device *ibdev,
		goto modify_port1;
		goto modify_port1;
	}
	}


	if (hipz_h_query_port(shca->ipz_hca_handle, port, rblock) != H_SUCCESS) {
	hret = hipz_h_query_port(shca->ipz_hca_handle, port, rblock);
	if (hret != H_SUCCESS) {
		ehca_err(&shca->ib_device, "Can't query port properties");
		ehca_err(&shca->ib_device, "Can't query port properties");
		ret = -EINVAL;
		ret = -EINVAL;
		goto modify_port2;
		goto modify_port2;
@@ -337,7 +348,8 @@ int ehca_modify_port(struct ib_device *ibdev,
	hret = hipz_h_modify_port(shca->ipz_hca_handle, port,
	hret = hipz_h_modify_port(shca->ipz_hca_handle, port,
				  cap, props->init_type, port_modify_mask);
				  cap, props->init_type, port_modify_mask);
	if (hret != H_SUCCESS) {
	if (hret != H_SUCCESS) {
		ehca_err(&shca->ib_device, "Modify port failed  hret=%lx", hret);
		ehca_err(&shca->ib_device, "Modify port failed  hret=%lx",
			 hret);
		ret = -EINVAL;
		ret = -EINVAL;
	}
	}


+4 −3
Original line number Original line Diff line number Diff line
@@ -81,8 +81,9 @@ struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd,
			       int num_phys_buf,
			       int num_phys_buf,
			       int mr_access_flags, u64 *iova_start);
			       int mr_access_flags, u64 *iova_start);


struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64 virt,
struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
			       int mr_access_flags, struct ib_udata *udata);
			       u64 virt, int mr_access_flags,
			       struct ib_udata *udata);


int ehca_rereg_phys_mr(struct ib_mr *mr,
int ehca_rereg_phys_mr(struct ib_mr *mr,
		       int mr_rereg_mask,
		       int mr_rereg_mask,
+12 −9
Original line number Original line Diff line number Diff line
@@ -107,7 +107,7 @@ static DEFINE_SPINLOCK(shca_list_lock);
static struct timer_list poll_eqs_timer;
static struct timer_list poll_eqs_timer;


#ifdef CONFIG_PPC_64K_PAGES
#ifdef CONFIG_PPC_64K_PAGES
static struct kmem_cache *ctblk_cache = NULL;
static struct kmem_cache *ctblk_cache;


void *ehca_alloc_fw_ctrlblock(gfp_t flags)
void *ehca_alloc_fw_ctrlblock(gfp_t flags)
{
{
@@ -868,18 +868,21 @@ int __init ehca_module_init(void)
	printk(KERN_INFO "eHCA Infiniband Device Driver "
	printk(KERN_INFO "eHCA Infiniband Device Driver "
	       "(Rel.: SVNEHCA_0023)\n");
	       "(Rel.: SVNEHCA_0023)\n");


	if ((ret = ehca_create_comp_pool())) {
	ret = ehca_create_comp_pool();
	if (ret) {
		ehca_gen_err("Cannot create comp pool.");
		ehca_gen_err("Cannot create comp pool.");
		return ret;
		return ret;
	}
	}


	if ((ret = ehca_create_slab_caches())) {
	ret = ehca_create_slab_caches();
	if (ret) {
		ehca_gen_err("Cannot create SLAB caches");
		ehca_gen_err("Cannot create SLAB caches");
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto module_init1;
		goto module_init1;
	}
	}


	if ((ret = ibmebus_register_driver(&ehca_driver))) {
	ret = ibmebus_register_driver(&ehca_driver);
	if (ret) {
		ehca_gen_err("Cannot register eHCA device driver");
		ehca_gen_err("Cannot register eHCA device driver");
		ret = -EINVAL;
		ret = -EINVAL;
		goto module_init2;
		goto module_init2;
+30 −29
Original line number Original line Diff line number Diff line
@@ -61,9 +61,9 @@ static struct ehca_mr *ehca_mr_new(void)
	struct ehca_mr *me;
	struct ehca_mr *me;


	me = kmem_cache_zalloc(mr_cache, GFP_KERNEL);
	me = kmem_cache_zalloc(mr_cache, GFP_KERNEL);
	if (me) {
	if (me)
		spin_lock_init(&me->mrlock);
		spin_lock_init(&me->mrlock);
	} else
	else
		ehca_gen_err("alloc failed");
		ehca_gen_err("alloc failed");


	return me;
	return me;
@@ -79,9 +79,9 @@ static struct ehca_mw *ehca_mw_new(void)
	struct ehca_mw *me;
	struct ehca_mw *me;


	me = kmem_cache_zalloc(mw_cache, GFP_KERNEL);
	me = kmem_cache_zalloc(mw_cache, GFP_KERNEL);
	if (me) {
	if (me)
		spin_lock_init(&me->mwlock);
		spin_lock_init(&me->mwlock);
	} else
	else
		ehca_gen_err("alloc failed");
		ehca_gen_err("alloc failed");


	return me;
	return me;
@@ -246,8 +246,9 @@ struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd,


/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/


struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64 virt,
struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
			       int mr_access_flags, struct ib_udata *udata)
			       u64 virt, int mr_access_flags,
			       struct ib_udata *udata)
{
{
	struct ib_mr *ib_mr;
	struct ib_mr *ib_mr;
	struct ehca_mr *e_mr;
	struct ehca_mr *e_mr;
@@ -322,8 +323,9 @@ struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64 virt
						     (&e_mr->umem->chunk_list),
						     (&e_mr->umem->chunk_list),
						     list);
						     list);


	ret = ehca_reg_mr(shca, e_mr, (u64*) virt, length, mr_access_flags, e_pd,
	ret = ehca_reg_mr(shca, e_mr, (u64 *)virt, length, mr_access_flags,
			  &pginfo, &e_mr->ib.ib_mr.lkey, &e_mr->ib.ib_mr.rkey);
			  e_pd, &pginfo, &e_mr->ib.ib_mr.lkey,
			  &e_mr->ib.ib_mr.rkey);
	if (ret) {
	if (ret) {
		ib_mr = ERR_PTR(ret);
		ib_mr = ERR_PTR(ret);
		goto reg_user_mr_exit2;
		goto reg_user_mr_exit2;
@@ -420,7 +422,7 @@ int ehca_rereg_phys_mr(struct ib_mr *mr,
			goto rereg_phys_mr_exit0;
			goto rereg_phys_mr_exit0;
		}
		}
		if (!phys_buf_array || num_phys_buf <= 0) {
		if (!phys_buf_array || num_phys_buf <= 0) {
			ehca_err(mr->device, "bad input values: mr_rereg_mask=%x"
			ehca_err(mr->device, "bad input values mr_rereg_mask=%x"
				 " phys_buf_array=%p num_phys_buf=%x",
				 " phys_buf_array=%p num_phys_buf=%x",
				 mr_rereg_mask, phys_buf_array, num_phys_buf);
				 mr_rereg_mask, phys_buf_array, num_phys_buf);
			ret = -EINVAL;
			ret = -EINVAL;
@@ -444,10 +446,10 @@ int ehca_rereg_phys_mr(struct ib_mr *mr,


	/* set requested values dependent on rereg request */
	/* set requested values dependent on rereg request */
	spin_lock_irqsave(&e_mr->mrlock, sl_flags);
	spin_lock_irqsave(&e_mr->mrlock, sl_flags);
	new_start = e_mr->start;  /* new == old address */
	new_start = e_mr->start;
	new_size  = e_mr->size;	  /* new == old length */
	new_size = e_mr->size;
	new_acl   = e_mr->acl;	  /* new == old access control */
	new_acl = e_mr->acl;
	new_pd    = container_of(mr->pd,struct ehca_pd,ib_pd); /*new == old PD*/
	new_pd = container_of(mr->pd, struct ehca_pd, ib_pd);


	if (mr_rereg_mask & IB_MR_REREG_TRANS) {
	if (mr_rereg_mask & IB_MR_REREG_TRANS) {
		new_start = iova_start;	/* change address */
		new_start = iova_start;	/* change address */
@@ -517,7 +519,7 @@ int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr)
	struct ehca_pd *my_pd = container_of(mr->pd, struct ehca_pd, ib_pd);
	struct ehca_pd *my_pd = container_of(mr->pd, struct ehca_pd, ib_pd);
	u32 cur_pid = current->tgid;
	u32 cur_pid = current->tgid;
	unsigned long sl_flags;
	unsigned long sl_flags;
	struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
	struct ehca_mr_hipzout_parms hipzout;


	if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
	if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
	    (my_pd->ownpid != cur_pid)) {
	    (my_pd->ownpid != cur_pid)) {
@@ -629,7 +631,7 @@ struct ib_mw *ehca_alloc_mw(struct ib_pd *pd)
	struct ehca_pd *e_pd = container_of(pd, struct ehca_pd, ib_pd);
	struct ehca_pd *e_pd = container_of(pd, struct ehca_pd, ib_pd);
	struct ehca_shca *shca =
	struct ehca_shca *shca =
		container_of(pd->device, struct ehca_shca, ib_device);
		container_of(pd->device, struct ehca_shca, ib_device);
	struct ehca_mw_hipzout_parms hipzout = {{0},0};
	struct ehca_mw_hipzout_parms hipzout;


	e_mw = ehca_mw_new();
	e_mw = ehca_mw_new();
	if (!e_mw) {
	if (!e_mw) {
@@ -841,8 +843,7 @@ int ehca_map_phys_fmr(struct ib_fmr *fmr,
map_phys_fmr_exit0:
map_phys_fmr_exit0:
	if (ret)
	if (ret)
		ehca_err(fmr->device, "ret=%x fmr=%p page_list=%p list_len=%x "
		ehca_err(fmr->device, "ret=%x fmr=%p page_list=%p list_len=%x "
			 "iova=%lx",
			 "iova=%lx", ret, fmr, page_list, list_len, iova);
			 ret, fmr, page_list, list_len, iova);
	return ret;
	return ret;
} /* end ehca_map_phys_fmr() */
} /* end ehca_map_phys_fmr() */


@@ -960,7 +961,7 @@ int ehca_reg_mr(struct ehca_shca *shca,
	int ret;
	int ret;
	u64 h_ret;
	u64 h_ret;
	u32 hipz_acl;
	u32 hipz_acl;
	struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
	struct ehca_mr_hipzout_parms hipzout;


	ehca_mrmw_map_acl(acl, &hipz_acl);
	ehca_mrmw_map_acl(acl, &hipz_acl);
	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
@@ -1127,7 +1128,7 @@ inline int ehca_rereg_mr_rereg1(struct ehca_shca *shca,
	u64 *kpage;
	u64 *kpage;
	u64 rpage;
	u64 rpage;
	struct ehca_mr_pginfo pginfo_save;
	struct ehca_mr_pginfo pginfo_save;
	struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
	struct ehca_mr_hipzout_parms hipzout;


	ehca_mrmw_map_acl(acl, &hipz_acl);
	ehca_mrmw_map_acl(acl, &hipz_acl);
	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
@@ -1305,7 +1306,7 @@ int ehca_unmap_one_fmr(struct ehca_shca *shca,
	struct ehca_mr save_fmr;
	struct ehca_mr save_fmr;
	u32 tmp_lkey, tmp_rkey;
	u32 tmp_lkey, tmp_rkey;
	struct ehca_mr_pginfo pginfo;
	struct ehca_mr_pginfo pginfo;
	struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
	struct ehca_mr_hipzout_parms hipzout;
	struct ehca_mr save_mr;
	struct ehca_mr save_mr;


	if (e_fmr->fmr_max_pages <= MAX_RPAGES) {
	if (e_fmr->fmr_max_pages <= MAX_RPAGES) {
@@ -1397,7 +1398,7 @@ int ehca_reg_smr(struct ehca_shca *shca,
	int ret = 0;
	int ret = 0;
	u64 h_ret;
	u64 h_ret;
	u32 hipz_acl;
	u32 hipz_acl;
	struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
	struct ehca_mr_hipzout_parms hipzout;


	ehca_mrmw_map_acl(acl, &hipz_acl);
	ehca_mrmw_map_acl(acl, &hipz_acl);
	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
@@ -1519,7 +1520,7 @@ int ehca_reg_maxmr(struct ehca_shca *shca,
	u64 h_ret;
	u64 h_ret;
	struct ehca_mr *e_origmr = shca->maxmr;
	struct ehca_mr *e_origmr = shca->maxmr;
	u32 hipz_acl;
	u32 hipz_acl;
	struct ehca_mr_hipzout_parms hipzout = {{0},0,0,0,0,0};
	struct ehca_mr_hipzout_parms hipzout;


	ehca_mrmw_map_acl(acl, &hipz_acl);
	ehca_mrmw_map_acl(acl, &hipz_acl);
	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
Loading