Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751940AbdFZUns (ORCPT ); Mon, 26 Jun 2017 16:43:48 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:35023 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbdFZUnl (ORCPT ); Mon, 26 Jun 2017 16:43:41 -0400 MIME-Version: 1.0 In-Reply-To: <20170622164817.25515-3-logang@deltatee.com> References: <20170622164817.25515-1-logang@deltatee.com> <20170622164817.25515-3-logang@deltatee.com> From: Arnd Bergmann Date: Mon, 26 Jun 2017 22:43:40 +0200 X-Google-Sender-Auth: 1vWmnuUfcnD2wyXHpj_AJjFtcdk Message-ID: Subject: Re: [PATCH 2/7] iomap: implement ioread64 and iowrite64 To: Logan Gunthorpe Cc: Linux Kernel Mailing List , linux-arch , linux-ntb@googlegroups.com, linux-alpha@vger.kernel.org, linuxppc-dev , linux-crypto@vger.kernel.org, dri-devel , Greg Kroah-Hartman , Stephen Bates , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Suresh Warrier , Nicholas Piggin Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 919 Lines: 30 > +u64 ioread64(void __iomem *addr) > +{ > + u64 low, high; > + > + low = ioread32(addr); > + high = ioread32(addr + sizeof(u32)); > + return low | (high << 32); > +} > +u64 ioread64be(void __iomem *addr) > +{ > + u64 low, high; > + > + low = ioread32be(addr + sizeof(u32)); > + high = ioread32be(addr); > + return low | (high << 32); > +} > +#endif This hardcodes the behavior of include/linux/io-64-nonatomic-hi-lo.h, which I find rather confusing, as only about one in five drivers wants this behavior. I'd suggest you don't add it in lib/iomap.c at all for 32-bit architectures, but rather use the same logic that we have for readq/writeq in io-64-nonatomic-hi-lo.h and io-64-nonatomic-lo-hi.h, adding {lo_hi,hi_lo}_{ioread,iowrite}{,be} to the same files, and provide the {ioread,iowrite}{,be} macros only if they have not been defined at that point. Arnd