From patchwork Mon Jun 13 05:55:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 9172011 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 7D4B660573 for ; Mon, 13 Jun 2016 05:57:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 701EF200E7 for ; Mon, 13 Jun 2016 05:57:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6275625EF7; Mon, 13 Jun 2016 05:57:37 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 06459200E7 for ; Mon, 13 Jun 2016 05:57:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bCKr4-00041s-E0; Mon, 13 Jun 2016 05:56:10 +0000 Received: from mail-pa0-x241.google.com ([2607:f8b0:400e:c03::241]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bCKr2-0003wm-6b for linux-arm-kernel@lists.infradead.org; Mon, 13 Jun 2016 05:56:08 +0000 Received: by mail-pa0-x241.google.com with SMTP id ts6so2694315pac.0 for ; Sun, 12 Jun 2016 22:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=tTduisErEfehDvyy00eIG9cQEO7sCnmc83oxHpo6A3E=; b=gGsVYiJI5cZhU2S+pzhqE1cX8G4P0Da2hTq+cpFeg5onw781RT4xIChjcXdViEn+Vn KA99gxMHzRGwfHtQiotOVvMT8OeYgy24+IsJHCBdu560UVFbCG16P1aaNOpYhC1WH0P0 wNWg9/V4rZKqNjhzDIs88edUBtNO5UWQOH1Ul0w/cMAFXyedKs+X0+YlEqTcx4H7fVM2 qVXGqO5p1LLuddmaYpgpMTqdnkV5IEeUnBYKh/qjxdF0U5gKfy71SGWsdKqu9YlpTn+c LFFOWZlnV1IbBraqV16ZAyuVKLhaPmxG1xoEs92xjsRi2YJ6aDsF4/bumEJIdN3dzf2b R4fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tTduisErEfehDvyy00eIG9cQEO7sCnmc83oxHpo6A3E=; b=Xa10pQK16UEcbq/YflV9rPqgUWmRNHITsSYiLGnycyF0eI3QP+1bEf9XSFmjUaYEbC kpLfYiiRAK7i66fnHtWug3TdsDvRkttIydgAu3C8izNVZRFWiX/gU8bmJLYAqERJPqsx MwJf2UopNavJNF/OcBA0j6cFh+k88NPefIULeE/4wZjBg+cjoz+qQMzbfSlz9PuqZFhc 3BVbmR68FNmazGGaU/3lKXKqdaTi7JnAcmpoUODkZZzSSmQ6W2IQ2aCD/BOpJ6lleLgw DJZBYT/957oGsiRlaaD5JNfE8Lp12nSC5pNCX/gK3RSo0uTH/2mCie2uBHSzTgaR4S29 AG2A== X-Gm-Message-State: ALyK8tJ2f1FwbkpY6gaNBlrG31qRVAPi/hPdWKKsJgCbI4Ddb9GLZb9TYs+cWIcFW/y6QQ== X-Received: by 10.66.197.202 with SMTP id iw10mr19898678pac.148.1465797347374; Sun, 12 Jun 2016 22:55:47 -0700 (PDT) Received: from squirtle.localdomain.localdomain (c-73-225-163-254.hsd1.wa.comcast.net. [73.225.163.254]) by smtp.gmail.com with ESMTPSA id fl1sm34039523pab.43.2016.06.12.22.55.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Jun 2016 22:55:46 -0700 (PDT) From: Andrey Smirnov To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] i.MX: system.c: Convert goto to if statement Date: Sun, 12 Jun 2016 22:55:27 -0700 Message-Id: <1465797329-22537-1-git-send-email-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.5.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160612_225608_276434_DAAC6521 X-CRM114-Status: GOOD ( 12.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Smirnov , Shawn Guo , Russell King , linux-kernel@vger.kernel.org, Sascha Hauer 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 Using goto here doesn't bring any advantages and only makes the code flow less clear. No functional changes. Signed-off-by: Andrey Smirnov --- RESEND, now with Russell King on CC list. arch/arm/mach-imx/system.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c index 105d1ce..d9f8b0e 100644 --- a/arch/arm/mach-imx/system.c +++ b/arch/arm/mach-imx/system.c @@ -106,26 +106,24 @@ void __init imx_init_l2cache(void) goto out; } - if (readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN) - goto skip_if_enabled; - - /* Configure the L2 PREFETCH and POWER registers */ - val = readl_relaxed(l2x0_base + L310_PREFETCH_CTRL); - val |= 0x70800000; - /* - * The L2 cache controller(PL310) version on the i.MX6D/Q is r3p1-50rel0 - * The L2 cache controller(PL310) version on the i.MX6DL/SOLO/SL is r3p2 - * But according to ARM PL310 errata: 752271 - * ID: 752271: Double linefill feature can cause data corruption - * Fault Status: Present in: r3p0, r3p1, r3p1-50rel0. Fixed in r3p2 - * Workaround: The only workaround to this erratum is to disable the - * double linefill feature. This is the default behavior. - */ - if (cpu_is_imx6q()) - val &= ~(1 << 30 | 1 << 23); - writel_relaxed(val, l2x0_base + L310_PREFETCH_CTRL); + if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) { + /* Configure the L2 PREFETCH and POWER registers */ + val = readl_relaxed(l2x0_base + L310_PREFETCH_CTRL); + val |= 0x70800000; + /* + * The L2 cache controller(PL310) version on the i.MX6D/Q is r3p1-50rel0 + * The L2 cache controller(PL310) version on the i.MX6DL/SOLO/SL is r3p2 + * But according to ARM PL310 errata: 752271 + * ID: 752271: Double linefill feature can cause data corruption + * Fault Status: Present in: r3p0, r3p1, r3p1-50rel0. Fixed in r3p2 + * Workaround: The only workaround to this erratum is to disable the + * double linefill feature. This is the default behavior. + */ + if (cpu_is_imx6q()) + val &= ~(1 << 30 | 1 << 23); + writel_relaxed(val, l2x0_base + L310_PREFETCH_CTRL); + } -skip_if_enabled: iounmap(l2x0_base); of_node_put(np);