lkml.org 
[lkml]   [2022]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next 3/7] rxrpc: Fix locking issue
On Fri, 20 May 2022 17:46:13 +0100 David Howells wrote:
> +struct list_head *seq_list_start_rcu(struct list_head *head, loff_t pos)
> +{
> + struct list_head *lh;
> +
> + list_for_each_rcu(lh, head)
> + if (pos-- == 0)
> + return lh;
> +
> + return NULL;
> +}
> +EXPORT_SYMBOL(seq_list_start_rcu);
> +
> +struct list_head *seq_list_start_head_rcu(struct list_head *head, loff_t pos)
> +{
> + if (!pos)
> + return head;
> +
> + return seq_list_start_rcu(head, pos - 1);
> +}
> +EXPORT_SYMBOL(seq_list_start_head_rcu);
> +
> +struct list_head *seq_list_next_rcu(void *v, struct list_head *head,
> + loff_t *ppos)
> +{
> + struct list_head *lh;
> +
> + lh = rcu_dereference(((struct list_head *)v)->next);

Can we use list_next_rcu() here maybe ? to avoid the sparse warning?

> + ++*ppos;
> + return lh == head ? NULL : lh;
> +}
> +EXPORT_SYMBOL(seq_list_next_rcu);

\
 
 \ /
  Last update: 2022-05-21 03:11    [W:0.101 / U:0.996 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site