[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50315A18.2040105@freescale.com>
Date: Sun, 19 Aug 2012 21:26:49 +0000
From: Tabi Timur-B04825 <B04825@...escale.com>
To: Francois Romieu <romieu@...zoreil.com>
CC: Tabi Timur-B04825 <B04825@...escale.com>,
Fleming Andy-AFLEMING <afleming@...escale.com>,
David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] net/fsl: introduce Freescale 10G MDIO driver
Francois Romieu wrote:
>> >+ /* Wait till the bus is free */
>> >+ status = spin_event_timeout(
>> >+ !((in_be32(®s->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(®s->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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists