From patchwork Fri Aug 7 10:26:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Baldyga X-Patchwork-Id: 6967501 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 09E339F358 for ; Fri, 7 Aug 2015 10:27:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 445E42068A for ; Fri, 7 Aug 2015 10:27:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F33E220688 for ; Fri, 7 Aug 2015 10:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751934AbbHGK1B (ORCPT ); Fri, 7 Aug 2015 06:27:01 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:56199 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751898AbbHGK1A (ORCPT ); Fri, 7 Aug 2015 06:27:00 -0400 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSP00LYQJORNC40@mailout2.samsung.com>; Fri, 07 Aug 2015 19:26:58 +0900 (KST) X-AuditID: cbfee61b-f79706d000001b96-bb-55c487f25702 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 6E.97.07062.2F784C55; Fri, 7 Aug 2015 19:26:58 +0900 (KST) Received: from AMDC2122.DIGITAL.local ([106.120.53.17]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NSP00CEMJOQYG70@mmp1.samsung.com>; Fri, 07 Aug 2015 19:26:58 +0900 (KST) From: Robert Baldyga To: vinod.koul@intel.com Cc: dan.j.williams@intel.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, m.szyprowski@samsung.com, k.kozlowski@samsung.com, Robert Baldyga Subject: [PATCH] dmaengine: fix balance of privatecnt inc/dec operations Date: Fri, 07 Aug 2015 12:26:47 +0200 Message-id: <1438943207-4840-1-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKJMWRmVeSWpSXmKPExsVy+t9jAd1P7UdCDTY1qltMn3qB0WL11L+s Fq9fGFpc3jWHzWLtkbvsFg8O72S3eNm3n8WB3WPxnpdMHn1bVjF6fN4kF8AcxWWTkpqTWZZa pG+XwJXx7eMb5oJDHBVvtvUwNTAuZe9i5OSQEDCR2PbrAhuELSZx4d56IJuLQ0hgKaPEhhfT mSCcn4wSZ1s/s4BUsQnoSGz5PoERxBYRkJDY/qyPHaSIWWALo8T2xmdMIAlhAQ+JKW9aWUFs FgFViaNvesFsXgEXiauXnrFCrJOTOHlsMusERu4FjAyrGCVSC5ILipPSc43yUsv1ihNzi0vz 0vWS83M3MYID45n0DsbDu9wPMQpwMCrx8Cb8OxwqxJpYVlyZe4hRgoNZSYT3bPWRUCHelMTK qtSi/Pii0pzU4kOM0hwsSuK8+iabQoUE0hNLUrNTUwtSi2CyTBycUg2Mm7o8eY/bLl4p9GN6 71IuzR9/za8aJnLrP5weonZO7bfB0SStzrip3sdu2GzrchA2faSxaVlC8R4eURl/x17rCcf5 H83s8yvluvFN2vPgbplJc9VEeRfP2WOwPO/W8inhN01vKDedW7NI5TQwOC/ZHnvrxyXN+VNM 6ESn9IcLHj8WqOsnf3ynxFKckWioxVxUnAgAM3Cc0wgCAAA= Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch increments privatecnt value and set DMA_PRIVATE in device caps in dma_request_slave_channel() function. This is needed to keep privatecnt increment/decrement balance. As function dma_release_channel() decrements privatecnt counter, we need to increment it when channel is requested. Otherwise privatecnt drops into negatives after few dma_release_channel() calls. Reported-by: Krzysztof Kozlowski Signed-off-by: Robert Baldyga --- drivers/dma/dmaengine.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 4a4cce1..3ff284c 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -689,6 +689,10 @@ struct dma_chan *dma_request_slave_channel(struct device *dev, struct dma_chan *ch = dma_request_slave_channel_reason(dev, name); if (IS_ERR(ch)) return NULL; + + dma_cap_set(DMA_PRIVATE, ch->device->cap_mask); + ch->device->privatecnt++; + return ch; } EXPORT_SYMBOL_GPL(dma_request_slave_channel);