From patchwork Fri Oct 12 11:01:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1586381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 1A751DFF71 for ; Fri, 12 Oct 2012 11:03:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMczr-0007vr-2B; Fri, 12 Oct 2012 11:01:39 +0000 Received: from mail-ob0-f177.google.com ([209.85.214.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TMczn-0007uo-MT for linux-arm-kernel@lists.infradead.org; Fri, 12 Oct 2012 11:01:36 +0000 Received: by mail-ob0-f177.google.com with SMTP id wd20so2843494obb.36 for ; Fri, 12 Oct 2012 04:01:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=mF1rxfy6HYCRKCzBMp9QLsulgqhEnLS/6oH7H9CJ3P4=; b=pH4e3jFt4qh3wSBJU1RNjgGxKTgzWVeV7DDUm58AoCTt4y6Jw0OASN9vAt/owY7fxA pGfQ7LmFvyV5VCVgGc2CuqCrft1Nwz3pHwCLYxYaEjblJ5xhcAIV/SPoKTODRO0nWHSt WBQFZ7pszrT4JNWYznpf1ocaqQ68AQFkd4aZMqq4xmrvHtoC53O8a3eczQUogsljtZOR rQKXQinYvY21sD/m2v80XvwrItU53MImIXdsX95HmV1E+s0KPsYsr+6Um6J9GheQ8ZIJ FxLz/ZTwjzqedQEPClX89lJdljLUOKGAYWAad6KlBJDHEFYo5nUnDmjfSrWp+BTkHRW9 ARlw== MIME-Version: 1.0 Received: by 10.60.11.1 with SMTP id m1mr3127322oeb.47.1350039691698; Fri, 12 Oct 2012 04:01:31 -0700 (PDT) Received: by 10.76.98.102 with HTTP; Fri, 12 Oct 2012 04:01:31 -0700 (PDT) In-Reply-To: References: <142ef9170a2c69657d8a05ac127a9970d7b04965.1350020375.git.viresh.kumar@linaro.org> <91e41b4cc972d298f714cbd6f400569a9710304c.1350020375.git.viresh.kumar@linaro.org> <1350030203.10584.139.camel@smile> Date: Fri, 12 Oct 2012 16:31:31 +0530 Message-ID: Subject: Re: [PATCH 2/3] dmaengine: dw_dmac: Enhance device tree support From: Viresh Kumar To: Andy Shevchenko X-Gm-Message-State: ALoCoQkXMs35bLAlvOTyDCyapO7Xo5ifsuEXscpgs0gSOnIU7DCwPCnoPRodLFTIyz3XzXrglrTY X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: vinod.koul@intel.com, devicetree-discuss@lists.ozlabs.org, spear-devel@list.st.com, linux-kernel@vger.kernel.org, Andy Shevchenko , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On 12 October 2012 16:10, Andy Shevchenko wrote: >>>> + if (!found) { >>>> + last_dw = dw; >>>> + last_bus_id = param; >>>> + return false; >>> Because of return here you could eliminate 'found' flag at all. Here is the stuff copied from you ;) diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index a4ff04c..c24859e 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c @@ -1184,7 +1184,7 @@ bool dw_generic_filter(struct dma_chan *chan, void *param) struct dw_dma *dw = to_dw_dma(chan->device); static struct dw_dma *last_dw; static char *last_bus_id; - int found = 0, i = -1; + int i = -1; /* * dmaengine framework calls this routine for all channels of all dma @@ -1212,22 +1212,17 @@ bool dw_generic_filter(struct dma_chan *chan, void *param) while (++i < dw->sd_count) { if (!strcmp(dw->sd[i].bus_id, param)) { - found = 1; - break; - } - } + chan->private = &dw->sd[i]; + last_dw = NULL; + last_bus_id = NULL; - if (!found) { - last_dw = dw; - last_bus_id = param; - return false; + return true; + } } - chan->private = &dw->sd[i]; - last_dw = NULL; - last_bus_id = NULL; - - return true; + last_dw = dw; + last_bus_id = param; + return false; } EXPORT_SYMBOL(dw_generic_filter);