Commit 748353cc authored by Alexandre Bounine's avatar Alexandre Bounine Committed by Linus Torvalds

rapidio/tsi721: add HW specific mport removal

Add hardware-specific device removal support for Tsi721 PCIe-to-RapidIO
bridge.  To avoid excessive data type conversions, parameters passed to
some internal functions have been revised.  Dynamic memory allocations
of rio_mport and rio_ops have been replaced to reduce references between
data structures.
Signed-off-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b77a2030
This diff is collapsed.
...@@ -824,7 +824,7 @@ struct tsi721_ib_win { ...@@ -824,7 +824,7 @@ struct tsi721_ib_win {
struct tsi721_device { struct tsi721_device {
struct pci_dev *pdev; struct pci_dev *pdev;
struct rio_mport *mport; struct rio_mport mport;
u32 flags; u32 flags;
void __iomem *regs; void __iomem *regs;
#ifdef CONFIG_PCI_MSI #ifdef CONFIG_PCI_MSI
...@@ -866,9 +866,11 @@ struct tsi721_device { ...@@ -866,9 +866,11 @@ struct tsi721_device {
#ifdef CONFIG_RAPIDIO_DMA_ENGINE #ifdef CONFIG_RAPIDIO_DMA_ENGINE
extern void tsi721_bdma_handler(struct tsi721_bdma_chan *bdma_chan); extern void tsi721_bdma_handler(struct tsi721_bdma_chan *bdma_chan);
extern int tsi721_register_dma(struct tsi721_device *priv); extern int tsi721_register_dma(struct tsi721_device *priv);
extern void tsi721_unregister_dma(struct tsi721_device *priv);
extern void tsi721_dma_stop_all(struct tsi721_device *priv); extern void tsi721_dma_stop_all(struct tsi721_device *priv);
#else #else
#define tsi721_dma_stop_all(priv) do {} while (0) #define tsi721_dma_stop_all(priv) do {} while (0)
#define tsi721_unregister_dma(priv) do {} while (0)
#endif #endif
#endif #endif
...@@ -887,7 +887,7 @@ int tsi721_register_dma(struct tsi721_device *priv) ...@@ -887,7 +887,7 @@ int tsi721_register_dma(struct tsi721_device *priv)
int i; int i;
int nr_channels = 0; int nr_channels = 0;
int err; int err;
struct rio_mport *mport = priv->mport; struct rio_mport *mport = &priv->mport;
INIT_LIST_HEAD(&mport->dma.channels); INIT_LIST_HEAD(&mport->dma.channels);
...@@ -937,3 +937,29 @@ int tsi721_register_dma(struct tsi721_device *priv) ...@@ -937,3 +937,29 @@ int tsi721_register_dma(struct tsi721_device *priv)
return err; return err;
} }
void tsi721_unregister_dma(struct tsi721_device *priv)
{
struct rio_mport *mport = &priv->mport;
struct dma_chan *chan, *_c;
struct tsi721_bdma_chan *bdma_chan;
tsi721_dma_stop_all(priv);
dma_async_device_unregister(&mport->dma);
list_for_each_entry_safe(chan, _c, &mport->dma.channels,
device_node) {
bdma_chan = to_tsi721_chan(chan);
if (bdma_chan->active) {
tsi721_bdma_interrupt_enable(bdma_chan, 0);
bdma_chan->active = false;
tsi721_sync_dma_irq(bdma_chan);
tasklet_kill(&bdma_chan->tasklet);
INIT_LIST_HEAD(&bdma_chan->free_list);
kfree(bdma_chan->tx_desc);
tsi721_bdma_ch_free(bdma_chan);
}
list_del(&chan->device_node);
}
}
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