aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fsl_pq_mdio.c
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-11-04 07:52:57 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-08 03:43:17 -0500
commit6748f60b948230684fe3f295220e76679c5efc52 (patch)
treed2082c2cdd64bf5017505b026d1e77953f8c28b9 /drivers/net/fsl_pq_mdio.c
parent2951d64e70652bb11636a5a1f1f2ea295a043f94 (diff)
fsl_pq_mdio: Fix compiler/sparse warnings (part 2)
This patch fixes following warnings: fsl_pq_mdio.c:112:38: warning: cast adds address space to expression (<asn:2>) fsl_pq_mdio.c:124:38: warning: cast adds address space to expression (<asn:2>) fsl_pq_mdio.c:133:38: warning: cast adds address space to expression (<asn:2>) fsl_pq_mdio.c:414:11: warning: cast adds address space to expression (<asn:2>) Instead of adding __force all over the place, introduce convenient fsl_pq_mdio_get_regs() call that does the ugly casting just once. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fsl_pq_mdio.c')
-rw-r--r--drivers/net/fsl_pq_mdio.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index fb8c8d9dcf29..b2ca596760f8 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -103,13 +103,18 @@ int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs,
103 return value; 103 return value;
104} 104}
105 105
106static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus)
107{
108 return (void __iomem __force *)bus->priv;
109}
110
106/* 111/*
107 * Write value to the PHY at mii_id at register regnum, 112 * Write value to the PHY at mii_id at register regnum,
108 * on the bus, waiting until the write is done before returning. 113 * on the bus, waiting until the write is done before returning.
109 */ 114 */
110int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) 115int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
111{ 116{
112 struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv; 117 struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
113 118
114 /* Write to the local MII regs */ 119 /* Write to the local MII regs */
115 return(fsl_pq_local_mdio_write(regs, mii_id, regnum, value)); 120 return(fsl_pq_local_mdio_write(regs, mii_id, regnum, value));
@@ -121,7 +126,7 @@ int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
121 */ 126 */
122int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum) 127int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
123{ 128{
124 struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv; 129 struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
125 130
126 /* Read the local MII regs */ 131 /* Read the local MII regs */
127 return(fsl_pq_local_mdio_read(regs, mii_id, regnum)); 132 return(fsl_pq_local_mdio_read(regs, mii_id, regnum));
@@ -130,7 +135,7 @@ int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
130/* Reset the MIIM registers, and wait for the bus to free */ 135/* Reset the MIIM registers, and wait for the bus to free */
131static int fsl_pq_mdio_reset(struct mii_bus *bus) 136static int fsl_pq_mdio_reset(struct mii_bus *bus)
132{ 137{
133 struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv; 138 struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
134 int timeout = PHY_INIT_TIMEOUT; 139 int timeout = PHY_INIT_TIMEOUT;
135 140
136 mutex_lock(&bus->mdio_lock); 141 mutex_lock(&bus->mdio_lock);
@@ -404,7 +409,7 @@ static int fsl_pq_mdio_remove(struct of_device *ofdev)
404 409
405 dev_set_drvdata(device, NULL); 410 dev_set_drvdata(device, NULL);
406 411
407 iounmap((void __iomem *)bus->priv); 412 iounmap(fsl_pq_mdio_get_regs(bus));
408 bus->priv = NULL; 413 bus->priv = NULL;
409 mdiobus_free(bus); 414 mdiobus_free(bus);
410 415