netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: timur@freescale.com
Cc: afleming@freescale.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net/fsl_pq_mdio: use spin_event_timeout() to poll the indicator register
Date: Sun, 08 Jul 2012 23:59:26 -0700 (PDT)	[thread overview]
Message-ID: <20120708.235926.1117975937932919247.davem@davemloft.net> (raw)
In-Reply-To: <1341357381-10861-1-git-send-email-timur@freescale.com>

From: Timur Tabi <timur@freescale.com>
Date: Tue, 3 Jul 2012 18:16:21 -0500

> Macro spin_event_timeout() was designed for simple polling of hardware
> registers with a timeout, so use it when we poll the MIIMIND register.
> This allows us to return an error code instead of polling indefinitely.
> 
> Note that PHY_INIT_TIMEOUT is a count of loop iterations, so we can't use
> it for spin_event_timeout(), which asks for microseconds.
> 
> Signed-off-by: Timur Tabi <timur@freescale.com>

Define a macro for the timeout value rather than use an arbitrary
constant.

> +	status = spin_event_timeout(!(in_be32(&regs->miimind) &	MIIMIND_BUSY),
> +		1000, 0);

This indentation is absolutely terrible.

> +	status = spin_event_timeout(!(in_be32(&regs->miimind) &
> +		(MIIMIND_NOTVALID | MIIMIND_BUSY)), 1000, 0);

Same here.

> +	status = spin_event_timeout(!(in_be32(&regs->miimind) &	MIIMIND_BUSY),
> +		1000, 0);

And here too.

  reply	other threads:[~2012-07-09  6:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03 23:16 [PATCH] net/fsl_pq_mdio: use spin_event_timeout() to poll the indicator register Timur Tabi
2012-07-09  6:59 ` David Miller [this message]
2012-07-09 14:31   ` Tabi Timur-B04825
2012-07-09 19:50     ` Jan Ceuleers
2012-07-09 21:17     ` David Miller
2012-07-09 21:19       ` Timur Tabi

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=20120708.235926.1117975937932919247.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=afleming@freescale.com \
    --cc=netdev@vger.kernel.org \
    --cc=timur@freescale.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).