net/fsl: Replace spin_event_timeout() with arch independent in xgmac_mdio
authorShaohui Xie <Shaohui.Xie@freescale.com>
Wed, 21 Jan 2015 11:08:32 +0000 (19:08 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Jan 2015 07:36:06 +0000 (23:36 -0800)
spin_event_timeout() is PPC dependent, use an arch independent
equivalent instead.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/xgmac_mdio.c

index ab9a6bfcae777e0e16345ec47fd89eda09306fec..3a83bc2c613ce0e907831a264070970acfd8eccf 100644 (file)
@@ -52,12 +52,16 @@ struct tgec_mdio_controller {
 static int xgmac_wait_until_free(struct device *dev,
                                 struct tgec_mdio_controller __iomem *regs)
 {
-       uint32_t status;
+       unsigned int timeout;
 
        /* Wait till the bus is free */
-       status = spin_event_timeout(
-               !((ioread32be(&regs->mdio_stat)) & MDIO_STAT_BSY), TIMEOUT, 0);
-       if (!status) {
+       timeout = TIMEOUT;
+       while ((ioread32be(&regs->mdio_stat) & MDIO_STAT_BSY) && timeout) {
+               cpu_relax();
+               timeout--;
+       }
+
+       if (!timeout) {
                dev_err(dev, "timeout waiting for bus to be free\n");
                return -ETIMEDOUT;
        }
@@ -71,12 +75,16 @@ static int xgmac_wait_until_free(struct device *dev,
 static int xgmac_wait_until_done(struct device *dev,
                                 struct tgec_mdio_controller __iomem *regs)
 {
-       uint32_t status;
+       unsigned int timeout;
 
        /* Wait till the MDIO write is complete */
-       status = spin_event_timeout(
-               !((ioread32be(&regs->mdio_data)) & MDIO_DATA_BSY), TIMEOUT, 0);
-       if (!status) {
+       timeout = TIMEOUT;
+       while ((ioread32be(&regs->mdio_data) & MDIO_DATA_BSY) && timeout) {
+               cpu_relax();
+               timeout--;
+       }
+
+       if (!timeout) {
                dev_err(dev, "timeout waiting for operation to complete\n");
                return -ETIMEDOUT;
        }
This page took 0.025708 seconds and 5 git commands to generate.