Skip to content

Commit

Permalink
I/OAT: clean up of dca provider start and stop
Browse files Browse the repository at this point in the history
Don't start ioat_dca if ioat_dma didn't start, and then stop ioat_dca
before stopping ioat_dma.  Since the ioat_dma side does the pci device
work, This takes care of ioat_dca trying to use a bad device reference.

Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Shannon Nelson authored and Linus Torvalds committed Oct 18, 2007
1 parent 7df7cf0 commit dfe2299
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions drivers/dma/ioat.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static int ioat_setup_functionality(struct pci_dev *pdev, void __iomem *iobase)
switch (version) {
case IOAT_VER_1_2:
device->dma = ioat_dma_probe(pdev, iobase);
if (ioat_dca_enabled)
if (device->dma && ioat_dca_enabled)
device->dca = ioat_dca_init(pdev, iobase);
break;
default:
Expand All @@ -85,17 +85,16 @@ static void ioat_shutdown_functionality(struct pci_dev *pdev)
{
struct ioat_device *device = pci_get_drvdata(pdev);

if (device->dma) {
ioat_dma_remove(device->dma);
device->dma = NULL;
}

if (device->dca) {
unregister_dca_provider(device->dca);
free_dca_provider(device->dca);
device->dca = NULL;
}

if (device->dma) {
ioat_dma_remove(device->dma);
device->dma = NULL;
}
}

static struct pci_driver ioat_pci_driver = {
Expand Down
4 changes: 2 additions & 2 deletions drivers/dma/ioat_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,10 +941,10 @@ void ioat_dma_remove(struct ioatdma_device *device)
struct dma_chan *chan, *_chan;
struct ioat_dma_chan *ioat_chan;

dma_async_device_unregister(&device->common);

ioat_dma_remove_interrupts(device);

dma_async_device_unregister(&device->common);

pci_pool_destroy(device->dma_pool);
pci_pool_destroy(device->completion_pool);

Expand Down

0 comments on commit dfe2299

Please sign in to comment.