All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Nelson <shannon.nelson@intel.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	torvalds@linux-foundation.org
Cc: shannon.nelson@intel.com, dan.j.williams@intel.com,
	randy.dunlap@oracle.com
Subject: [PATCH 2/5] I/OAT: clean up of dca provider start and stop
Date: Wed, 17 Oct 2007 17:14:23 -0700	[thread overview]
Message-ID: <20071018001423.31147.82007.stgit@localhost.localdomain> (raw)
In-Reply-To: <20071018001416.31147.86176.stgit@localhost.localdomain>

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>
---

 drivers/dma/ioat.c     |   11 +++++------
 drivers/dma/ioat_dma.c |    4 ++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c
index 54fdeb7..a45872f 100644
--- a/drivers/dma/ioat.c
+++ b/drivers/dma/ioat.c
@@ -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:
@@ -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 = {
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 59d4344..725f83f 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -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);
 

  reply	other threads:[~2007-10-18  0:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-18  0:14 [PATCH 1/5] I/OAT: cleanup pci issues Shannon Nelson
2007-10-18  0:14 ` Shannon Nelson [this message]
2007-10-18  0:14 ` [PATCH 3/5] I/OAT: clean up error handling and some print messages Shannon Nelson
2007-10-18  0:14 ` [PATCH 4/5] I/OAT: Tighten descriptor setup performance Shannon Nelson
2007-10-18  0:34   ` Andrew Morton
2007-10-18  0:41     ` Nelson, Shannon
2007-10-18  0:14 ` [PATCH 5/5] I/OAT: Add completion callback for async_tx interface use Shannon Nelson
2007-10-18  0:37   ` Andrew Morton
2007-10-18  0:46     ` Nelson, Shannon
2007-10-18  0:44   ` Andrew Morton
2007-10-18  0:47     ` David Miller
2007-10-18  0:53       ` Nelson, Shannon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071018001423.31147.82007.stgit@localhost.localdomain \
    --to=shannon.nelson@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.