linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: linuxppc-dev@ozlabs.org, smaclennan@pikatech.com
Subject: Re: [PATCH 2/2] qe: add polling timeout to qe_issue_cmd()
Date: Tue, 19 May 2009 16:09:03 -0500	[thread overview]
Message-ID: <4A131FEF.3080405@freescale.com> (raw)
In-Reply-To: <fa686aa40905191310h3ed0efdfn4bd4b4f4b9ca0b7d@mail.gmail.com>

Grant Likely wrote:

> Hmmm, the ret value is backwards from what most coders would expect
> (zero on success, non-zero on failure).  I'd personally recommend
> reversing the polarity in the macro.

The ret value is documented as being the value of the expression when the loop terminates.  The reason it appears backwards is because the expression is

	(in_be32(&qe_immr->cp.cecr) & QE_CR_FLG) == 0

That is, the loop should spin until the QE_CR_FLG is zero.  So when the loop terminates normally, the expression (x) == 0 is true, which is equal to one.

I would expect that in most cases, the loop spins until some bit is *set*.  Let's pretend that QE_CR_FLG operates this way.  In that case, the call would look like this:

spin_event_timeout(in_be32(&qe_immr->cp.cecr) & QE_CR_FLG, 100, 0, ret);

At loop termination, the result of the expression will be either QE_CR_FLG or zero.

> Otherwise, feel free to add my acked-by line to both patches.

Thanks.

Ben, would you please apply this to your 'next' branch?

-- 
Timur Tabi
Linux kernel developer at Freescale

  reply	other threads:[~2009-05-19 21:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19 19:26 [PATCH 0/2] introduce macro spin_event_timeout() Timur Tabi
2009-05-19 19:26 ` [PATCH 1/2 v8] powerpc: " Timur Tabi
2009-05-19 19:26   ` [PATCH 2/2] qe: add polling timeout to qe_issue_cmd() Timur Tabi
2009-05-19 20:10     ` Grant Likely
2009-05-19 21:09       ` Timur Tabi [this message]
2009-05-25 17:46   ` [PATCH 1/2 v8] powerpc: introduce macro spin_event_timeout() Jon Smirl
2009-05-26  3:27     ` Timur Tabi
2009-05-26 16:20       ` Geoff Thorpe
2009-05-26 16:27         ` Jon Smirl
2009-05-26 17:03         ` Timur Tabi
2009-05-26 17:56           ` Jon Smirl
2009-05-26 18:01             ` Timur Tabi
2009-05-26 18:09           ` Geoff Thorpe
2009-05-26 18:17             ` Timur Tabi
2009-05-26 19:04               ` Jon Smirl

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=4A131FEF.3080405@freescale.com \
    --to=timur@freescale.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=smaclennan@pikatech.com \
    /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).