Re: [PATCH for-next 02/12] IB/hfi1: Convert the macro AHG_HEADER_SET into an inline function

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

 



On Tue, Sep 26, 2017 at 07:00:11AM -0700, Dennis Dalessandro wrote:
> From: Harish Chegondi <harish.chegondi@xxxxxxxxx>
>
> AHG_HEADER_SET macro doesn't conform to the coding standards as it can
> affect the control flow. Convert the macro AHG_HEADER_SET into an inline
> function ahg_header_set().
>
> Cc: Leon Romanovsky <leon@xxxxxxxxxx>
> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxx>
> Signed-off-by: Harish Chegondi <harish.chegondi@xxxxxxxxx>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx>
> ---
>  drivers/infiniband/hw/hfi1/user_sdma.c |   58 ++++++++++++++++++++++----------
>  drivers/infiniband/hw/hfi1/user_sdma.h |   29 +++++++++++-----
>  2 files changed, 59 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c
> index c0c0e04..4ea29ed 100644
> --- a/drivers/infiniband/hw/hfi1/user_sdma.c
> +++ b/drivers/infiniband/hw/hfi1/user_sdma.c
> @@ -1254,20 +1254,25 @@ static int set_txreq_header_ahg(struct user_sdma_request *req,
>  				struct user_sdma_txreq *tx, u32 datalen)
>  {
>  	u32 ahg[AHG_KDETH_ARRAY_SIZE];
> -	int diff = 0;
> +	int idx = 0;
>  	u8 omfactor; /* KDETH.OM */
>  	struct hfi1_user_sdma_pkt_q *pq = req->pq;
>  	struct hfi1_pkt_header *hdr = &req->hdr;
>  	u16 pbclen = le16_to_cpu(hdr->pbc[0]);
>  	u32 val32, tidval = 0, lrhlen = get_lrh_len(*hdr, pad_len(datalen));
> +	size_t array_size = ARRAY_SIZE(ahg);
>
>  	if (PBC2LRH(pbclen) != lrhlen) {
>  		/* PBC.PbcLengthDWs */
> -		AHG_HEADER_SET(ahg, diff, 0, 0, 12,
> -			       cpu_to_le16(LRH2PBC(lrhlen)));
> +		idx = ahg_header_set(ahg, idx, array_size, 0, 0, 12,
> +				     (__force u16)cpu_to_le16(LRH2PBC(lrhlen)));

This "__force" looks suspicious to me and I think you have an error here by
using cpu_to_le16 instead of cpu_to_be16.

Thanks

Attachment: signature.asc
Description: PGP signature


[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