summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/sja1000/kvaser_pci.c
diff options
context:
space:
mode:
authorWolfgang Grandegger <wg@grandegger.com>2009-05-30 07:55:49 +0000
committerDavid S. Miller <davem@davemloft.net>2009-06-01 02:53:34 -0700
commit255a9154319d3cf475d527458037758935f6445b (patch)
tree317fd2edb63cfa222000cbfa4c4bed6da15c5420 /drivers/net/can/sja1000/kvaser_pci.c
parent128ced8f9d59bb3e36fbb4df87bd9d881f0a4463 (diff)
downloadtalos-obmc-linux-255a9154319d3cf475d527458037758935f6445b.tar.gz
talos-obmc-linux-255a9154319d3cf475d527458037758935f6445b.zip
can: sja1000: stop misusing member base_addr of struct net_device
As discussed on the netdev mailing list, the member "base_addr" of "struct net_device" should not be (mis)used to store the virtual address to the SJA1000 register area. According to David Miller, it's only use is to allow ISA and similar primitive bus devices to have their I/O ports changed via ifconfig. The virtual address is now stored in the private data structure of the SJA1000 device and the callback functions use "struct sja1000_priv" instead of the unneeded "struct net_device". Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/sja1000/kvaser_pci.c')
-rw-r--r--drivers/net/can/sja1000/kvaser_pci.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c
index 00830b358c4f..7dd7769b9713 100644
--- a/drivers/net/can/sja1000/kvaser_pci.c
+++ b/drivers/net/can/sja1000/kvaser_pci.c
@@ -117,14 +117,15 @@ static struct pci_device_id kvaser_pci_tbl[] = {
MODULE_DEVICE_TABLE(pci, kvaser_pci_tbl);
-static u8 kvaser_pci_read_reg(const struct net_device *dev, int port)
+static u8 kvaser_pci_read_reg(const struct sja1000_priv *priv, int port)
{
- return ioread8((void __iomem *)(dev->base_addr + port));
+ return ioread8(priv->reg_base + port);
}
-static void kvaser_pci_write_reg(const struct net_device *dev, int port, u8 val)
+static void kvaser_pci_write_reg(const struct sja1000_priv *priv,
+ int port, u8 val)
{
- iowrite8(val, (void __iomem *)(dev->base_addr + port));
+ iowrite8(val, priv->reg_base + port);
}
static void kvaser_pci_disable_irq(struct net_device *dev)
@@ -199,7 +200,7 @@ static void kvaser_pci_del_chan(struct net_device *dev)
}
unregister_sja1000dev(dev);
- pci_iounmap(board->pci_dev, (void __iomem *)dev->base_addr);
+ pci_iounmap(board->pci_dev, priv->reg_base);
pci_iounmap(board->pci_dev, board->conf_addr);
pci_iounmap(board->pci_dev, board->res_addr);
@@ -210,7 +211,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
struct net_device **master_dev,
void __iomem *conf_addr,
void __iomem *res_addr,
- unsigned long base_addr)
+ void __iomem *base_addr)
{
struct net_device *dev;
struct sja1000_priv *priv;
@@ -252,7 +253,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
board->xilinx_ver = master_board->xilinx_ver;
}
- dev->base_addr = base_addr + channel * KVASER_PCI_PORT_BYTES;
+ priv->reg_base = base_addr + channel * KVASER_PCI_PORT_BYTES;
priv->read_reg = kvaser_pci_read_reg;
priv->write_reg = kvaser_pci_write_reg;
@@ -267,8 +268,8 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
init_step = 4;
- dev_info(&pdev->dev, "base_addr=%#lx conf_addr=%p irq=%d\n",
- dev->base_addr, board->conf_addr, dev->irq);
+ dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n",
+ priv->reg_base, board->conf_addr, dev->irq);
SET_NETDEV_DEV(dev, &pdev->dev);
@@ -343,7 +344,7 @@ static int __devinit kvaser_pci_init_one(struct pci_dev *pdev,
for (i = 0; i < no_channels; i++) {
err = kvaser_pci_add_chan(pdev, i, &master_dev,
conf_addr, res_addr,
- (unsigned long)base_addr);
+ base_addr);
if (err)
goto failure_cleanup;
}
OpenPOWER on IntegriCloud