Re: [PATCH v6 1/3] lib/plist: Provide plist_add_head() for nodes with the same prio

From: Steven Rostedt
Date: Mon Apr 20 2015 - 10:48:30 EST


On Mon, 20 Apr 2015 16:22:46 +0800
Xunlei Pang <xlpang@xxxxxxx> wrote:

> +/**
> + * plist_add_tail - add @node to @head, after all existing same-prio nodes
> + *
> + * @node: The plist_node to be added to @head
> + * @head: The plist_head that @node is being added to
> + */
> +static inline
> +void plist_add_tail(struct plist_node *node, struct plist_head *head)
> +{
> + __plist_add(node, head, false);
> +}
> +
> +#define plist_add plist_add_tail

I already placed my review by, but this is more of a matter of taste.

I don't think this should be a #define, but instead a static inline.
The assembly will end up as the same, but the compiler warnings will be
more helpful if it is a static inline, as we don't want
"plist_add_tail()" being shown in warnings when the developer never
typed in "_tail()".

Thus it should be:

static inline void
plist_add(struct plist_node *node, struct plist_head *head)
{
plist_add_tail(node, head);
}

You can keep my Reviewed-by, but please make this update.

-- Steve


> +
> extern void plist_del(struct plist_node *node, struct plist_head *head);
>
> extern void plist_requeue(struct plist_node *node, struct plist_head *head);
> diff --git a/lib/plist.c b/lib/plist.c
> index 3a30c53..c1ee2b0 100644
> --- a/lib/plist.c
> +++ b/lib/plist.c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/