Received: by 10.213.65.68 with SMTP id h4csp1724216imn; Mon, 19 Mar 2018 11:29:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELtKSjyBP/9DrqYEYuJNgGx4oo0s6KteNu/SlPwP124bavjKC86SWbPaOWCJoPbY9DbffBI5 X-Received: by 2002:a17:902:8688:: with SMTP id g8-v6mr9648019plo.340.1521484181090; Mon, 19 Mar 2018 11:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521484181; cv=none; d=google.com; s=arc-20160816; b=YIOdYzHdHFdbiGbks6FQWI4JTOIuFQFxAcLfxaSFRhgfa7lWuigoJu/is15gYR092Q UcbZbq1t0VpYQ8NZfrL03hr6u6PQqin98ve0UaAkKa1BInm6GPczBtlXeiMHmBs4rEoU 5s2oeaFWiGOX7Hf+rSqo5+goX0a3wAynZvQT59tunF/vTWIjQvhYsiuP/5ScpbFsxxfL nYEPhowntzKc7HMLDZBzyyqsMSvmPT/pKtM1tGs+ZW0gSVvWdzYsWywwpOUBpINv8GKw t51zNXz5tbVUJjj4xuSLCyKCO+xm4GWRQPWABc1sVlwSqAc6QDYwN1gYrz9SVucqPRmV 6piQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=oT09+khX+Y5ol73evRAXJ+5UxCer1cTd+KDpbyNJUYU=; b=BlEuhdmYrIv6viO4ni4zR51Do/4r9pCxxFDy8dsWhJ1BjGZ+suRZpnbfgXsWbDi/zi RS3OlHXcIVwh2htlbxsWZCfGRZiVdjsMgZlDCbiIKBT13W+GcN3MitMl9OdTd3kGfoB2 LK/MqsDUkSPCsFTEDo/BDQ459SjgrJgouTWs1HpTDbwCSo+ZuK4ujVLCGpwmlHL+PNRc G0yMsRnDS+zPgsRuE/nKkAf1xSnPXenWRp/Z39/fnFyY1kCKprrPef2ur9UlsT+xXn+L sIT90DzqRNwqGgut7h7jLa6RMQZY4qzfSWBJIbQVl3kpp21sTtGRK0ql3t7I5H5wguMF z7AA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14-v6si413381plj.191.2018.03.19.11.29.27; Mon, 19 Mar 2018 11:29:41 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970059AbeCSS1x (ORCPT + 99 others); Mon, 19 Mar 2018 14:27:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51370 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031719AbeCSS1t (ORCPT ); Mon, 19 Mar 2018 14:27:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8738011D5; Mon, 19 Mar 2018 18:27:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Eric Anholt , Vinod Koul , Sasha Levin Subject: [PATCH 4.9 185/241] dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free Date: Mon, 19 Mar 2018 19:07:30 +0100 Message-Id: <20180319180758.806946963@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Ujfalusi [ Upstream commit de92436ac40ffe9933230aa503e24dbb5ede9201 ] 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. Signed-off-by: Peter Ujfalusi Acked-by: Eric Anholt Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/dma/bcm2835-dma.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -812,7 +812,7 @@ static int bcm2835_dma_terminate_all(str * c->desc is NULL and exit.) */ if (c->desc) { - bcm2835_dma_desc_free(&c->desc->vd); + vchan_terminate_vdesc(&c->desc->vd); c->desc = NULL; bcm2835_dma_abort(c->chan_base); @@ -836,6 +836,13 @@ static int bcm2835_dma_terminate_all(str return 0; } +static void bcm2835_dma_synchronize(struct dma_chan *chan) +{ + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); + + vchan_synchronize(&c->vc); +} + static int bcm2835_dma_chan_init(struct bcm2835_dmadev *d, int chan_id, int irq, unsigned int irq_flags) { @@ -942,6 +949,7 @@ static int bcm2835_dma_probe(struct plat od->ddev.device_prep_dma_memcpy = bcm2835_dma_prep_dma_memcpy; od->ddev.device_config = bcm2835_dma_slave_config; od->ddev.device_terminate_all = bcm2835_dma_terminate_all; + od->ddev.device_synchronize = bcm2835_dma_synchronize; od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV) |