Re: confusing code....whats the point of this construct ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Mar 2015, Valdis.Kletnieks@xxxxxx 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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux