Re: [PATCH for-next 2/7] RDMA/hns: Refactor hns_roce_v2_set_hem()

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

 



On Mon, Jul 27, 2020 at 04:10:44PM +0800, Weihang Li wrote:
> The parts about preparing and sending mailbox to hardware is not strongly
> related to other codes in hns_roce_v2_set_hem(), and can be encapsulated
> into a separate function.
>
> Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx>
> ---
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 45 +++++++++++++++++-------------
>  1 file changed, 26 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> index 35d46b7..0eab92a 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> @@ -3373,11 +3373,33 @@ static int get_op_for_set_hem(struct hns_roce_dev *hr_dev, u32 type,
>  	return op + step_idx;
>  }
>
> +static int set_hem_to_hw(struct hns_roce_dev *hr_dev, int obj, u64 bt_ba,
> +			 u32 hem_type, int step_idx)
> +{
> +	struct hns_roce_cmd_mailbox *mailbox;
> +	int ret;
> +	int op;
> +
> +	op = get_op_for_set_hem(hr_dev, hem_type, step_idx);
> +	if (op == -EINVAL)
> +		return 0;

It is not how we write error checks "if (op < 0) return 0;"

Thanks



[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