Re: [PATCH -next] RDMA/hfi1: Use list_for_each_entry() helper

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

 




On 2023/8/21 23:51, Dennis Dalessandro wrote:
> On 8/21/23 9:37 AM, Jinjie Ruan wrote:
>> Convert list_for_each() to list_for_each_entry() where applicable.
>>
>> No functional changed.
>>
>> Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
>> ---
>>  drivers/infiniband/hw/hfi1/affinity.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
>> index 77ee77d4000f..bbc957c578e1 100644
>> --- a/drivers/infiniband/hw/hfi1/affinity.c
>> +++ b/drivers/infiniband/hw/hfi1/affinity.c
>> @@ -230,11 +230,9 @@ static void node_affinity_add_tail(struct hfi1_affinity_node *entry)
>>  /* It must be called with node_affinity.lock held */
>>  static struct hfi1_affinity_node *node_affinity_lookup(int node)
>>  {
>> -	struct list_head *pos;
>>  	struct hfi1_affinity_node *entry;
>>  
>> -	list_for_each(pos, &node_affinity.list) {
>> -		entry = list_entry(pos, struct hfi1_affinity_node, list);
>> +	list_for_each_entry(entry, &node_affinity.list, list) {
>>  		if (entry->node == node)
>>  			return entry;
>>  	}
> 
> Why is this version better? Perhaps amend commit message to indicate why you are
> fixing this.

We can remove the pos var line. OK. Thank you! I'll update the message
to indicate it.

> 
> -Denny



[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