From patchwork Thu Aug 6 02:16:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6955231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1256DC05AC for ; Thu, 6 Aug 2015 02:19:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41EC82066E for ; Thu, 6 Aug 2015 02:19:05 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 2D6772066B for ; Thu, 6 Aug 2015 02:19:04 +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 1ZNAjx-0000HV-Um; Thu, 06 Aug 2015 02:17:05 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNAju-0000BO-Gq for linux-arm-kernel@lists.infradead.org; Thu, 06 Aug 2015 02:17:03 +0000 Received: by pabxd6 with SMTP id xd6so32357999pab.2 for ; Wed, 05 Aug 2015 19:16:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=R4bQ2qgRag2EwKwPMwXp8Sl0aW2NIfqsqhva0d65dB4=; b=gwDdeuNziWjA9ymJiqjfdqScj6V0P9+tWLtEDhxgbggGTjuwMJ5+YPV5iJFwnyy2Sr b+N/Xge75Dco/hCbVeh8336VdZmu7BdTQgk3HWYgJEun3ra7jCod5rELzHj9qt4cUuQc gy84XTNfWIC/UriXfYx05rxSVTorgDTVQ4tW/aST1amU321NB9TR+WD8lBMDWQklvzDM +Cb8khFhwfxmEpxZxc4VMQxGkVfSEyQogj475L2KVoxfmxttUecJxLEIhyWR+rlO0tPU IHUx8WHtuKV1JVXol8nlfjasnQoe++ZAQrf56fA6W9UhVxCg1df6g0AuUqZ3J+Po0V98 vivQ== X-Gm-Message-State: ALoCoQljmnIxtLnkUZ4O1V1awgKl4e959WB24YcO1EQM+BiANuON2SOi0NtLoVG5B4uc91DCMGGe X-Received: by 10.66.66.1 with SMTP id b1mr25684966pat.112.1438827400368; Wed, 05 Aug 2015 19:16:40 -0700 (PDT) Received: from phoenix (118-167-9-185.dynamic.hinet.net. [118.167.9.185]) by smtp.gmail.com with ESMTPSA id qv3sm4360399pbb.78.2015.08.05.19.16.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2015 19:16:39 -0700 (PDT) Message-ID: <1438827394.19066.1.camel@ingics.com> Subject: [PATCH RFT] ata: ahci_brcmstb: Fix misuse of IS_ENABLED From: Axel Lin To: Tejun Heo Date: Thu, 06 Aug 2015 10:16:34 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150805_191702_610608_D018CED0 X-CRM114-Status: GOOD ( 10.77 ) X-Spam-Score: -2.6 (--) 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: Florian Fainelli , Brian Norris , linux-arm-kernel@lists.infradead.org, Gregory Fong , linux-ide@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 While IS_ENABLED() is perfectly fine for CONFIG_* symbols, it is not for other symbols such as __BIG_ENDIAN that is provided directly by the compiler. Signed-off-by: Axel Lin --- Hi, I don't have a big endian machine to test this, so I'd appreciate if someone can review and test this patch. A similar misuse of IS_ENABLED is reported and fixed in: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/dma/mv_xor.c?id=0ec9ebc706fbd394bc233d87ac7aaad1c4f3ab54 drivers/ata/ahci_brcmstb.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/ata/ahci_brcmstb.c b/drivers/ata/ahci_brcmstb.c index 42b6cf4..fc6413f 100644 --- a/drivers/ata/ahci_brcmstb.c +++ b/drivers/ata/ahci_brcmstb.c @@ -92,19 +92,21 @@ static inline u32 brcm_sata_readreg(void __iomem *addr) * Other architectures (e.g., ARM) either do not support big endian, or * else leave I/O in little endian mode. */ - if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) - return __raw_readl(addr); - else - return readl_relaxed(addr); +#if defined(__BIG_ENDIAN) && IS_ENABLED(CONFIG_MIPS) + return __raw_readl(addr); +#else + return readl_relaxed(addr); +#endif } static inline void brcm_sata_writereg(u32 val, void __iomem *addr) { /* See brcm_sata_readreg() comments */ - if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) - __raw_writel(val, addr); - else - writel_relaxed(val, addr); +#if defined(__BIG_ENDIAN) && IS_ENABLED(CONFIG_MIPS) + __raw_writel(val, addr); +#else + writel_relaxed(val, addr); +#endif } static void brcm_sata_phy_enable(struct brcm_ahci_priv *priv, int port)