From patchwork Wed Mar 8 13:07:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13165702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB749C742A7 for ; Wed, 8 Mar 2023 13:08:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AF2F6B007D; Wed, 8 Mar 2023 08:08:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 75D9A6B007E; Wed, 8 Mar 2023 08:08:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 625DD280001; Wed, 8 Mar 2023 08:08:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5406A6B007D for ; Wed, 8 Mar 2023 08:08:01 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 28977809E9 for ; Wed, 8 Mar 2023 13:08:01 +0000 (UTC) X-FDA: 80545758762.22.73930C8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id B92DE100025 for ; Wed, 8 Mar 2023 13:07:57 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eZzpjABt; spf=pass (imf14.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678280879; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gLq762oeic7hM/krtcOf8E8H5QTsFuEhCmd4UZ/jjZs=; b=XLHzHbgmxrCJ8vED9VZ1wcrFmyJD25k0rtv0Bc3MIjFuTHBLxCFYgZj87MemL8d9WVFg6R KNnQs01UKIVWy7nM8sI2lRTwsuYIoC5skFpzoXxrT3EoNI1EQg4fz2O+0vBn0PnHmsYjyf 3P6O0wDeA4dfTEZF6KOwphEGPpIXi78= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eZzpjABt; spf=pass (imf14.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678280879; a=rsa-sha256; cv=none; b=hPUt2xpehHImGEPI41O3PANgaBA841JtcavbSE2OvW0LK3FgCIE08wPMMnI4fASG4Qlrws u8nF4BpZFCLGYlR84adgdpkOmRjOHy3qrRa7Wx4mFUVXk8cacmxlVkefXQZ48g/JjW5mIK IEKu6JvTIcYXAbt8rH6n6IJFBl6haeI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678280877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gLq762oeic7hM/krtcOf8E8H5QTsFuEhCmd4UZ/jjZs=; b=eZzpjABtRrRU8+oZ/VUrqtSUll8ZUnDa71/WcbEEVEgj//WxqiepNsm9gkvR33ovyDb9uJ zEW8vhrtVf8enDLAwb+b/qU+ljE0yxh/F8aMyM9qOe5ix1c82eyZtFLap+gFZvxfCyRF+f QB56ZuwBkkqyS4otGoCAZZVjD9U7j5Q= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-uSFGI7sxPSKXvm-FACyRDg-1; Wed, 08 Mar 2023 08:07:51 -0500 X-MC-Unique: uSFGI7sxPSKXvm-FACyRDg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 505EC2932493; Wed, 8 Mar 2023 13:07:50 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-137.pek2.redhat.com [10.72.12.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CAD02166B26; Wed, 8 Mar 2023 13:07:42 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de, mpe@ellerman.id.au, geert@linux-m68k.org, mcgrof@kernel.org, hch@infradead.org, Baoquan He , Thomas Bogendoerfer , Helge Deller , Serge Semin , Florian Fainelli , Huacai Chen , Jiaxun Yang , linux-mips@vger.kernel.org Subject: [PATCH v4 4/4] mips: io: remove duplicated codes Date: Wed, 8 Mar 2023 21:07:10 +0800 Message-Id: <20230308130710.368085-5-bhe@redhat.com> In-Reply-To: <20230308130710.368085-1-bhe@redhat.com> References: <20230308130710.368085-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B92DE100025 X-Rspam-User: X-Stat-Signature: 49j7s9n9ixpm3xc76punn7nifyybh5ha X-HE-Tag: 1678280877-219382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KQqdzDIyLyG66s8Xb6BbSg2eglzJoPI5mDVGiz6xS0mujLwbSkYhHozkNecl7LydnoO6osGzvxKUnXs5hArtrHZGgVefU1+AgR33EalDi+1+vy9DwZAu0G57lQpfaseQVl/enyWE0T9sgDnT9Pm8oRtfCOsd100aBPSUtnlersoJWaPIbB1/XSjiXktGWyzWXew4L4b3VscnYpZ88K2/NBPF60Qtj8Gb021fyJGmDg49D9svoL22gVlQNoA0+VnJNYFJQLfjln0C462MF+eTOA0YXlHL80/18/le7wNF8mch4U5ZqPDQtOSKhYxUKgHBfwM0NkB29NUp4Rd7vTihDrnZtm7dPpzHjDnSMJHrZ6O4W/m9rlLHkzmAgSykS8SwF108PqqVbbRD0xoUageKDUzVO2A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: By adding asm-generic/io.h support, there are some duplicated function implementation, like phys_to_virt, memset_io, memcpy_(from|to)io. Let's remove them to use the default version in asm-neneric/io.h. Meanwhile move isa_bus_to_virt() down below including line to fix the compiling error of missing phys_to_virt definition. Signed-off-by: Baoquan He Cc: Thomas Bogendoerfer Cc: Geert Uytterhoeven Cc: Helge Deller Cc: Serge Semin Cc: Florian Fainelli Cc: Huacai Chen Cc: Jiaxun Yang Cc: linux-mips@vger.kernel.org --- arch/mips/include/asm/io.h | 45 +++++--------------------------------- 1 file changed, 5 insertions(+), 40 deletions(-) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index da0a625c3c6d..1b38f02bc608 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -114,24 +114,6 @@ static inline phys_addr_t virt_to_phys(const volatile void *x) return __virt_to_phys(x); } -/* - * phys_to_virt - map physical address to virtual - * @address: address to remap - * - * The returned virtual address is a current CPU mapping for - * the memory address given. It is only valid to use this function on - * addresses that have a kernel mapping - * - * This function does not handle bus mappings for DMA transfers. In - * almost all conceivable cases a device driver should not be using - * this function - */ -#define phys_to_virt phys_to_virt -static inline void * phys_to_virt(unsigned long address) -{ - return __va(address); -} - /* * ISA I/O bus memory addresses are 1:1 with the physical address. */ @@ -140,11 +122,6 @@ static inline unsigned long isa_virt_to_bus(volatile void *address) return virt_to_phys(address); } -static inline void *isa_bus_to_virt(unsigned long address) -{ - return phys_to_virt(address); -} - /* * Change "struct page" to physical address. */ @@ -535,23 +512,6 @@ BUILDSTRING(q, u64) #define writesq writesq #endif - -#define memset_io memset_io -static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) -{ - memset((void __force *) addr, val, count); -} -#define memcpy_fromio memcpy_fromio -static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) -{ - memcpy(dst, (void __force *) src, count); -} -#define memcpy_toio memcpy_toio -static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) -{ - memcpy((void __force *) dst, src, count); -} - /* * The caches on some architectures aren't dma-coherent and have need to * handle this in software. There are three types of operations that @@ -617,4 +577,9 @@ void __ioread64_copy(void *to, const void __iomem *from, size_t count); #include +static inline void *isa_bus_to_virt(unsigned long address) +{ + return phys_to_virt(address); +} + #endif /* _ASM_IO_H */