Unrelated code cleanups
Subsystems (2)
cover Unrelated code cleanups
From: Leon Romanovsky <[email protected]>
Hi,
Various code cleanups.
Thanks
Erez Alfasi (2):
IB/mlx5: Remove unnecessary return statement
IB/mlx5: Remove unnecessary else statement
Leon Romanovsky (1):
RDMA/mlx5: Group boolean parameters to take less space
Parav Pandit (1):
IB/cm: Use container_of() instead of typecast
drivers/infiniband/core/cm.c | 4 ++-- drivers/infiniband/hw/mlx5/main.c | 4 ++-- drivers/infiniband/hw/mlx5/mlx5_ib.h | 8 ++++---- drivers/infiniband/hw/mlx5/odp.c | 2 -- 4 files changed, 8 insertions(+), 10 deletions(-)
--
2.20.1
PATCH 1/4 RDMA/mlx5: Group boolean parameters to take less space
From: Leon Romanovsky <[email protected]>
Clean the code to store all boolean parameters inside one variable.
--- drivers/infiniband/hw/mlx5/mlx5_ib.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/mlx5_ib.h +4 -4
@@ -958,7 +958,10 @@ struct mlx5_ib_dev {/* serialize update of capability mask */ struct mutex cap_mask_mutex; -bool ib_active; + u8 ib_active:1; + u8 fill_delay:1; + u8 is_rep:1; + u8 lag_active:1;struct umr_common umrc;/* sync used page count stats */
@@ -967,7 +970,6 @@ struct mlx5_ib_dev {struct timer_list delay_timer;/* Prevents soft lock on massive reg MRs */ struct mutex slow_path_mutex; -int fill_delay;struct ib_odp_caps odp_caps;u64 odp_max_size;struct mlx5_ib_pf_eq odp_pf_eq;
@@ -988,8 +990,6 @@ struct mlx5_ib_dev {struct mlx5_sq_bfreg fp_bfreg;struct mlx5_ib_delay_drop delay_drop;const struct mlx5_ib_profile *profile; -bool is_rep; -int lag_active;struct mlx5_ib_lb_state lb;u8 umr_fence;
Signature · 1 line
2.20.1
PATCH 2/4 IB/mlx5: Remove unnecessary return statement
In reply to Leon RomanovskyFrom: Erez Alfasi <[email protected]>
There is no reason to call return at the end of function which returns void. Remove this unnecessary statement.
--- drivers/infiniband/hw/mlx5/odp.c | 2 -- 1 file changed, 2 deletions(-)
drivers/infiniband/hw/mlx5/odp.c +0 -2
@@ -359,8 +359,6 @@ void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)MLX5_CAP_GEN (dev->mdev, umr_extended_translation_offset) && !MLX5_CAP_GEN(dev->mdev, umr_indirect_mkey_disabled)) caps->general_caps |= IB_ODP_SUPPORT_IMPLICIT; - -return ; } static void mlx5_ib_page_fault_resume(struct mlx5_ib_dev *dev,
Signature · 1 line
2.20.1
PATCH 3/4 IB/mlx5: Remove unnecessary else statement
In reply to Leon RomanovskyFrom: Erez Alfasi <[email protected]>
'else' is not generally useful after a break or
return. Remove this unnecessary statement.
--- drivers/infiniband/hw/mlx5/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/main.c +2 -2
@@ -844,8 +844,8 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, resp_len =sizeof (resp.comp_mask) +sizeof (resp.response_length);if (uhw->outlen && uhw->outlen < resp_len)return -EINVAL ; -else - resp.response_length = resp_len; + + resp.response_length = resp_len;if (uhw->inlen && !ib_is_udata_cleared (uhw,0 , uhw->inlen))return -EINVAL ;
Signature · 1 line
2.20.1
PATCH 4/4 IB/cm: Use container_of() instead of typecast
In reply to Leon RomanovskyFrom: Parav Pandit <[email protected]>
Use container_of() macro to get to timewait info structure instead of typecasting.
--- drivers/infiniband/core/cm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/core/cm.c +2 -2
@@ -246,7 +246,7 @@ struct cm_work { };struct cm_timewait_info { -struct cm_work work;/* Must be first. */ +struct cm_work work;struct list_head list;struct rb_node remote_qp_node;struct rb_node remote_id_node;
@@ -3434,7 +3434,7 @@ static int cm_timewait_handler(struct cm_work *work)struct cm_id_private *cm_id_priv;int ret; - timewait_info = (struct cm_timewait_info *)work; + timewait_info = container_of(work, struct cm_timewait_info, work);spin_lock_irq (&cm.lock);list_del (&timewait_info->list);spin_unlock_irq (&cm.lock);
Signature · 1 line
2.20.1
Jason Gunthorpe
AppliedQuoted 12 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Hi,
Various code cleanups.
Thanks
Erez Alfasi (2):
IB/mlx5: Remove unnecessary return statement
IB/mlx5: Remove unnecessary else statement
Quoted 5 lines
Leon Romanovsky (1):
RDMA/mlx5: Group boolean parameters to take less spaceParav Pandit (1):
IB/cm: Usecontainer_of()instead of typecast
Applied to for-next, thanks
Jason