From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936739AbdIZHBy (ORCPT ); Tue, 26 Sep 2017 03:01:54 -0400 Received: from mga07.intel.com ([134.134.136.100]:13794 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934038AbdIZHBw (ORCPT ); Tue, 26 Sep 2017 03:01:52 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,440,1500966000"; d="scan'208";a="1223764654" From: "Huang\, Ying" To: Byungchul Park Cc: , , , , Subject: Re: [PATCH] llist: Put parentheses around parameters of llist_for_each_entry_safe() References: <1506408891-27460-1-git-send-email-byungchul.park@lge.com> Date: Tue, 26 Sep 2017 15:01:49 +0800 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") Message-ID: <8760c6c59e.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Byungchul, Byungchul Park writes: > It would be somewhat safer to put parentheses around parameters of > a macro with parameters. Put it. > > Signed-off-by: Byungchul Park > --- > 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