Re: [PATCH for-next 2/5] RDMA/rtrs-clt: fix CHECK type warnings

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

 



On Fri, Jan 14, 2022 at 04:47:50PM +0100, Md Haris Iqbal wrote:

> -/**
> - * list_next_or_null_rr_rcu - get next list element in round-robin fashion.
> - * @head:	the head for the list.
> - * @ptr:        the list head to take the next element from.
> - * @type:       the type of the struct this is embedded in.
> - * @memb:       the name of the list_head within the struct.
> - *
> - * Next element returned in round-robin fashion, i.e. head will be skipped,
> - * but if list is observed as empty, NULL will be returned.
> - *
> - * This primitive may safely run concurrently with the _rcu list-mutation
> - * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
> - */
> -#define list_next_or_null_rr_rcu(head, ptr, type, memb) \
> -({ \
> -	list_next_or_null_rcu(head, ptr, type, memb) ?: \
> -		list_next_or_null_rcu(head, READ_ONCE((ptr)->next), \
> -				      type, memb); \
> -})

Why not put this in a static inline instead of open coding it? Type is
always the same for both usages, right?

Jason



[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