Skip to content

Commit 99cd149

Browse files
ralfbaechleDavid S. Miller
authored andcommitted
sgiseeq: replace use of dma_cache_wback_inv
The sgiseeq driver is one of the few remaining users of the ancient cache banging DMA API. Replaced with the modern days DMA API. Signed-off-by: Ralf Baechle <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
1 parent dc67369 commit 99cd149

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

drivers/net/sgiseeq.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct sgiseeq_init_block { /* Note the name ;-) */
7575

7676
struct sgiseeq_private {
7777
struct sgiseeq_init_block *srings;
78+
dma_addr_t srings_dma;
7879

7980
/* Ptrs to the descriptors in uncached space. */
8081
struct sgiseeq_rx_desc *rx_desc;
@@ -643,13 +644,20 @@ static int __init sgiseeq_probe(struct platform_device *pdev)
643644
sp = netdev_priv(dev);
644645

645646
/* Make private data page aligned */
646-
sr = (struct sgiseeq_init_block *) get_zeroed_page(GFP_KERNEL);
647+
sr = dma_alloc_coherent(&pdev->dev, sizeof(*sp->srings),
648+
&sp->srings_dma, GFP_KERNEL);
647649
if (!sr) {
648650
printk(KERN_ERR "Sgiseeq: Page alloc failed, aborting.\n");
649651
err = -ENOMEM;
650652
goto err_out_free_dev;
651653
}
652654
sp->srings = sr;
655+
sp->rx_desc = sp->srings->rxvector;
656+
sp->tx_desc = sp->srings->txvector;
657+
658+
/* A couple calculations now, saves many cycles later. */
659+
setup_rx_ring(sp->rx_desc, SEEQ_RX_BUFFERS);
660+
setup_tx_ring(sp->tx_desc, SEEQ_TX_BUFFERS);
653661

654662
memcpy(dev->dev_addr, pd->mac, ETH_ALEN);
655663

@@ -662,19 +670,6 @@ static int __init sgiseeq_probe(struct platform_device *pdev)
662670
sp->name = sgiseeqstr;
663671
sp->mode = SEEQ_RCMD_RBCAST;
664672

665-
sp->rx_desc = (struct sgiseeq_rx_desc *)
666-
CKSEG1ADDR(ALIGNED(&sp->srings->rxvector[0]));
667-
dma_cache_wback_inv((unsigned long)&sp->srings->rxvector,
668-
sizeof(sp->srings->rxvector));
669-
sp->tx_desc = (struct sgiseeq_tx_desc *)
670-
CKSEG1ADDR(ALIGNED(&sp->srings->txvector[0]));
671-
dma_cache_wback_inv((unsigned long)&sp->srings->txvector,
672-
sizeof(sp->srings->txvector));
673-
674-
/* A couple calculations now, saves many cycles later. */
675-
setup_rx_ring(sp->rx_desc, SEEQ_RX_BUFFERS);
676-
setup_tx_ring(sp->tx_desc, SEEQ_TX_BUFFERS);
677-
678673
/* Setup PIO and DMA transfer timing */
679674
sp->hregs->pconfig = 0x161;
680675
sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP |
@@ -732,7 +727,8 @@ static int __exit sgiseeq_remove(struct platform_device *pdev)
732727
struct sgiseeq_private *sp = netdev_priv(dev);
733728

734729
unregister_netdev(dev);
735-
free_page((unsigned long) sp->srings);
730+
dma_free_coherent(&pdev->dev, sizeof(*sp->srings), sp->srings,
731+
sp->srings_dma);
736732
free_netdev(dev);
737733
platform_set_drvdata(pdev, NULL);
738734

0 commit comments

Comments
 (0)