All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tabi Timur-B04825 <B04825@freescale.com>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Tabi Timur-B04825 <B04825@freescale.com>,
	Fleming Andy-AFLEMING <afleming@freescale.com>,
	David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH] net/fsl: introduce Freescale 10G MDIO driver
Date: Sun, 19 Aug 2012 21:26:49 +0000	[thread overview]
Message-ID: <50315A18.2040105@freescale.com> (raw)
In-Reply-To: <20120819205724.GA27555@electric-eye.fr.zoreil.com>

Francois Romieu wrote:
>> >+	/* Wait till the bus is free */
>> >+	status = spin_event_timeout(
>> >+		!((in_be32(&regs->mdio_stat)) & MDIO_STAT_BSY), TIMEOUT, 0);
>> >+	if (!status) {
>> >+		dev_dbg(&bus->dev, "%s: timeout waiting for stat\n", __func__);
>> >+		return -ETIMEDOUT;
>> >+	}
> This code - comment included - is repeated several times. You may
> consider factoring it out in some xgmac_mdio_free_bus_wait function.

But it's just one line and a test.  The function would look like this:

bool xgmac_mdio_free_bus_wait(struct tgec_mdio_controller __iomem *regs)
{
	uint32_t status;

	status = spin_event_timeout(
		!((in_be32(&regs->mdio_stat)) & MDIO_STAT_BSY), TIMEOUT, 0);

	return status != 0;
}

and then

	if (!xgmac_mdio_free_bus_wait(regs)) {
		dev_dbg(&bus->dev, "%s: timeout waiting for stat\n", __func__);
		return -ETIMEDOUT;
	}

I don't see any real savings here.

-- 
Timur Tabi
Linux kernel developer at Freescale

  reply	other threads:[~2012-08-19 21:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17 20:03 [PATCH] net/fsl: introduce Freescale 10G MDIO driver Timur Tabi
2012-08-19 20:57 ` Francois Romieu
2012-08-19 21:26   ` Tabi Timur-B04825 [this message]
2012-08-19 22:48     ` Francois Romieu
2012-08-20  0:59       ` Tabi Timur-B04825

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=50315A18.2040105@freescale.com \
    --to=b04825@freescale.com \
    --cc=afleming@freescale.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.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 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.