From patchwork Thu Apr 18 10:12:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16208 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2A20723974 for ; Thu, 18 Apr 2013 10:13:47 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id k5sf3678389ggn.0 for ; Thu, 18 Apr 2013 03:13:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=iD/FkGsrGPHCmDMzlnpacidJmoAf5/fnC0bULtaEKqc=; b=CxT8HJ4vOCL6CzLkDtW4JKqrpilw+IOV+vwfCfl5nmHTDYt7ylRLVP6mqnsbKRrpc1 JtnPjbfMixiOZRCDvcSQEyJMZQFV3sUkilIoCbeWmpIbtq0lASal1lqED9+E0ECjtCOd obrS1Fj0qkRJPYk7GDIsq9XBI5R4PjBwooTSuZrAI+UDwJRzKfnYOnIhkF0z0gb06KMo BlvzVY+TTV/zbES8poUSlHBBlRlw7t/1hSmPgSL4zKoHLuFUuJXfbzrx1goe7E2TwgIt MsxpDIAB1YcwT6M5FjsxdcXylQygU/oY8MG41GYA1F4ekNKEWuZwBf3gbSAzSNVJJANY 8anA== X-Received: by 10.236.147.79 with SMTP id s55mr5214264yhj.18.1366279990157; Thu, 18 Apr 2013 03:13:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.40.198 with SMTP id z6ls1314532qek.71.gmail; Thu, 18 Apr 2013 03:13:10 -0700 (PDT) X-Received: by 10.58.200.131 with SMTP id js3mr4264602vec.33.1366279989992; Thu, 18 Apr 2013 03:13:09 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id fe2si6234856vcb.50.2013.04.18.03.13.09 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:13:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf10so2315950vcb.29 for ; Thu, 18 Apr 2013 03:13:09 -0700 (PDT) X-Received: by 10.221.0.199 with SMTP id nn7mr7776124vcb.14.1366279989835; Thu, 18 Apr 2013 03:13:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp115754veb; Thu, 18 Apr 2013 03:13:09 -0700 (PDT) X-Received: by 10.194.103.72 with SMTP id fu8mr17338943wjb.42.1366279988909; Thu, 18 Apr 2013 03:13:08 -0700 (PDT) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [2a00:1450:400c:c05::22a]) by mx.google.com with ESMTPS id x14si2405539wij.87.2013.04.18.03.13.08 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:13:08 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::22a is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c05::22a; Received: by mail-wi0-f170.google.com with SMTP id l13so2267989wie.3 for ; Thu, 18 Apr 2013 03:13:08 -0700 (PDT) X-Received: by 10.194.58.202 with SMTP id t10mr17576978wjq.4.1366279988499; Thu, 18 Apr 2013 03:13:08 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id t7sm30483773wij.2.2013.04.18.03.13.06 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Apr 2013 03:13:07 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, Lee Jones , Vinod Koul , Dan Williams , Per Forlin , Rabin Vincent Subject: [PATCH 20/32] dmaengine: ste_dma40: Move rev error-check up to revision acquisition Date: Thu, 18 Apr 2013 11:12:02 +0100 Message-Id: <1366279934-30761-21-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1366279934-30761-1-git-send-email-lee.jones@linaro.org> References: <1366279934-30761-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnNV7hPfM2BMj1zCxnlXfUeDfvccRVfuKJAn8H2Gk05CH7bC0XQroF98VNNDhzXiXCctTe4 X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , At the moment we fetch the hardware revision, then do some stuff, then check whether the revision is correct and return in error if it's not. Well we may as well check it as soon as we know what it is, so let's move the check right up underneath where we acquire the version. Cc: Vinod Koul Cc: Dan Williams Cc: Per Forlin Cc: Rabin Vincent Signed-off-by: Lee Jones --- drivers/dma/ste_dma40.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 28fe153..282dd59 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3185,6 +3185,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) * DB8540v1 has revision 4 */ rev = AMBA_REV_BITS(pid); + if (rev < 2) { + d40_err(&pdev->dev, "hardware revision: %d is not supported", rev); + goto failure; + } plat_data = pdev->dev.platform_data; @@ -3199,12 +3203,6 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n", rev, res->start, num_phy_chans); - if (rev < 2) { - d40_err(&pdev->dev, "hardware revision: %d is not supported", - rev); - goto failure; - } - base = kzalloc(ALIGN(sizeof(struct d40_base), 4) + (num_phy_chans + num_log_chans + ARRAY_SIZE(dma40_memcpy_channels)) * sizeof(struct d40_chan), GFP_KERNEL);