mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jakob Koschel <jakobkoschel@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <greg@kroah.com>,
	Mike Rapoport <rppt@kernel.org>,
	Brian Johannesmeyer <bjohannesmeyer@gmail.com>,
	Cristiano Giuffrida <c.giuffrida@vu.nl>,
	"Bos, H.J." <h.j.bos@vu.nl>
Subject: Re: [PATCH] list: always set pos in list_prepare_entry()
Date: Mon, 7 Mar 2022 11:49:03 +0200	[thread overview]
Message-ID: <YiXVD8O3qyDEOGni@smile.fi.intel.com> (raw)
In-Reply-To: <20220306162635.2930407-1-jakobkoschel@gmail.com>

On Sun, Mar 06, 2022 at 05:26:35PM +0100, Jakob Koschel wrote:
> In order to assign the result from list_prepare_entry() to another
> variable, it should also be set when pos != NULL.
> 
> This will be useful once the list iterator is no longer used after
> the loop.

...

>  #define list_prepare_entry(pos, head, member) \
> -	((pos) ? : list_entry(head, typeof(*pos), member))
> +	((pos) ? pos : list_entry(head, typeof(*pos), member))

I'm not sure why then we have () surrounding first pos.

Am I right that the original is an equivalent to

	((pos) ? (pos) : list_entry(head, typeof(*pos), member))

?

Then what the difference is made by not using parentheses?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-03-07 10:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-06 16:26 Jakob Koschel
2022-03-07  9:49 ` Andy Shevchenko [this message]
2022-03-07 10:47   ` Jakob Koschel

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=YiXVD8O3qyDEOGni@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bjohannesmeyer@gmail.com \
    --cc=c.giuffrida@vu.nl \
    --cc=greg@kroah.com \
    --cc=h.j.bos@vu.nl \
    --cc=jakobkoschel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®