From patchwork Mon Apr 14 14:21:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 3981951 X-Patchwork-Delegate: dan.j.williams@gmail.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 83BD9BFF02 for ; Mon, 14 Apr 2014 14:24:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF4D2200CF for ; Mon, 14 Apr 2014 14:24:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1B4B20166 for ; Mon, 14 Apr 2014 14:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755494AbaDNOX7 (ORCPT ); Mon, 14 Apr 2014 10:23:59 -0400 Received: from top.free-electrons.com ([176.31.233.9]:60211 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755289AbaDNOX6 (ORCPT ); Mon, 14 Apr 2014 10:23:58 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id 640DE1727; Mon, 14 Apr 2014 16:23:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost.localdomain (unknown [190.2.108.71]) by mail.free-electrons.com (Postfix) with ESMTPSA id DF598144D; Mon, 14 Apr 2014 16:21:47 +0200 (CEST) From: Ezequiel Garcia To: Cc: Vinod Koul , Dan Williams , Thomas Petazzoni , Gregory Clement , Tawfik Bayouk , Lior Amsalem , Ezequiel Garcia Subject: [RESEND/PATCH 3/4] dma: mv_xor: Remove all callers of mv_xor_slot_cleanup() Date: Mon, 14 Apr 2014 11:21:06 -0300 Message-Id: <1397485267-9412-4-git-send-email-ezequiel.garcia@free-electrons.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1397485267-9412-1-git-send-email-ezequiel.garcia@free-electrons.com> References: <1397485267-9412-1-git-send-email-ezequiel.garcia@free-electrons.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to simplify the code, remove all the calls to the locked mv_xor_slot_cleanup() and instead use the unlocked version only, It's less error prone to have just one function, and require the caller to ensure proper locking. Signed-off-by: Ezequiel Garcia --- drivers/dma/mv_xor.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index af6e6e9..3be4e70 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -377,7 +377,10 @@ mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) static void mv_xor_tasklet(unsigned long data) { struct mv_xor_chan *chan = (struct mv_xor_chan *) data; - mv_xor_slot_cleanup(chan); + + spin_lock_bh(&chan->lock); + __mv_xor_slot_cleanup(chan); + spin_unlock_bh(&chan->lock); } static struct mv_xor_desc_slot * @@ -656,9 +659,10 @@ static void mv_xor_free_chan_resources(struct dma_chan *chan) struct mv_xor_desc_slot *iter, *_iter; int in_use_descs = 0; - mv_xor_slot_cleanup(mv_chan); - spin_lock_bh(&mv_chan->lock); + + __mv_xor_slot_cleanup(mv_chan); + list_for_each_entry_safe(iter, _iter, &mv_chan->chain, chain_node) { in_use_descs++; @@ -702,7 +706,10 @@ static enum dma_status mv_xor_status(struct dma_chan *chan, ret = dma_cookie_status(chan, cookie, txstate); if (ret == DMA_COMPLETE) return ret; - mv_xor_slot_cleanup(mv_chan); + + spin_lock_bh(&mv_chan->lock); + __mv_xor_slot_cleanup(mv_chan); + spin_unlock_bh(&mv_chan->lock); return dma_cookie_status(chan, cookie, txstate); }