Re: [PATCH for-next 1/6] RDMA/hns: Simplify function's resource related command

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

 



On 2021/4/2 20:17, chenglang wrote:
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_common.h b/drivers/infiniband/hw/hns/hns_roce_common.h
>> index 23c438c..5b5fedf 100644
>> --- a/drivers/infiniband/hw/hns/hns_roce_common.h
>> +++ b/drivers/infiniband/hw/hns/hns_roce_common.h
>> @@ -87,6 +87,17 @@
>>   
>>   #define hr_reg_write(ptr, field, val) _hr_reg_write(ptr, field, val)
>>   
>> +#define _hr_reg_read(ptr, field_type, field_h, field_l)                        \
>> +	({                                                                     \
>> +		const field_type *_ptr = ptr;                                  \
>> +		BUILD_BUG_ON(((field_h) / 32) != ((field_l) / 32));            \
>> +		((le32_to_cpu(*((__le32 *)_ptr + (field_h) / 32)) &            \
>> +		  GENMASK((field_h) % 32, (field_l) % 32)) >>                  \
>> +		 ((field_l) % 32));                                            \
>> +	})
> I will try this:
> 
> #define _hr_reg_read(ptr, field_type, field_h, field_l) 
> 
> 	({
> 		const field_type *_ptr = ptr;
> 		FIELD_GET(GENMASK((field_h) % 32, (field_l) % 32),
> 			  le32_to_cpu(*((__le32 *)_ptr +(field_h)/32)))
> 		+ BUILD_BUG_ON_ZERO(((field_h) / 32) != ((field_l) / 32));
> 	})
> 
> 
> Thanks.
> 

OK, I will send v2 instead.

Thanks
Weihang



[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