From patchwork Wed Jul 23 10:13:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 4609611 X-Patchwork-Delegate: vinod.koul@intel.com 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A1B279F375 for ; Wed, 23 Jul 2014 10:13:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B74F720173 for ; Wed, 23 Jul 2014 10:13:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43E69201C8 for ; Wed, 23 Jul 2014 10:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757900AbaGWKNT (ORCPT ); Wed, 23 Jul 2014 06:13:19 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:47752 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757588AbaGWKNS (ORCPT ); Wed, 23 Jul 2014 06:13:18 -0400 Received: from avalon.ideasonboard.com (28-189-62-37.mobileinternet.proximus.be [37.62.189.28]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BC947359FA; Wed, 23 Jul 2014 12:12:07 +0200 (CEST) From: Laurent Pinchart To: dmaengine@vger.kernel.org Cc: linux-sh@vger.kernel.org, Kuninori Morimoto Subject: [PATCH] dmaengine: rcar-dmac: Filter out channels from unrelated devices Date: Wed, 23 Jul 2014 12:13:27 +0200 Message-Id: <1406110407-16858-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 1.8.5.5 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Not only does the filter function need to ignore channels from DMA engines handled by other drivers, it also needs to ignore channels belonging to unrelated DMACs as DMA DT bindings reference a specific DMA engine. Fix it. Signed-off-by: Laurent Pinchart --- drivers/dma/sh/rcar-dmac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) This patch applies to the R-Car Gen2 DMAC driver posted as "[PATCH v2 0/8] R-Car Gen2 DMA Controller driver". It doesn't depend on the hardware descriptor list support ("[PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support"). Morimoto-san, I believe this should fix your channel request problem with the snd_soc_rcar driver. diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index c314a6c..4e7321c 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1444,7 +1444,7 @@ static irqreturn_t rcar_dmac_isr_error(int irq, void *data) static bool rcar_dmac_chan_filter(struct dma_chan *chan, void *arg) { struct rcar_dmac *dmac = to_rcar_dmac(chan->device); - unsigned int id = (unsigned int)arg; + struct of_phandle_args *dma_spec = arg; /* * FIXME: Using a filter on OF platforms is a nonsense. The OF xlate @@ -1453,10 +1453,11 @@ static bool rcar_dmac_chan_filter(struct dma_chan *chan, void *arg) * Forcing it to call dma_request_channel() and iterate through all * channels from all controllers is just pointless. */ - if (chan->device->device_control != rcar_dmac_control) + if (chan->device->device_control != rcar_dmac_control || + dma_spec->np != chan->device->dev->of_node) return false; - return !test_and_set_bit(id, dmac->modules); + return !test_and_set_bit(dma_spec->args[0], dmac->modules); } static struct dma_chan *rcar_dmac_of_xlate(struct of_phandle_args *dma_spec, @@ -1473,8 +1474,7 @@ static struct dma_chan *rcar_dmac_of_xlate(struct of_phandle_args *dma_spec, dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - chan = dma_request_channel(mask, rcar_dmac_chan_filter, - (void *)dma_spec->args[0]); + chan = dma_request_channel(mask, rcar_dmac_chan_filter, dma_spec); if (!chan) return NULL;