From patchwork Tue Aug 1 10:37:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9874127 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 5EC4660365 for ; Tue, 1 Aug 2017 10:39:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 637A428683 for ; Tue, 1 Aug 2017 10:39:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 435B72868B; Tue, 1 Aug 2017 10:39:41 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE 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 CE5B428683 for ; Tue, 1 Aug 2017 10:39:35 +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=aXF4EW5tNxSGcKxeFyBH1M/Tj/ OcxoBXRPit2HquPQIzHlwMjb/0LGfwTKAoAT3DGLkth33yywKne7r3IWU96ex9dRdbpM/hOftqjSo bs6hYY5OSx2oAacnmwxwG07LHjSU7j0nexKPm9yAcb5H9OZs2I5ctVtlniaDb3oOouUKspeaRyl/U Jtln/UPf0UALchDIZwxGx5X/HuhWKWWivkQaZ9StRwLhG28HGoy01cjPAlatu4/PSGCFTxtkg0HL/ hh1bRiDsgUfdNY7KxE0MPIB5uttDVXiQM9yvQosoMWY1iurCtzIwpbRFyIpETEhyhO9yPAHsXI2eq MlkuROuA==; 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 1dcUa2-0003qk-OD; Tue, 01 Aug 2017 10:39:14 +0000 Received: from mail-qk0-x233.google.com ([2607:f8b0:400d:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dcUZg-0003I0-FC for linux-arm-kernel@lists.infradead.org; Tue, 01 Aug 2017 10:39:12 +0000 Received: by mail-qk0-x233.google.com with SMTP id a77so6489270qkb.0 for ; Tue, 01 Aug 2017 03:38:32 -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=arEQmB0unvNUfwCBp5i5uhxu6t8OL8AlQ9uPcYvqOzxtKPJ+dZmr0pkBkBGcGwBIB1 zbTUljmDGJlXg7PRKqeKqIQIaMBgZ2lskfJ1Dw6c5WcLmvehDaOP12RiEQO93Z4X32vG 2mZmiRytzE/7UaTBkJjRIPhAJ/dM0XIIyQ7Io= 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=NYBUZIsmLX8THRR1W/nbI0tX5WNm2r+r067bz2svbfC6PD6i/XfdW49B0emDFye1b1 it6qrwP3Nl55R7ZRG+hxh2NjOf3/8aY1BaAHGYYrwHUIe/ZghTekwmOZZkJi70tE5Aaw 9g5tz/hZGe8EvZRqyFr23svr1BJZRJQztwEFQkm6TbHrGRHD4VmT0sms5HIvQvN3tpvu wLH1K5JCo/ZwU20eqj6m+c7Zb97986EUGG/FvQ4DyK60VYPjKNkWuoF9tvC0AhWXXlfx QSGFW8nhnsfjC5TgB0F6RYfBTNrEJvQ4w3vOI2eNzNHTjIjmB07YJi7GZ0ZeXWO7kfKR 4W8w== X-Gm-Message-State: AIVw113tsOqhPqxDbCwxj8nuYfB4nlruwzS2mNQH2UczfIALSOcgKMsA xV0czqvlNzJdwBjZ X-Received: by 10.55.58.71 with SMTP id h68mr25388489qka.169.1501583911388; Tue, 01 Aug 2017 03:38:31 -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 e32sm21784162qtb.63.2017.08.01.03.38.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 03:38:30 -0700 (PDT) From: Anup Patel To: Rob Herring , Mark Rutland , Vinod Koul , Dan Williams Subject: [PATCH v2 02/16] dmaengine: bcm-sba-raid: Reduce locking context in sba_alloc_request() Date: Tue, 1 Aug 2017 16:07:46 +0530 Message-Id: <1501583880-32072-3-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501583880-32072-1-git-send-email-anup.patel@broadcom.com> References: <1501583880-32072-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170801_033852_819949_EFEDEB6A X-CRM114-Status: GOOD ( 12.80 ) 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: devicetree@vger.kernel.org, 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; }