diff options
author | Francois Romieu <romieu@fr.zoreil.com> | 2012-03-23 14:20:14 -0400 |
---|---|---|
committer | Francois Romieu <romieu@fr.zoreil.com> | 2012-04-07 05:58:38 -0400 |
commit | 0193fc5efd95c18bed1d03c57b2f916906662753 (patch) | |
tree | 8deb4699afd21fa982647836636ada91706a08d1 /drivers/net/hippi | |
parent | a74254588754bf7bc5c60f2bcc9ee5f66b749ea2 (diff) |
rrunner: stop using net_device.{base_addr, irq}.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'drivers/net/hippi')
-rw-r--r-- | drivers/net/hippi/rrunner.c | 82 |
1 files changed, 35 insertions, 47 deletions
diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c index 2a51363d9fed..248c4f17846c 100644 --- a/drivers/net/hippi/rrunner.c +++ b/drivers/net/hippi/rrunner.c | |||
@@ -114,10 +114,9 @@ static int __devinit rr_init_one(struct pci_dev *pdev, | |||
114 | 114 | ||
115 | SET_NETDEV_DEV(dev, &pdev->dev); | 115 | SET_NETDEV_DEV(dev, &pdev->dev); |
116 | 116 | ||
117 | if (pci_request_regions(pdev, "rrunner")) { | 117 | ret = pci_request_regions(pdev, "rrunner"); |
118 | ret = -EIO; | 118 | if (ret < 0) |
119 | goto out; | 119 | goto out; |
120 | } | ||
121 | 120 | ||
122 | pci_set_drvdata(pdev, dev); | 121 | pci_set_drvdata(pdev, dev); |
123 | 122 | ||
@@ -125,11 +124,8 @@ static int __devinit rr_init_one(struct pci_dev *pdev, | |||
125 | 124 | ||
126 | spin_lock_init(&rrpriv->lock); | 125 | spin_lock_init(&rrpriv->lock); |
127 | 126 | ||
128 | dev->irq = pdev->irq; | ||
129 | dev->netdev_ops = &rr_netdev_ops; | 127 | dev->netdev_ops = &rr_netdev_ops; |
130 | 128 | ||
131 | dev->base_addr = pci_resource_start(pdev, 0); | ||
132 | |||
133 | /* display version info if adapter is found */ | 129 | /* display version info if adapter is found */ |
134 | if (!version_disp) { | 130 | if (!version_disp) { |
135 | /* set display flag to TRUE so that */ | 131 | /* set display flag to TRUE so that */ |
@@ -147,16 +143,14 @@ static int __devinit rr_init_one(struct pci_dev *pdev, | |||
147 | pci_set_master(pdev); | 143 | pci_set_master(pdev); |
148 | 144 | ||
149 | printk(KERN_INFO "%s: Essential RoadRunner serial HIPPI " | 145 | printk(KERN_INFO "%s: Essential RoadRunner serial HIPPI " |
150 | "at 0x%08lx, irq %i, PCI latency %i\n", dev->name, | 146 | "at 0x%08llx, irq %i, PCI latency %i\n", dev->name, |
151 | dev->base_addr, dev->irq, pci_latency); | 147 | pci_resource_start(pdev, 0), pdev->irq, pci_latency); |
152 | 148 | ||
153 | /* | 149 | /* |
154 | * Remap the regs into kernel space. | 150 | * Remap the MMIO regs into kernel space. |
155 | */ | 151 | */ |
156 | 152 | rrpriv->regs = pci_iomap(pdev, 0, 0x1000); | |
157 | rrpriv->regs = ioremap(dev->base_addr, 0x1000); | 153 | if (!rrpriv->regs) { |
158 | |||
159 | if (!rrpriv->regs){ | ||
160 | printk(KERN_ERR "%s: Unable to map I/O register, " | 154 | printk(KERN_ERR "%s: Unable to map I/O register, " |
161 | "RoadRunner will be disabled.\n", dev->name); | 155 | "RoadRunner will be disabled.\n", dev->name); |
162 | ret = -EIO; | 156 | ret = -EIO; |
@@ -203,8 +197,6 @@ static int __devinit rr_init_one(struct pci_dev *pdev, | |||
203 | 197 | ||
204 | rr_init(dev); | 198 | rr_init(dev); |
205 | 199 | ||
206 | dev->base_addr = 0; | ||
207 | |||
208 | ret = register_netdev(dev); | 200 | ret = register_netdev(dev); |
209 | if (ret) | 201 | if (ret) |
210 | goto out; | 202 | goto out; |
@@ -218,7 +210,7 @@ static int __devinit rr_init_one(struct pci_dev *pdev, | |||
218 | pci_free_consistent(pdev, TX_TOTAL_SIZE, rrpriv->tx_ring, | 210 | pci_free_consistent(pdev, TX_TOTAL_SIZE, rrpriv->tx_ring, |
219 | rrpriv->tx_ring_dma); | 211 | rrpriv->tx_ring_dma); |
220 | if (rrpriv->regs) | 212 | if (rrpriv->regs) |
221 | iounmap(rrpriv->regs); | 213 | pci_iounmap(pdev, rrpriv->regs); |
222 | if (pdev) { | 214 | if (pdev) { |
223 | pci_release_regions(pdev); | 215 | pci_release_regions(pdev); |
224 | pci_set_drvdata(pdev, NULL); | 216 | pci_set_drvdata(pdev, NULL); |
@@ -232,29 +224,26 @@ static int __devinit rr_init_one(struct pci_dev *pdev, | |||
232 | static void __devexit rr_remove_one (struct pci_dev *pdev) | 224 | static void __devexit rr_remove_one (struct pci_dev *pdev) |
233 | { | 225 | { |
234 | struct net_device *dev = pci_get_drvdata(pdev); | 226 | struct net_device *dev = pci_get_drvdata(pdev); |
227 | struct rr_private *rr = netdev_priv(dev); | ||
235 | 228 | ||
236 | if (dev) { | 229 | if (!(readl(&rr->regs->HostCtrl) & NIC_HALTED)) { |
237 | struct rr_private *rr = netdev_priv(dev); | 230 | printk(KERN_ERR "%s: trying to unload running NIC\n", |
238 | 231 | dev->name); | |
239 | if (!(readl(&rr->regs->HostCtrl) & NIC_HALTED)){ | 232 | writel(HALT_NIC, &rr->regs->HostCtrl); |
240 | printk(KERN_ERR "%s: trying to unload running NIC\n", | ||
241 | dev->name); | ||
242 | writel(HALT_NIC, &rr->regs->HostCtrl); | ||
243 | } | ||
244 | |||
245 | pci_free_consistent(pdev, EVT_RING_SIZE, rr->evt_ring, | ||
246 | rr->evt_ring_dma); | ||
247 | pci_free_consistent(pdev, RX_TOTAL_SIZE, rr->rx_ring, | ||
248 | rr->rx_ring_dma); | ||
249 | pci_free_consistent(pdev, TX_TOTAL_SIZE, rr->tx_ring, | ||
250 | rr->tx_ring_dma); | ||
251 | unregister_netdev(dev); | ||
252 | iounmap(rr->regs); | ||
253 | free_netdev(dev); | ||
254 | pci_release_regions(pdev); | ||
255 | pci_disable_device(pdev); | ||
256 | pci_set_drvdata(pdev, NULL); | ||
257 | } | 233 | } |
234 | |||
235 | unregister_netdev(dev); | ||
236 | pci_free_consistent(pdev, EVT_RING_SIZE, rr->evt_ring, | ||
237 | rr->evt_ring_dma); | ||
238 | pci_free_consistent(pdev, RX_TOTAL_SIZE, rr->rx_ring, | ||
239 | rr->rx_ring_dma); | ||
240 | pci_free_consistent(pdev, TX_TOTAL_SIZE, rr->tx_ring, | ||
241 | rr->tx_ring_dma); | ||
242 | pci_iounmap(pdev, rr->regs); | ||
243 | pci_release_regions(pdev); | ||
244 | pci_disable_device(pdev); | ||
245 | pci_set_drvdata(pdev, NULL); | ||
246 | free_netdev(dev); | ||
258 | } | 247 | } |
259 | 248 | ||
260 | 249 | ||
@@ -1230,9 +1219,9 @@ static int rr_open(struct net_device *dev) | |||
1230 | readl(®s->HostCtrl); | 1219 | readl(®s->HostCtrl); |
1231 | spin_unlock_irqrestore(&rrpriv->lock, flags); | 1220 | spin_unlock_irqrestore(&rrpriv->lock, flags); |
1232 | 1221 | ||
1233 | if (request_irq(dev->irq, rr_interrupt, IRQF_SHARED, dev->name, dev)) { | 1222 | if (request_irq(pdev->irq, rr_interrupt, IRQF_SHARED, dev->name, dev)) { |
1234 | printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", | 1223 | printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", |
1235 | dev->name, dev->irq); | 1224 | dev->name, pdev->irq); |
1236 | ecode = -EAGAIN; | 1225 | ecode = -EAGAIN; |
1237 | goto error; | 1226 | goto error; |
1238 | } | 1227 | } |
@@ -1339,16 +1328,15 @@ static void rr_dump(struct net_device *dev) | |||
1339 | 1328 | ||
1340 | static int rr_close(struct net_device *dev) | 1329 | static int rr_close(struct net_device *dev) |
1341 | { | 1330 | { |
1342 | struct rr_private *rrpriv; | 1331 | struct rr_private *rrpriv = netdev_priv(dev); |
1343 | struct rr_regs __iomem *regs; | 1332 | struct rr_regs __iomem *regs = rrpriv->regs; |
1333 | struct pci_dev *pdev = rrpriv->pci_dev; | ||
1344 | unsigned long flags; | 1334 | unsigned long flags; |
1345 | u32 tmp; | 1335 | u32 tmp; |
1346 | short i; | 1336 | short i; |
1347 | 1337 | ||
1348 | netif_stop_queue(dev); | 1338 | netif_stop_queue(dev); |
1349 | 1339 | ||
1350 | rrpriv = netdev_priv(dev); | ||
1351 | regs = rrpriv->regs; | ||
1352 | 1340 | ||
1353 | /* | 1341 | /* |
1354 | * Lock to make sure we are not cleaning up while another CPU | 1342 | * Lock to make sure we are not cleaning up while another CPU |
@@ -1387,15 +1375,15 @@ static int rr_close(struct net_device *dev) | |||
1387 | rr_raz_tx(rrpriv, dev); | 1375 | rr_raz_tx(rrpriv, dev); |
1388 | rr_raz_rx(rrpriv, dev); | 1376 | rr_raz_rx(rrpriv, dev); |
1389 | 1377 | ||
1390 | pci_free_consistent(rrpriv->pci_dev, 256 * sizeof(struct ring_ctrl), | 1378 | pci_free_consistent(pdev, 256 * sizeof(struct ring_ctrl), |
1391 | rrpriv->rx_ctrl, rrpriv->rx_ctrl_dma); | 1379 | rrpriv->rx_ctrl, rrpriv->rx_ctrl_dma); |
1392 | rrpriv->rx_ctrl = NULL; | 1380 | rrpriv->rx_ctrl = NULL; |
1393 | 1381 | ||
1394 | pci_free_consistent(rrpriv->pci_dev, sizeof(struct rr_info), | 1382 | pci_free_consistent(pdev, sizeof(struct rr_info), rrpriv->info, |
1395 | rrpriv->info, rrpriv->info_dma); | 1383 | rrpriv->info_dma); |
1396 | rrpriv->info = NULL; | 1384 | rrpriv->info = NULL; |
1397 | 1385 | ||
1398 | free_irq(dev->irq, dev); | 1386 | free_irq(pdev->irq, dev); |
1399 | spin_unlock_irqrestore(&rrpriv->lock, flags); | 1387 | spin_unlock_irqrestore(&rrpriv->lock, flags); |
1400 | 1388 | ||
1401 | return 0; | 1389 | return 0; |