From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-next@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>
Subject: Re: mmotm 2013-06-27-16-36 uploaded (wait event common)
Date: Fri, 28 Jun 2013 16:56:41 +1000 [thread overview]
Message-ID: <20130628165641.2193bfcd78c1f27d6f68f9a5@canb.auug.org.au> (raw)
In-Reply-To: <51CD27F3.30104@infradead.org>
[-- Attachment #1: Type: text/plain, Size: 3591 bytes --]
Hi Guys,
On Thu, 27 Jun 2013 23:06:43 -0700 Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 06/27/13 22:51, Andrew Morton wrote:
> > On Thu, 27 Jun 2013 22:30:41 -0700 Randy Dunlap <rdunlap@infradead.org> wrote:
> >
> >> On 06/27/13 16:37, akpm@linux-foundation.org wrote:
> >>> The mm-of-the-moment snapshot 2013-06-27-16-36 has been uploaded to
> >>>
> >>> http://www.ozlabs.org/~akpm/mmotm/
> >>>
> >>> mmotm-readme.txt says
> >>>
> >>> README for mm-of-the-moment:
> >>>
> >>> http://www.ozlabs.org/~akpm/mmotm/
> >>>
> >>
> >> My builds are littered with hundreds of warnings like this one:
> >>
> >> drivers/tty/tty_ioctl.c:220:6: warning: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Wparentheses]
> >>
> >> I guess due to this line from wait_event_common():
> >>
> >> + __ret = __wait_no_timeout(tout) ?: (tout) ?: 1;
> >>
> >
> > Ah, sorry, I missed that. Had I noticed it, I would have spat it back
> > on taste grounds alone, it being unfit for human consumption.
> >
> > Something like this?
> >
> > --- a/include/linux/wait.h~wait-introduce-wait_event_commonwq-condition-state-timeout-fix
> > +++ a/include/linux/wait.h
> > @@ -196,7 +196,11 @@ wait_queue_head_t *bit_waitqueue(void *,
> > for (;;) { \
> > prepare_to_wait(&wq, &__wait, state); \
> > if (condition) { \
> > - __ret = __wait_no_timeout(tout) ?: __tout ?: 1; \
> > + __ret = __wait_no_timeout(tout); \
> > + if (!__ret) \
> > + __ret = __tout; \
> > + if (!__ret) \
> > + __ret = 1; \
> > break; \
> > } \
> > \
> >
> >
>
> That does reduce the number of warnings, but the wait_event_common() macro
> needs similar treatment. I.e., I am still getting those warnings, just not
> quite as many. (down from 2 per source code line to 1 per source code line
> which contains some kind of wait...)
I added the following to linux-next today:
(sorry Randy, I forgot the Reported-by:, Andrew please add)
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 28 Jun 2013 16:52:58 +1000
Subject: [PATCH] fix warnings from ?: operator in wait.h
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
include/linux/wait.h | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 1c08a6c..f3b793d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -197,7 +197,12 @@ wait_queue_head_t *bit_waitqueue(void *, int);
for (;;) { \
__ret = prepare_to_wait_event(&wq, &__wait, state); \
if (condition) { \
- __ret = __wait_no_timeout(tout) ?: __tout ?: 1; \
+ __ret = __wait_no_timeout(tout); \
+ if (!__ret) { \
+ __ret = __tout; \
+ if (!__ret) \
+ __ret = 1; \
+ } \
break; \
} \
\
@@ -218,9 +223,14 @@ wait_queue_head_t *bit_waitqueue(void *, int);
#define wait_event_common(wq, condition, state, tout) \
({ \
long __ret; \
- if (condition) \
- __ret = __wait_no_timeout(tout) ?: (tout) ?: 1; \
- else \
+ if (condition) { \
+ __ret = __wait_no_timeout(tout); \
+ if (!__ret) { \
+ __ret = (tout); \
+ if (!__ret) \
+ __ret = 1; \
+ } \
+ } else \
__ret = __wait_event_common(wq, condition, state, tout);\
__ret; \
})
--
1.8.3.1
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-06-28 6:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-27 23:37 mmotm 2013-06-27-16-36 uploaded akpm
2013-06-27 23:57 ` Stephen Rothwell
2013-06-28 0:32 ` Andrew Morton
2013-06-28 1:09 ` Stephen Rothwell
2013-06-28 5:30 ` mmotm 2013-06-27-16-36 uploaded (wait event common) Randy Dunlap
2013-06-28 5:51 ` Andrew Morton
2013-06-28 6:06 ` Randy Dunlap
2013-06-28 6:56 ` Stephen Rothwell [this message]
2013-06-28 15:38 ` Oleg Nesterov
2013-06-28 17:15 ` Oleg Nesterov
2013-06-29 14:00 ` Valdis.Kletnieks
2013-06-30 18:28 ` Oleg Nesterov
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=20130628165641.2193bfcd78c1f27d6f68f9a5@canb.auug.org.au \
--to=sfr@canb.auug.org.au \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=rdunlap@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;
as well as URLs for NNTP newsgroup(s).