From: Jakob Koschel <jakobkoschel@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <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:47:30 +0100 [thread overview]
Message-ID: <0FE857A7-F8B7-453C-BB81-AA012D45E578@gmail.com> (raw)
In-Reply-To: <YiXVD8O3qyDEOGni@smile.fi.intel.com>
> On 7. Mar 2022, at 10:49, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> 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))
>
> ?
Yes you are right.
I've just tested this again and seems like my local setup was skewed.
My assumption (from some coccinelle output) was that leaving the TRUE case
empty will not do any assignment at all but that's obviously wrong and I
can't reproduce it.
Basically feel free to ignore this PATCH since it just seems to be a NO-OP.
>
> Then what the difference is made by not using parentheses?
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Jakob
prev parent reply other threads:[~2022-03-07 11:21 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
2022-03-07 10:47 ` Jakob Koschel [this message]
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=0FE857A7-F8B7-453C-BB81-AA012D45E578@gmail.com \
--to=jakobkoschel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bjohannesmeyer@gmail.com \
--cc=c.giuffrida@vu.nl \
--cc=greg@kroah.com \
--cc=h.j.bos@vu.nl \
--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®