Received: by 10.223.164.202 with SMTP id h10csp593804wrb; Tue, 14 Nov 2017 06:37:45 -0800 (PST) X-Google-Smtp-Source: AGs4zMagUGV/z3tkJkYAS8OwekRQuVauJuJ4R5+opgx35aab3GtFlOxZg5v4+BnQNg7DB/ZtuCw1 X-Received: by 10.99.115.9 with SMTP id o9mr12435824pgc.198.1510670265270; Tue, 14 Nov 2017 06:37:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510670265; cv=none; d=google.com; s=arc-20160816; b=tbO55VUBuY6Vzpalyz7PvT/DlubKC9KC6f68ZbwXJQlruVP+kVg7U5NvLqzpP3KUV9 Ro7AkbFYQNClRZLEzDZ1kpx8f8HvOUPrGEXLZjDWHTDIaNPsrdaefMqksrsrpA1eHTCH DfP2tWx+A7D/9IAZwX3YazbteMclR6RJYYcN6bbtDAIug2wlMTskucZVn4fzcMGVHNhC 0Mk+iQQMC3mSaNOD0BbVwxXqRG77xx3M5cjeeTjbG7crm9wXbOPcfbtI8vV8Qhypab45 ZYUzC+qLsuHmyyJqyHdm+e7zRtQjTioIT85ggGeVgkGBoWMTcGBprEY99ZU/LqUXY72L CrAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=zyLLehdzIuEoJZ6+q3O5Ev4AmUOjhjXHwsfa3S1fCEo=; b=EgFxpwzVCWV727lAvFN+Fsfvca8orJDCFqCR6BVDYMHAN/T5+WpHGbrBw69FDBGoGS dVV4VG1Yf2tjw6STaRwTOOyM4N38+rRfx/GH+RXtb/0CH8xiiFOKPuDyXeb8h2nDKIVt 3zuUFfoJ/o5Z+2PT8HqDRKGcIbnKSuRdnPyDr1P2rT4Or06YvEpkqzs2AZJz4GpD0IcV eUwPZjNn4jWYcWREnbEvogdW/ivM/0QeC3Mfcd1JTWyaUO2A7ui0OcA2iGo8L0zjgco3 G9sYSuWVdGpQqVVzzvX1wkFMkrAY2v9vyzIzmLiWRl56B8MrzfKbGxO2mk519C6udkhC GpSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=P7f0+9te; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si1701234pld.395.2017.11.14.06.37.33; Tue, 14 Nov 2017 06:37:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=P7f0+9te; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754110AbdKNOeq (ORCPT + 88 others); Tue, 14 Nov 2017 09:34:46 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:47915 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755610AbdKNOch (ORCPT ); Tue, 14 Nov 2017 09:32:37 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id vAEEVtnZ018575; Tue, 14 Nov 2017 08:31:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1510669915; bh=REylcatpPygS/eTLKls7F7NO2EWe4z75U9AfiUlq7eM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=P7f0+9teNhIFVoiEtm24Vc+68b9xWpcLJxGGFM62uFmydwsqInJ3Kxi5dF7EwHbpM iUHUwe6cWQwyiKTi6juMzE3LjXXicjcYc5WzFefPjxb7JfeQCcNzquY5l3XKl7O530 AKhrNKWLU9b+B+GEnnmCd7UodEdb0qDLiKdWNvXY= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAEEVthm000474; Tue, 14 Nov 2017 08:31:55 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 14 Nov 2017 08:31:54 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 14 Nov 2017 08:31:54 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAEEVX7B018797; Tue, 14 Nov 2017 08:31:53 -0600 From: Peter Ujfalusi To: CC: , , , , Krzysztof Kozlowski Subject: [PATCH 10/10] dmaengine: s3c24xx-dma: Use vchan_terminate_vdesc() instead of desc_free Date: Tue, 14 Nov 2017 16:32:12 +0200 Message-ID: <20171114143212.8311-11-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171114143212.8311-1-peter.ujfalusi@ti.com> References: <20171114143212.8311-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To avoid race with vchan_complete, use the race free way to terminate running transfer. Implement the device_synchronize callback to make sure that the terminated descriptor is freed. CC: Krzysztof Kozlowski Signed-off-by: Peter Ujfalusi --- drivers/dma/s3c24xx-dma.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c index f04c4702d98b..cd92d696bcf9 100644 --- a/drivers/dma/s3c24xx-dma.c +++ b/drivers/dma/s3c24xx-dma.c @@ -732,7 +732,7 @@ static int s3c24xx_dma_terminate_all(struct dma_chan *chan) /* Dequeue current job */ if (s3cchan->at) { - s3c24xx_dma_desc_free(&s3cchan->at->vd); + vchan_terminate_vdesc(&s3cchan->at->vd); s3cchan->at = NULL; } @@ -744,6 +744,13 @@ static int s3c24xx_dma_terminate_all(struct dma_chan *chan) return ret; } +static void s3c24xx_dma_synchronize(struct dma_chan *chan) +{ + struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan); + + vchan_synchronize(&s3cchan->vc); +} + static void s3c24xx_dma_free_chan_resources(struct dma_chan *chan) { /* Ensure all queued descriptors are freed */ @@ -1282,6 +1289,7 @@ static int s3c24xx_dma_probe(struct platform_device *pdev) s3cdma->memcpy.device_issue_pending = s3c24xx_dma_issue_pending; s3cdma->memcpy.device_config = s3c24xx_dma_set_runtime_config; s3cdma->memcpy.device_terminate_all = s3c24xx_dma_terminate_all; + s3cdma->memcpy.device_synchronize = s3c24xx_dma_synchronize; /* Initialize slave engine for SoC internal dedicated peripherals */ dma_cap_set(DMA_SLAVE, s3cdma->slave.cap_mask); @@ -1296,6 +1304,7 @@ static int s3c24xx_dma_probe(struct platform_device *pdev) s3cdma->slave.device_prep_dma_cyclic = s3c24xx_dma_prep_dma_cyclic; s3cdma->slave.device_config = s3c24xx_dma_set_runtime_config; s3cdma->slave.device_terminate_all = s3c24xx_dma_terminate_all; + s3cdma->slave.device_synchronize = s3c24xx_dma_synchronize; s3cdma->slave.filter.map = pdata->slave_map; s3cdma->slave.filter.mapcnt = pdata->slavecnt; s3cdma->slave.filter.fn = s3c24xx_dma_filter; -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki From 1583802166625277288@xxx Sat Nov 11 20:17:28 +0000 2017 X-GM-THRID: 1583730621455347206 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread