Received: by 10.213.65.68 with SMTP id h4csp501047imn; Fri, 16 Mar 2018 09:39:39 -0700 (PDT) X-Google-Smtp-Source: AG47ELvzIYm6uigIqgvaq7VKCLdQA7FvCGcUp7a6bl3tqe8YJUfBHOPBfvTHnYZy7znCz94uZk6H X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr2830895plp.228.1521218379185; Fri, 16 Mar 2018 09:39:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218379; cv=none; d=google.com; s=arc-20160816; b=DuCEv5cPg3ogZaU50q25ytptZLTkJScd5uSu9WA2FI0/VI219fhSkkZ2MOcSNBbB9Y aYEx6WKQqcwmH+OZBPHWP1fdOTtVR0QFLTG8eddAhk6CdFgGSSdKiNfyY7qp/MG4Uzso WCGrpMwOmnSj9p8Vj9yrYOAOYLlTX//lQR5efZb1LK/DFcRb5gbgTu6i/x9AXzHmzrtx 2gk+LavvvKJHBXXFF8HjU6H1Pytca84JZi9cfsFX4d8x3KcIpDQdBIgJqk4RpqvFapWi XFjt///TxKZDMa0biuLm0SVch+Z9ZPn+QCHy5ae0kFGoIw8YsUPkMd/m/nMnLIMstNfn Inrg== 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=QiDlWsAiug0qfahJeLO09wR3Z6LXc0QrtGgy2uHdVxE=; b=qWZdr5M3QShlYWPHHvl3hAXB0hMkuz98qsmCLiYEcBZgwcgk3ljieVmhaspnMp9xMN i8OUq7CeuDLbp6iU4XT3vVtbTk8WVO2x2j6UTG0JpMnhPboCD5MNxNxAraGBXBQjfRGt DeFqMDhVC4C4tgzDBAajgwgfhGdg96Z1ilT3IpuB8Xzo52wTkvedElwnzDmILky3yKkL f5BBZy1rgiwyGhjoxETekSdb/03fTtv+WNgqwGoqsu2NWhArdmyoJ2qQ+Fsk1E9ueAqn /74EExsKzm1rjqQOWGTD1WJnAd7g4ZBNnpCKhvEGmJnHvJgJ1lBPLopiq6+w+XTxvpTZ WIXQ== 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 k71si5109469pga.68.2018.03.16.09.39.24; Fri, 16 Mar 2018 09:39:39 -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 S934374AbeCPPhF (ORCPT + 99 others); Fri, 16 Mar 2018 11:37:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40532 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934089AbeCPPhD (ORCPT ); Fri, 16 Mar 2018 11:37:03 -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 7693411D2; Fri, 16 Mar 2018 15:37:02 +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.14 064/109] dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free Date: Fri, 16 Mar 2018 16:23:33 +0100 Message-Id: <20180316152333.462064800@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-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) |