All of lore.kernel.org
 help / color / mirror / Atom feed
From: der.herr@hofr.at (Nicholas Mc Guire)
To: kernelnewbies@lists.kernelnewbies.org
Subject: confusing code....whats the point of this construct ?
Date: Wed, 11 Mar 2015 15:50:34 +0100	[thread overview]
Message-ID: <20150311145034.GA20387@opentech.at> (raw)
In-Reply-To: <55475.1426084817@turing-police.cc.vt.edu>

On Wed, 11 Mar 2015, Valdis.Kletnieks at vt.edu wrote:

> On Wed, 11 Mar 2015 15:17:44 +0100, Nicholas Mc Guire said:
> 
> > So the wait_event_timeout condition here ends up being (empty || skip)
> > but what is the point of puting this code into the parameter list of
> > wait_event_timeout() ?
> >
> > Would it not be equivalent to:
> >
> > 	bool empty;
> > 	...
> >
> > 	spin_lock_bh(&ar->htt.tx_lock);
> > 	empty = (ar->htt.num_pending_tx == 0);
> > 	spin_unlock_bh(&ar->htt.tx_lock);
> >
> > 	skip = (ar->state == ATH10K_STATE_WEDGED) ||
> > 		test_bit(ATH10K_FLAG_CRASH_FLUSH,
> > 		&ar->dev_flags);
> >
> > 	ret = wait_event_timeout(ar->htt.empty_tx_wq, (empty || skip),
> > 				 ATH10K_FLUSH_TIMEOUT_HZ);
> >
> > What am I missing here ?
> 
> Umm... a Signed-off-by: and formatting it as an actual patch? :)
> 
> Seriously - you're right, it's ugly code that needs fixing...

thats what I thought too but it seemed to be intentional
so I was just confused if it were some strange side-effect
that I had not understood.

thanks for the clarification !
hofrat

  reply	other threads:[~2015-03-11 14:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11 14:17 confusing code....whats the point of this construct ? Nicholas Mc Guire
2015-03-11 14:40 ` Valdis.Kletnieks at vt.edu
2015-03-11 14:50   ` Nicholas Mc Guire [this message]
2015-03-11 15:09   ` Bjørn Mork
2015-03-11 16:46     ` Nicholas Mc Guire
2015-03-11 17:00       ` Valdis.Kletnieks at vt.edu
2015-03-11 18:37         ` Jeff Haran
2015-03-11 18:47           ` Nicholas Krause
2015-03-11 18:53           ` Nicholas Mc Guire
2015-03-11 18:57           ` Valdis.Kletnieks at vt.edu
2015-03-11 19:16             ` Jeff Haran
2015-03-11 19:41             ` Bjørn Mork
2015-03-11 15:09   ` Malte Vesper

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=20150311145034.GA20387@opentech.at \
    --to=der.herr@hofr.at \
    --cc=kernelnewbies@lists.kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.