Re: [PATCH V5 for-next 3/6] RDMA/hns: Set access flags of hip08 RoCE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 03, 2018 at 10:44:05AM +0800, Lijun Ou wrote:
> +static void set_access_flags(struct hns_roce_qp *hr_qp,
> +			     struct hns_roce_v2_qp_context *context,
> +			     struct hns_roce_v2_qp_context *qpc_mask,
> +			     const struct ib_qp_attr *attr, int attr_mask)
> +{
> +	u8 dest_rd_atomic;
> +	u32 access_flags;
> +
> +	dest_rd_atomic = !!(attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) ?
> +			 attr->max_dest_rd_atomic : hr_qp->resp_depth;
> +
> +	access_flags = !!(attr_mask & IB_QP_ACCESS_FLAGS) ?
> +		       attr->qp_access_flags : hr_qp->atomic_rd_en;

These !! are un-needed when used in a boolean context like ?:

> +	if (!dest_rd_atomic)
> +		access_flags &= IB_ACCESS_REMOTE_WRITE;
> +
> +	roce_set_bit(context->byte_76_srqn_op_en, V2_QPC_BYTE_76_RRE_S,
> +		     !!(access_flags & IB_ACCESS_REMOTE_READ));
> +	roce_set_bit(qpc_mask->byte_76_srqn_op_en, V2_QPC_BYTE_76_RRE_S, 0);
> +
> +	roce_set_bit(context->byte_76_srqn_op_en, V2_QPC_BYTE_76_RWE_S,
> +		     !!(access_flags & IB_ACCESS_REMOTE_WRITE));
> +	roce_set_bit(qpc_mask->byte_76_srqn_op_en, V2_QPC_BYTE_76_RWE_S, 0);
> +
> +	roce_set_bit(context->byte_76_srqn_op_en, V2_QPC_BYTE_76_ATE_S,
> +		     !!(access_flags & IB_ACCESS_REMOTE_ATOMIC));

And having something called 'set_bit' that does not accept a bool is
just asking for bugs. You should fix the macro to do the !! and remove
it from all the callers.

I took this as is, you can send a cleanup someday.

Jason

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux