Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp451684ybx; Wed, 30 Oct 2019 18:09:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdOhfpPIhSPYYiNmjxq+cOQ9U2A/s0CmrBsSEGaYeOeZUiHlIMhYGTzAWJjJVMPgwhw+rY X-Received: by 2002:a17:907:429e:: with SMTP id ny22mr1167429ejb.174.1572484153106; Wed, 30 Oct 2019 18:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572484153; cv=none; d=google.com; s=arc-20160816; b=VTuGtLJ3HSLRpBvNqaoH0ga+oRqRziHk4GLVSxogCiKDBYp77pgn9dpcfxOkv5W9m6 uSZnRRsTbrVT34WGWM4JKdon3Vjn4T2t2/LJjBgDy8ih4dMqF7m/u4J8aDLS2a8LCeYE mZ0Bdx6Ax81sbiheKN7+2tfN/wvOJPEx0o3JtnOEi294VMlndf0LPdpn3T5+Z9AJ13Em Xl2p/mpETEOJfVe4kHFOk7P64pOdpbY0q3MXTlY1NwQ6fZOEMMHASs2gCKJIUn10ePvs tozZPXYhSvIvBBSSashXF8w5BQZ6JpXGsW+N0dWbC8d9iqaXbesIRYLsABCCBZIbUz3T r4uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DP8EUpBnJhrMMlR35AJ4qBuW5AAWrThlGdUysZgbcoM=; b=DKni6o69vTlJg3mUJnQOwh4iJLjn/+XyVf/K0wUICLQucmoNYRBLprV3YPYHfy/XYG V0P8eMeSX8vIaVmFbQYpH2S1lu5My7+mTZRRuGaLHO5d/i5gDvR0CbJBrGUin9zgddsE zBXxkF7UtRQgke5IqyYqaG2IBf6CECbAUHACywCS8JYUKtP0ASV8QL0P5ya1KUiSR5Sp zKK1rUkCjgnSyxRVsptpBDFMJPQMplHaplEO6kJbo7JvrfdSWc6Su1bwkVd73gYF5Vtb fVg3ssn8IqNSa4IysWg6IhmPBM4l52TOerZBUOa3sNNF9OAgkmkGnJnaPm//dqQSv8qV 7o1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=NR2y36ZZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si3407778edc.238.2019.10.30.18.08.49; Wed, 30 Oct 2019 18:09:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=NR2y36ZZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728048AbfJaAcK (ORCPT + 99 others); Wed, 30 Oct 2019 20:32:10 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40047 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbfJaAcE (ORCPT ); Wed, 30 Oct 2019 20:32:04 -0400 Received: by mail-wm1-f68.google.com with SMTP id w9so4111714wmm.5 for ; Wed, 30 Oct 2019 17:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DP8EUpBnJhrMMlR35AJ4qBuW5AAWrThlGdUysZgbcoM=; b=NR2y36ZZEfoJ5Txna6kcEQ7KMDEZfJ5uEOOUqUBeEw5/YOd91gpyFb21BmcEkeTPDL VYKz4WaVu+sf+6lxOOq1rkeXeFVj2T9AQ7Ov5PCc6o318lrWSxiqeem6ihBc1IHDaVdx +gEByoBqajrE0ByG/eUxCaJt70X6wt7p89/Yo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DP8EUpBnJhrMMlR35AJ4qBuW5AAWrThlGdUysZgbcoM=; b=T/GCsW0UgK3NQ3O2DJy9n4ezrfSLEysvqc5EgOImtl1B5OLuFhTl6UDOyNs4U7CpGq jpQJ4nwEIqkxW64JN99TwBkv2HAvXgqBylJ4Oed3c8EniHslhrSrMoGKr0jreLmqQtlx 1/SsxgG8Ea1u7Dpgf5zfBPGikzuq66uaXGzibxqOP9EekPWyhjpBQ/NnAarj5G99/7oQ xb6aiW5JJONnWsSOq8RpcVoHbLv6VJP2EmKv7qkIBXtwk42PWXY7cZhFFbkUK9Wqn+F3 HSN6U904xWzqNJmR4vRQs6YiSi0SwffK06xjaf+Cv3kWoJxnrns6esL6rRXQwRTawGJe IzWQ== X-Gm-Message-State: APjAAAWkXEZy13JGn0k647toOJvQTMEKufOvl0A6DkAJ5uQgAc6zUKUt r7pj7/l5mtvFvhWmrtGqh85kCQ== X-Received: by 2002:a1c:f317:: with SMTP id q23mr1976912wmq.74.1572481922962; Wed, 30 Oct 2019 17:32:02 -0700 (PDT) Received: from prevas-ravi.prevas.se (ip-5-186-115-54.cgn.fibianet.dk. [5.186.115.54]) by smtp.gmail.com with ESMTPSA id r13sm2357111wra.74.2019.10.30.17.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 17:32:02 -0700 (PDT) From: Rasmus Villemoes To: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: Christophe Leroy , Arnd Bergmann , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linux-kernel@vger.kernel.org, Rasmus Villemoes Subject: [RFC PATCH 2/5] asm-generic: employ "ifndef foo; define foo foo" idiom in iomap.h Date: Thu, 31 Oct 2019 01:31:51 +0100 Message-Id: <20191031003154.21969-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191031003154.21969-1-linux@rasmusvillemoes.dk> References: <20191031003154.21969-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make it possible for an architecture to include asm-generic/iomap.h without necessarily getting all the external declarations for iowrite32 and friends. For example, the architecture could (maybe just in some configurations) provide static inline versions of some or all of these, but still use asm-generic/iomap.h for the ARCH_HAS_IOREMAP_WT/WC logic. This will be used on powerpc. Signed-off-by: Rasmus Villemoes --- include/asm-generic/iomap.h | 94 ++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 6 deletions(-) diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h index 5f8321e8fea9..1b247d3b9fbb 100644 --- a/include/asm-generic/iomap.h +++ b/include/asm-generic/iomap.h @@ -26,47 +26,105 @@ * in the low address range. Architectures for which this is not * true can't use this generic implementation. */ +#ifndef ioread8 +#define ioread8 ioread8 extern unsigned int ioread8(void __iomem *); +#endif +#ifndef ioread16 +#define ioread16 ioread16 extern unsigned int ioread16(void __iomem *); +#endif +#ifndef ioread16be +#define ioread16be ioread16be extern unsigned int ioread16be(void __iomem *); +#endif +#ifndef ioread32 +#define ioread32 ioread32 extern unsigned int ioread32(void __iomem *); +#endif +#ifndef ioread32be +#define ioread32be ioread32be extern unsigned int ioread32be(void __iomem *); +#endif #ifdef CONFIG_64BIT +#ifndef ioread64 +#define ioread64 ioread64 extern u64 ioread64(void __iomem *); +#endif +#ifndef ioread64be +#define ioread64be ioread64be extern u64 ioread64be(void __iomem *); #endif +#endif /* CONFIG_64BIT */ #ifdef readq +#ifndef ioread64_lo_hi #define ioread64_lo_hi ioread64_lo_hi -#define ioread64_hi_lo ioread64_hi_lo -#define ioread64be_lo_hi ioread64be_lo_hi -#define ioread64be_hi_lo ioread64be_hi_lo extern u64 ioread64_lo_hi(void __iomem *addr); +#endif +#ifndef ioread64_hi_lo +#define ioread64_hi_lo ioread64_hi_lo extern u64 ioread64_hi_lo(void __iomem *addr); +#endif +#ifndef ioread64be_lo_hi +#define ioread64be_lo_hi ioread64be_lo_hi extern u64 ioread64be_lo_hi(void __iomem *addr); +#endif +#ifndef ioread64be_hi_lo +#define ioread64be_hi_lo ioread64be_hi_lo extern u64 ioread64be_hi_lo(void __iomem *addr); #endif +#endif /* readq */ +#ifndef iowrite8 +#define iowrite8 iowrite8 extern void iowrite8(u8, void __iomem *); +#endif +#ifndef iowrite16 +#define iowrite16 iowrite16 extern void iowrite16(u16, void __iomem *); +#endif +#ifndef iowrite16be +#define iowrite16be iowrite16be extern void iowrite16be(u16, void __iomem *); +#endif +#ifndef iowrite32 +#define iowrite32 iowrite32 extern void iowrite32(u32, void __iomem *); +#endif +#ifndef iowrite32be +#define iowrite32be iowrite32be extern void iowrite32be(u32, void __iomem *); +#endif #ifdef CONFIG_64BIT +#ifndef iowrite64 +#define iowrite64 iowrite64 extern void iowrite64(u64, void __iomem *); +#endif +#ifndef iowrite64be +#define iowrite64be iowrite64be extern void iowrite64be(u64, void __iomem *); #endif +#endif /* CONFIG_64BIT */ #ifdef writeq +#ifndef iowrite64_lo_hi #define iowrite64_lo_hi iowrite64_lo_hi -#define iowrite64_hi_lo iowrite64_hi_lo -#define iowrite64be_lo_hi iowrite64be_lo_hi -#define iowrite64be_hi_lo iowrite64be_hi_lo extern void iowrite64_lo_hi(u64 val, void __iomem *addr); +#endif +#ifndef iowrite64_hi_lo +#define iowrite64_hi_lo iowrite64_hi_lo extern void iowrite64_hi_lo(u64 val, void __iomem *addr); +#endif +#ifndef iowrite64be_lo_hi +#define iowrite64be_lo_hi iowrite64be_lo_hi extern void iowrite64be_lo_hi(u64 val, void __iomem *addr); +#endif +#ifndef iowrite64be_hi_lo +#define iowrite64be_hi_lo iowrite64be_hi_lo extern void iowrite64be_hi_lo(u64 val, void __iomem *addr); #endif +#endif /* writeq */ /* * "string" versions of the above. Note that they @@ -79,19 +137,43 @@ extern void iowrite64be_hi_lo(u64 val, void __iomem *addr); * memory across multiple ports, use "memcpy_toio()" * and friends. */ +#ifndef ioread8_rep +#define ioread8_rep ioread8_rep extern void ioread8_rep(void __iomem *port, void *buf, unsigned long count); +#endif +#ifndef ioread16_rep +#define ioread16_rep ioread16_rep extern void ioread16_rep(void __iomem *port, void *buf, unsigned long count); +#endif +#ifndef ioread32_rep +#define ioread32_rep ioread32_rep extern void ioread32_rep(void __iomem *port, void *buf, unsigned long count); +#endif +#ifndef iowrite8_rep +#define iowrite8_rep iowrite8_rep extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); +#endif +#ifndef iowrite16_rep +#define iowrite16_rep iowrite16_rep extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); +#endif +#ifndef iowrite32_rep +#define iowrite32_rep iowrite32_rep extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); +#endif #ifdef CONFIG_HAS_IOPORT_MAP /* Create a virtual mapping cookie for an IO port range */ +#ifndef ioport_map +#define ioport_map ioport_map extern void __iomem *ioport_map(unsigned long port, unsigned int nr); +#endif +#ifndef ioport_unmap +#define ioport_unmap ioport_unmap extern void ioport_unmap(void __iomem *); #endif +#endif /* CONFIG_HAS_IOPORT_MAP */ #ifndef ARCH_HAS_IOREMAP_WC #define ioremap_wc ioremap_nocache -- 2.23.0