mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Inderpal Singh <inderpal.singh@linaro.org>
To: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jassisinghbrar@gmail.com, boojin.kim@samsung.com,
	vinod.koul@intel.com, patches@linaro.org, kgene.kim@samsung.com
Subject: [PATCH v2 3/4] DMA: PL330: Balance module remove function with probe
Date: Fri,  5 Oct 2012 15:47:55 +0530	[thread overview]
Message-ID: <1349432276-22919-4-git-send-email-inderpal.singh@linaro.org> (raw)
In-Reply-To: <1349432276-22919-1-git-send-email-inderpal.singh@linaro.org>

Since peripheral channel resources are not being allocated at probe,
no need to flush the channels and free the resources in remove function.
In case, the channel is in use by some client, return EBUSY.

Signed-off-by: Inderpal Singh <inderpal.singh@linaro.org>
---
 drivers/dma/pl330.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index bf71ff7..4b7a34d 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -3009,18 +3009,21 @@ static int __devexit pl330_remove(struct amba_device *adev)
 	if (!pdmac)
 		return 0;
 
+	/* check if any client is using any channel */
+	list_for_each_entry(pch, &pdmac->ddma.channels,
+			chan.device_node) {
+
+		if (pch->chan.client_count)
+			return -EBUSY;
+	}
+
 	amba_set_drvdata(adev, NULL);
 
-	/* Idle the DMAC */
 	list_for_each_entry_safe(pch, _p, &pdmac->ddma.channels,
 			chan.device_node) {
 
 		/* Remove the channel */
 		list_del(&pch->chan.device_node);
-
-		/* Flush the channel */
-		pl330_control(&pch->chan, DMA_TERMINATE_ALL, 0);
-		pl330_free_chan_resources(&pch->chan);
 	}
 
 	while (!list_empty(&pdmac->desc_pool)) {
-- 
1.7.9.5


  parent reply	other threads:[~2012-10-05 10:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 10:17 [PATCH v2 0/4] DMA: PL330: Fix mem leaks and balance probe/remove Inderpal Singh
2012-10-05 10:17 ` [PATCH v2 1/4] DMA: PL330: Free memory allocated for peripheral channels Inderpal Singh
2012-10-24  4:05   ` Vinod Koul
2012-10-25 10:59     ` Inderpal Singh
2012-10-05 10:17 ` [PATCH v2 2/4] DMA: PL330: Change allocation method to properly free DMA descriptors Inderpal Singh
2012-10-24  4:10   ` Vinod Koul
2012-10-25 11:02     ` Inderpal Singh
2012-10-05 10:17 ` Inderpal Singh [this message]
2012-10-24  4:14   ` [PATCH v2 3/4] DMA: PL330: Balance module remove function with probe Vinod Koul
2012-10-25 11:23     ` Inderpal Singh
2012-10-26  4:45       ` Vinod Koul
2012-10-27 10:20         ` Inderpal Singh
2012-10-29  4:45           ` Vinod Koul
2012-10-29  9:00             ` Inderpal Singh
2012-10-05 10:17 ` [PATCH v2 4/4] DMA: PL330: unregister dma_device in module's remove function Inderpal Singh
2012-10-24  4:19   ` Vinod Koul
2012-10-25 11:05     ` Inderpal Singh
2012-10-12  4:33 ` [PATCH v2 0/4] DMA: PL330: Fix mem leaks and balance probe/remove Inderpal Singh
2012-10-13 11:03 ` Jassi Brar
2012-10-16 11:32   ` Inderpal Singh

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=1349432276-22919-4-git-send-email-inderpal.singh@linaro.org \
    --to=inderpal.singh@linaro.org \
    --cc=boojin.kim@samsung.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=vinod.koul@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®