Thread (5 messages) flat view 5 messages, 3 authors, 2012-08-20

Re: [PATCH] net/fsl: introduce Freescale 10G MDIO driver

From: Tabi Timur-B04825 <hidden>
Date: 2012-08-19 21:26:54

Francois Romieu wrote:
quoted
quoted
+	/* 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help