All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Ayaz Abdulla <aabdulla@nvidia.com>
Cc: jgarzik@pobox.com, manfred@colorfullife.com,
	netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH 1/5] forcedeth: mgmt unit interface
Date: Fri, 30 Jan 2009 14:35:41 -0800	[thread overview]
Message-ID: <20090130143541.4b85f22a.akpm@linux-foundation.org> (raw)
In-Reply-To: <49834D5A.9000005@nvidia.com>

On Fri, 30 Jan 2009 13:56:26 -0500
Ayaz Abdulla <aabdulla@nvidia.com> wrote:

> +static int nv_mgmt_get_version(struct net_device *dev)
> +{
> +	struct fe_priv *np = netdev_priv(dev);
> +	u8 __iomem *base = get_hwbase(dev);
> +	u32 data_ready = readl(base + NvRegTransmitterControl);
> +	u32 data_ready2;
> +	int i;
> +
> +	writel(NVREG_MGMTUNITGETVERSION, base + NvRegMgmtUnitGetVersion);
> +	writel(data_ready ^ NVREG_XMITCTL_DATA_START, base + NvRegTransmitterControl);
> +	for (i = 0; i < 100000; i++) {
> +		data_ready2 = readl(base + NvRegTransmitterControl);
> +		if ((data_ready & NVREG_XMITCTL_DATA_READY) != (data_ready2 & NVREG_XMITCTL_DATA_READY))
> +			break;
> +		udelay(50);
> +	}
> +
> +	if (i == 100000 || (data_ready2 & NVREG_XMITCTL_DATA_ERROR))
> +		return 0;
> +
> +	np->mgmt_version = readl(base + NvRegMgmtUnitVersion) & NVREG_MGMTUNITVERSION;
> +
> +	return 1;
> +}

A five second busy-wait still sucks :(

Why not do

	start = jiffies;
	while (time_before(jiffies, start + 5*HZ)) {
		...
		schedule_timeout_uninterruptible(1);
	}

?

  reply	other threads:[~2009-01-30 22:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30 18:56 [PATCH 1/5] forcedeth: mgmt unit interface Ayaz Abdulla
2009-01-30 22:35 ` Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-02-06 19:27 Ayaz Abdulla
2009-02-07  8:25 ` David Miller

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=20090130143541.4b85f22a.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aabdulla@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=jgarzik@pobox.com \
    --cc=manfred@colorfullife.com \
    --cc=netdev@vger.kernel.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.