Commit 6748f60b authored by Anton Vorontsov's avatar Anton Vorontsov Committed by David S. Miller

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: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2951d64e
...@@ -103,13 +103,18 @@ int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs, ...@@ -103,13 +103,18 @@ int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs,
return value; return value;
} }
static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus)
{
return (void __iomem __force *)bus->priv;
}
/* /*
* Write value to the PHY at mii_id at register regnum, * Write value to the PHY at mii_id at register regnum,
* on the bus, waiting until the write is done before returning. * on the bus, waiting until the write is done before returning.
*/ */
int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
{ {
struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv; struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
/* Write to the local MII regs */ /* Write to the local MII regs */
return(fsl_pq_local_mdio_write(regs, mii_id, regnum, value)); 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,7 +126,7 @@ int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
*/ */
int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum) int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
{ {
struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv; struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
/* Read the local MII regs */ /* Read the local MII regs */
return(fsl_pq_local_mdio_read(regs, mii_id, regnum)); 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,7 +135,7 @@ int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
/* Reset the MIIM registers, and wait for the bus to free */ /* Reset the MIIM registers, and wait for the bus to free */
static int fsl_pq_mdio_reset(struct mii_bus *bus) static int fsl_pq_mdio_reset(struct mii_bus *bus)
{ {
struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv; struct fsl_pq_mdio __iomem *regs = fsl_pq_mdio_get_regs(bus);
int timeout = PHY_INIT_TIMEOUT; int timeout = PHY_INIT_TIMEOUT;
mutex_lock(&bus->mdio_lock); mutex_lock(&bus->mdio_lock);
...@@ -404,7 +409,7 @@ static int fsl_pq_mdio_remove(struct of_device *ofdev) ...@@ -404,7 +409,7 @@ static int fsl_pq_mdio_remove(struct of_device *ofdev)
dev_set_drvdata(device, NULL); dev_set_drvdata(device, NULL);
iounmap((void __iomem *)bus->priv); iounmap(fsl_pq_mdio_get_regs(bus));
bus->priv = NULL; bus->priv = NULL;
mdiobus_free(bus); mdiobus_free(bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment