Received: by 10.213.65.68 with SMTP id h4csp480795imn; Fri, 16 Mar 2018 09:03:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELss8vk2CoG/LDhRAE4WJCj1SgSL7XnD6e6StTKvSN14wxX7wPbZ5j9hMHVIJGQtsBOWAIvZ X-Received: by 10.99.106.202 with SMTP id f193mr1903686pgc.334.1521216197817; Fri, 16 Mar 2018 09:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521216197; cv=none; d=google.com; s=arc-20160816; b=R+Q90svLtEaIThbcZFknMLxbRRjoFQp+nJkHaQ+rBIY9g/bxd0Sx1wo1LzfazT6gWk GI5htC3Nyzk9REAG/p2gMLEC2Vi8ex2vkqSU4lZz1DgO3Le3Ne5JqCaE3Vp11w/beVzj TnOSG3qHdQWFLTMJ7KfUuvxb6GPneX8RkGxOOjl4SYn/oawOnvJsQ6st8yJBYQoiOsuM Bbm7LcC5Ph9MbTimP+tnzjEN3YXHtFL9CKqz2BCsBn/NRbyiSM9ZQhzrubY6a25uNkCN r7d2IB0HVwlrPno2HamEg9ow5lXVh1VmRTHigiPdVhppOLT8VzuRp+qr2gmJ+JcyVsyA zwnw== 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=91xT3N4YWPpYiOdnCj/2Nwpxzfg4RQXgdXIESJLk7wI=; b=ubuPlhBIr+NlWZP+95EA3FrNbxA8pWeJmwsiYeY2+MuWR6OZV1geKdQFmc3mAtY2ji tAt8itMJd8b5sztbnXmJCDQiFBtcfIC74UPDANtdRA4sBD/LSNqu+YTLZNOcDokVvLRA o3ywh9aYe0NsJE2OOPTmi8B5jz5uIa+TvRvBng1zmMV0/TW6FL62RexSLdy44QIGE8Kc 7mkrzoIu0TP8kEUlu2EBgomN6maDia+yO1BrA1df4B/zKtfQ92uO3NkTh3bSq4CPGKu2 DLu1/a+EVdjrQnC2qULj6damnW6Utq5N5pozi2rc7TunntFCkWkpLxR3e8IMwuXaQPSh yOfA== 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 u21si5684503pfl.176.2018.03.16.09.02.43; Fri, 16 Mar 2018 09:03:17 -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 S965185AbeCPPnA (ORCPT + 99 others); Fri, 16 Mar 2018 11:43:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44672 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964991AbeCPPm4 (ORCPT ); Fri, 16 Mar 2018 11:42:56 -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 38FE710B0; Fri, 16 Mar 2018 15:42:56 +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.15 077/128] dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free Date: Fri, 16 Mar 2018 16:23:38 +0100 Message-Id: <20180316152340.510759247@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@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.15-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) |