Commit cc8c6e37 authored by Kumar Gala's avatar Kumar Gala Committed by Jeff Garzik

[PATCH] gianfar: Fix sparse warnings

Fixed sparse warnings mainly due to lack of __iomem.
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 3e710bfa
...@@ -199,8 +199,7 @@ static int gfar_probe(struct platform_device *pdev) ...@@ -199,8 +199,7 @@ static int gfar_probe(struct platform_device *pdev)
/* get a pointer to the register memory */ /* get a pointer to the register memory */
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->regs = (struct gfar *) priv->regs = ioremap(r->start, sizeof (struct gfar));
ioremap(r->start, sizeof (struct gfar));
if (NULL == priv->regs) { if (NULL == priv->regs) {
err = -ENOMEM; err = -ENOMEM;
...@@ -369,7 +368,7 @@ static int gfar_probe(struct platform_device *pdev) ...@@ -369,7 +368,7 @@ static int gfar_probe(struct platform_device *pdev)
return 0; return 0;
register_fail: register_fail:
iounmap((void *) priv->regs); iounmap(priv->regs);
regs_fail: regs_fail:
free_netdev(dev); free_netdev(dev);
return err; return err;
...@@ -382,7 +381,7 @@ static int gfar_remove(struct platform_device *pdev) ...@@ -382,7 +381,7 @@ static int gfar_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
iounmap((void *) priv->regs); iounmap(priv->regs);
free_netdev(dev); free_netdev(dev);
return 0; return 0;
...@@ -454,8 +453,7 @@ static void init_registers(struct net_device *dev) ...@@ -454,8 +453,7 @@ static void init_registers(struct net_device *dev)
/* Zero out the rmon mib registers if it has them */ /* Zero out the rmon mib registers if it has them */
if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
memset((void *) &(priv->regs->rmon), 0, memset_io(&(priv->regs->rmon), 0, sizeof (struct rmon_mib));
sizeof (struct rmon_mib));
/* Mask off the CAM interrupts */ /* Mask off the CAM interrupts */
gfar_write(&priv->regs->rmon.cam1, 0xffffffff); gfar_write(&priv->regs->rmon.cam1, 0xffffffff);
...@@ -477,7 +475,7 @@ static void init_registers(struct net_device *dev) ...@@ -477,7 +475,7 @@ static void init_registers(struct net_device *dev)
void gfar_halt(struct net_device *dev) void gfar_halt(struct net_device *dev)
{ {
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs; struct gfar __iomem *regs = priv->regs;
u32 tempval; u32 tempval;
/* Mask all interrupts */ /* Mask all interrupts */
...@@ -507,7 +505,7 @@ void gfar_halt(struct net_device *dev) ...@@ -507,7 +505,7 @@ void gfar_halt(struct net_device *dev)
void stop_gfar(struct net_device *dev) void stop_gfar(struct net_device *dev)
{ {
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs; struct gfar __iomem *regs = priv->regs;
unsigned long flags; unsigned long flags;
phy_stop(priv->phydev); phy_stop(priv->phydev);
...@@ -590,7 +588,7 @@ static void free_skb_resources(struct gfar_private *priv) ...@@ -590,7 +588,7 @@ static void free_skb_resources(struct gfar_private *priv)
void gfar_start(struct net_device *dev) void gfar_start(struct net_device *dev)
{ {
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs; struct gfar __iomem *regs = priv->regs;
u32 tempval; u32 tempval;
/* Enable Rx and Tx in MACCFG1 */ /* Enable Rx and Tx in MACCFG1 */
...@@ -624,7 +622,7 @@ int startup_gfar(struct net_device *dev) ...@@ -624,7 +622,7 @@ int startup_gfar(struct net_device *dev)
unsigned long vaddr; unsigned long vaddr;
int i; int i;
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs; struct gfar __iomem *regs = priv->regs;
int err = 0; int err = 0;
u32 rctrl = 0; u32 rctrl = 0;
u32 attrs = 0; u32 attrs = 0;
...@@ -1622,7 +1620,7 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1622,7 +1620,7 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static void adjust_link(struct net_device *dev) static void adjust_link(struct net_device *dev)
{ {
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs; struct gfar __iomem *regs = priv->regs;
unsigned long flags; unsigned long flags;
struct phy_device *phydev = priv->phydev; struct phy_device *phydev = priv->phydev;
int new_state = 0; int new_state = 0;
...@@ -1703,7 +1701,7 @@ static void gfar_set_multi(struct net_device *dev) ...@@ -1703,7 +1701,7 @@ static void gfar_set_multi(struct net_device *dev)
{ {
struct dev_mc_list *mc_ptr; struct dev_mc_list *mc_ptr;
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs; struct gfar __iomem *regs = priv->regs;
u32 tempval; u32 tempval;
if(dev->flags & IFF_PROMISC) { if(dev->flags & IFF_PROMISC) {
...@@ -1842,7 +1840,7 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr) ...@@ -1842,7 +1840,7 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr)
int idx; int idx;
char tmpbuf[MAC_ADDR_LEN]; char tmpbuf[MAC_ADDR_LEN];
u32 tempval; u32 tempval;
u32 *macptr = &priv->regs->macstnaddr1; u32 __iomem *macptr = &priv->regs->macstnaddr1;
macptr += num*2; macptr += num*2;
......
...@@ -682,8 +682,8 @@ struct gfar_private { ...@@ -682,8 +682,8 @@ struct gfar_private {
struct rxbd8 *cur_rx; /* Next free rx ring entry */ struct rxbd8 *cur_rx; /* Next free rx ring entry */
struct txbd8 *cur_tx; /* Next free ring entry */ struct txbd8 *cur_tx; /* Next free ring entry */
struct txbd8 *dirty_tx; /* The Ring entry to be freed. */ struct txbd8 *dirty_tx; /* The Ring entry to be freed. */
struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ struct gfar __iomem *regs; /* Pointer to the GFAR memory mapped Registers */
u32 *hash_regs[16]; u32 __iomem *hash_regs[16];
int hash_width; int hash_width;
struct net_device_stats stats; /* linux network statistics */ struct net_device_stats stats; /* linux network statistics */
struct gfar_extra_stats extra_stats; struct gfar_extra_stats extra_stats;
...@@ -718,14 +718,14 @@ struct gfar_private { ...@@ -718,14 +718,14 @@ struct gfar_private {
uint32_t msg_enable; uint32_t msg_enable;
}; };
static inline u32 gfar_read(volatile unsigned *addr) static inline u32 gfar_read(volatile unsigned __iomem *addr)
{ {
u32 val; u32 val;
val = in_be32(addr); val = in_be32(addr);
return val; return val;
} }
static inline void gfar_write(volatile unsigned *addr, u32 val) static inline void gfar_write(volatile unsigned __iomem *addr, u32 val)
{ {
out_be32(addr, val); out_be32(addr, val);
} }
......
...@@ -144,11 +144,11 @@ static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, ...@@ -144,11 +144,11 @@ static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
u64 *extra = (u64 *) & priv->extra_stats; u64 *extra = (u64 *) & priv->extra_stats;
if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
u32 *rmon = (u32 *) & priv->regs->rmon; u32 __iomem *rmon = (u32 __iomem *) & priv->regs->rmon;
struct gfar_stats *stats = (struct gfar_stats *) buf; struct gfar_stats *stats = (struct gfar_stats *) buf;
for (i = 0; i < GFAR_RMON_LEN; i++) for (i = 0; i < GFAR_RMON_LEN; i++)
stats->rmon[i] = (u64) (rmon[i]); stats->rmon[i] = (u64) gfar_read(&rmon[i]);
for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
stats->extra[i] = extra[i]; stats->extra[i] = extra[i];
...@@ -221,11 +221,11 @@ static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, voi ...@@ -221,11 +221,11 @@ static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, voi
{ {
int i; int i;
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
u32 *theregs = (u32 *) priv->regs; u32 __iomem *theregs = (u32 __iomem *) priv->regs;
u32 *buf = (u32 *) regbuf; u32 *buf = (u32 *) regbuf;
for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++) for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++)
buf[i] = theregs[i]; buf[i] = gfar_read(&theregs[i]);
} }
/* Convert microseconds to ethernet clock ticks, which changes /* Convert microseconds to ethernet clock ticks, which changes
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* All PHY configuration is done through the TSEC1 MIIM regs */ * All PHY configuration is done through the TSEC1 MIIM regs */
int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
{ {
struct gfar_mii *regs = bus->priv; struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
/* Set the PHY address and the register address we want to write */ /* Set the PHY address and the register address we want to write */
gfar_write(&regs->miimadd, (mii_id << 8) | regnum); gfar_write(&regs->miimadd, (mii_id << 8) | regnum);
...@@ -70,7 +70,7 @@ int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) ...@@ -70,7 +70,7 @@ int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
* configuration has to be done through the TSEC1 MIIM regs */ * configuration has to be done through the TSEC1 MIIM regs */
int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
{ {
struct gfar_mii *regs = bus->priv; struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
u16 value; u16 value;
/* Set the PHY address and the register address we want to read */ /* Set the PHY address and the register address we want to read */
...@@ -94,7 +94,7 @@ int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) ...@@ -94,7 +94,7 @@ int gfar_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 */
int gfar_mdio_reset(struct mii_bus *bus) int gfar_mdio_reset(struct mii_bus *bus)
{ {
struct gfar_mii *regs = bus->priv; struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
unsigned int timeout = PHY_INIT_TIMEOUT; unsigned int timeout = PHY_INIT_TIMEOUT;
spin_lock_bh(&bus->mdio_lock); spin_lock_bh(&bus->mdio_lock);
...@@ -126,7 +126,7 @@ int gfar_mdio_probe(struct device *dev) ...@@ -126,7 +126,7 @@ int gfar_mdio_probe(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct gianfar_mdio_data *pdata; struct gianfar_mdio_data *pdata;
struct gfar_mii *regs; struct gfar_mii __iomem *regs;
struct mii_bus *new_bus; struct mii_bus *new_bus;
struct resource *r; struct resource *r;
int err = 0; int err = 0;
...@@ -155,15 +155,14 @@ int gfar_mdio_probe(struct device *dev) ...@@ -155,15 +155,14 @@ int gfar_mdio_probe(struct device *dev)
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
/* Set the PHY base address */ /* Set the PHY base address */
regs = (struct gfar_mii *) ioremap(r->start, regs = ioremap(r->start, sizeof (struct gfar_mii));
sizeof (struct gfar_mii));
if (NULL == regs) { if (NULL == regs) {
err = -ENOMEM; err = -ENOMEM;
goto reg_map_fail; goto reg_map_fail;
} }
new_bus->priv = regs; new_bus->priv = (void __force *)regs;
new_bus->irq = pdata->irq; new_bus->irq = pdata->irq;
...@@ -181,7 +180,7 @@ int gfar_mdio_probe(struct device *dev) ...@@ -181,7 +180,7 @@ int gfar_mdio_probe(struct device *dev)
return 0; return 0;
bus_register_fail: bus_register_fail:
iounmap((void *) regs); iounmap(regs);
reg_map_fail: reg_map_fail:
kfree(new_bus); kfree(new_bus);
...@@ -197,7 +196,7 @@ int gfar_mdio_remove(struct device *dev) ...@@ -197,7 +196,7 @@ int gfar_mdio_remove(struct device *dev)
dev_set_drvdata(dev, NULL); dev_set_drvdata(dev, NULL);
iounmap((void *) (&bus->priv)); iounmap((void __iomem *)bus->priv);
bus->priv = NULL; bus->priv = NULL;
kfree(bus); kfree(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