From patchwork Tue Aug 22 09:56:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9914699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7635C603FF for ; Tue, 22 Aug 2017 09:58:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 856C928788 for ; Tue, 22 Aug 2017 09:58:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A5AC2883F; Tue, 22 Aug 2017 09:58:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2CC0828854 for ; Tue, 22 Aug 2017 09:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3mN2rpowBVYJ/Q3Q8dBzr5opC2q7c7ixrEXsPdcDbHQ=; b=fZwRHqkz2zJ2tPZJI5fJAK3UcT 4iDw6Jbkh9JFMpPJ+YyShdLuZN5tIab2NxZlonSXTFn4ZIWEa/bCv+qizur3DDXdeo1T9kZRiR0TR 39c1uXpgCUTbv03QV+d/xtt0PeKjNPf9MC6m0+Apgx6FYU0q/UgARLOxSxcO2+Gvlh5pmoixl8J3+ MpXe+NRcCmR+3ByTljVnUg1gz8o8F26QoHRr64aic6w8FJRKzi4ZY8LWfqI9BvU1itNOQtnEQcjRX Yd4+Gllm0HTPbyonwKt1H4RREZi2wAG1/8DeQ4mJNNXIE19olfrTaNnZQJhXy9o2gKvEBWyVjCJ5t UTHz5YHA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dk5xK-0006wI-4l; Tue, 22 Aug 2017 09:58:42 +0000 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk5we-000668-LH for linux-arm-kernel@lists.infradead.org; Tue, 22 Aug 2017 09:58:08 +0000 Received: by mail-wr0-x234.google.com with SMTP id f8so84438035wrf.3 for ; Tue, 22 Aug 2017 02:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Mft8FLB1SCGwE+Kln+RLbf9IETTCJ+gyc45xF5RJN94=; b=P9FMwuYBa80aXW5HFwj25iITKcRkAaf5qDB7BiLnbNE380qt6rxLQSXeaAFYdfEhQI ssODLPK/MVjx7PDrluJmNhF3JdrYlbQ5rZKKzxJv5HbzPmpkrjK2GbUsEAjQbHmOLKmD yxSiI/m7zK4lqhsKq0Ndz25q+6NSQLaakRIxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Mft8FLB1SCGwE+Kln+RLbf9IETTCJ+gyc45xF5RJN94=; b=do9t3pC6xuOhlaTJXumAxJzh7tnh3uS+Gwif6m3LXUZWUpiMJUAw/t0mipczFtEkSy doRfIeaH4+PJstX+tKjfnnbWEwc5KXdB4W8nSDShz8dFyTWL6c6AtCjV1OSzRX6jARVG uyMtBNyaS7tlqnHlZRamx5Tt42sygg93gVZXhoCsqTnJXBinzJZX9OXrgzWWcDQY8PHY 0SKVEJfdH6SxlJUlE7BmSILSn3fZDaZiscluxDNMLnE/xZziEYjVXjNBnYhm2rHcYXiJ 79aka5IRJVfNWGOMWLqF7Ztq7Ypc4HiPXP3NSi8kRwr3opF2sNGMEsbYcI9muJvua09x 19fg== X-Gm-Message-State: AHYfb5gMpWqzFv4kuP+4yNU7duMffjYcOO1JqLxJZy9s420ISOm+1D2a 4G3gdpiqA7T+y0x4 X-Received: by 10.28.62.200 with SMTP id l191mr57850wma.57.1503395858792; Tue, 22 Aug 2017 02:57:38 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id e137sm12257913wma.29.2017.08.22.02.57.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 02:57:38 -0700 (PDT) From: Anup Patel To: Vinod Koul , Dan Williams Subject: [PATCH v3 02/17] dmaengine: bcm-sba-raid: Reduce locking context in sba_alloc_request() Date: Tue, 22 Aug 2017 15:26:51 +0530 Message-Id: <1503395827-19428-3-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503395827-19428-1-git-send-email-anup.patel@broadcom.com> References: <1503395827-19428-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170822_025801_652398_EEDC6153 X-CRM114-Status: GOOD ( 11.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Anup Patel , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We don't require to hold "sba->reqs_lock" for long-time in sba_alloc_request() because lock protection is not required when initializing members of "struct sba_request". Signed-off-by: Anup Patel --- drivers/dma/bcm-sba-raid.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c index 76999b7..f81d5ac 100644 --- a/drivers/dma/bcm-sba-raid.c +++ b/drivers/dma/bcm-sba-raid.c @@ -207,24 +207,24 @@ static struct sba_request *sba_alloc_request(struct sba_device *sba) struct sba_request *req = NULL; spin_lock_irqsave(&sba->reqs_lock, flags); - req = list_first_entry_or_null(&sba->reqs_free_list, struct sba_request, node); if (req) { list_move_tail(&req->node, &sba->reqs_alloc_list); - req->state = SBA_REQUEST_STATE_ALLOCED; - req->fence = false; - req->first = req; - INIT_LIST_HEAD(&req->next); - req->next_count = 1; - atomic_set(&req->next_pending_count, 1); - sba->reqs_free_count--; - - dma_async_tx_descriptor_init(&req->tx, &sba->dma_chan); } - spin_unlock_irqrestore(&sba->reqs_lock, flags); + if (!req) + return NULL; + + req->state = SBA_REQUEST_STATE_ALLOCED; + req->fence = false; + req->first = req; + INIT_LIST_HEAD(&req->next); + req->next_count = 1; + atomic_set(&req->next_pending_count, 1); + + dma_async_tx_descriptor_init(&req->tx, &sba->dma_chan); return req; }