From patchwork Fri Oct 5 10:17:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inderpal Singh X-Patchwork-Id: 12001 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 43DB223EFB for ; Fri, 5 Oct 2012 10:18:15 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id E9721A18F15 for ; Fri, 5 Oct 2012 10:18:14 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3260369iej.11 for ; Fri, 05 Oct 2012 03:18:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=R9gI3WuafOWLeYWjIHkbYDu/m6+nkFmI2lmRwq5LxZg=; b=dZz9HFmi/oYwrjkK19NahqZbHXXacuztwNgiwc65vG9G9Jc2CkFERqFd80nBfTcHYi l0vgK1BQ/qN4tO7PC6G3+pGiAanK7bSezSdXeHjMhJ8/F7fiX6+y6lZEtm2/lgygwGCs LCZfNidT2bd+EWD8co7CP5N2ls0sThoCEFvlKLUpoy4xz8kyfjTZH72zwNC2FsZjcuwq XIxNmj80wZaALAsdaj3FbLvWCOZ2mNxOqH5oDYfNO03Jy5Beg/EEj+dhQAmbJ5GOTHUc RM311MhI7OP+uVfvqR8AvdrTht0PbPiWChe5EIMbKoPN8VgxOtNXyLVcp8FhETFvVXjs 3bbw== Received: by 10.50.194.136 with SMTP id hw8mr700727igc.28.1349432294705; Fri, 05 Oct 2012 03:18:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp117180igc; Fri, 5 Oct 2012 03:18:14 -0700 (PDT) Received: by 10.66.74.195 with SMTP id w3mr20249106pav.64.1349432293999; Fri, 05 Oct 2012 03:18:13 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id nz5si18774456pbb.316.2012.10.05.03.18.13 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 03:18:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of inderpal.singh@linaro.org) client-ip=209.85.220.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of inderpal.singh@linaro.org) smtp.mail=inderpal.singh@linaro.org Received: by mail-pa0-f50.google.com with SMTP id hz11so1755480pad.37 for ; Fri, 05 Oct 2012 03:18:13 -0700 (PDT) Received: by 10.66.78.4 with SMTP id x4mr20299202paw.60.1349432293767; Fri, 05 Oct 2012 03:18:13 -0700 (PDT) Received: from inder-ubuntu.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPS id qa4sm5848287pbb.70.2012.10.05.03.18.09 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 03:18:13 -0700 (PDT) From: Inderpal Singh 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 Message-Id: <1349432276-22919-4-git-send-email-inderpal.singh@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349432276-22919-1-git-send-email-inderpal.singh@linaro.org> References: <1349432276-22919-1-git-send-email-inderpal.singh@linaro.org> X-Gm-Message-State: ALoCoQmF59WaGh1DkBmTu4JXcoeoDJVJIbAmdH5zGTzZYgqLvvsHdninAahQXHIpa20ZlgOJye13 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 --- 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)) {