public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Huang\, Ying" <ying.huang@intel.com>
To: Byungchul Park <byungchul.park@lge.com>
Cc: <peterz@infradead.org>, <mingo@kernel.org>,
	<linux-kernel@vger.kernel.org>, <kernel-team@lge.com>,
	<ying.huang@intel.com>
Subject: Re: [PATCH] llist: Put parentheses around parameters of llist_for_each_entry_safe()
Date: Tue, 26 Sep 2017 15:01:49 +0800	[thread overview]
Message-ID: <8760c6c59e.fsf@yhuang-dev.intel.com> (raw)
In-Reply-To: <1506408891-27460-1-git-send-email-byungchul.park@lge.com> (Byungchul Park's message of "Tue, 26 Sep 2017 15:54:51 +0900")

Hi, Byungchul,

Byungchul Park <byungchul.park@lge.com> writes:

> It would be somewhat safer to put parentheses around parameters of
> a macro with parameters. Put it.
>
> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  include/linux/llist.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/llist.h b/include/linux/llist.h
> index 1957635..e280b297 100644
> --- a/include/linux/llist.h
> +++ b/include/linux/llist.h
> @@ -183,10 +183,10 @@ static inline void init_llist_head(struct llist_head *list)
>   * reverse the order by yourself before traversing.
>   */
>  #define llist_for_each_entry_safe(pos, n, node, member)			       \
> -	for (pos = llist_entry((node), typeof(*pos), member);		       \
> +	for ((pos) = llist_entry((node), typeof(*(pos)), member);		       \
>  	     member_address_is_nonnull(pos, member) &&			       \
> -	        (n = llist_entry(pos->member.next, typeof(*n), member), true); \
> -	     pos = n)
> +	        ((n) = llist_entry((pos)->member.next, typeof(*(n)), member), true); \
> +	     (pos) = (n))
>  
>  /**
>   * llist_empty - tests whether a lock-less list is empty

The original code follows the style of list_for_each_entry_safe().  The
parameters "pos" and "n" must be variable.  Because list_xxx family
functions work well so far, I think we needn't to change it too.

Best Regards,
Huang, Ying

  reply	other threads:[~2017-09-26  7:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26  6:54 [PATCH] llist: Put parentheses around parameters of llist_for_each_entry_safe() Byungchul Park
2017-09-26  7:01 ` Huang, Ying [this message]
2017-09-26  8:01   ` 박병철/선임연구원/SW Platform(연)AOT팀(byungchul.park@lge.com)
2017-09-26  8:14     ` Huang, Ying
2017-09-26  8:36       ` 박병철/선임연구원/SW Platform(연)AOT팀(byungchul.park@lge.com)
2017-11-17  2:31 ` Byungchul Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760c6c59e.fsf@yhuang-dev.intel.com \
    --to=ying.huang@intel.com \
    --cc=byungchul.park@lge.com \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox