From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761052Ab3BLA0c (ORCPT ); Mon, 11 Feb 2013 19:26:32 -0500 Received: from gate.crashing.org ([63.228.1.57]:52512 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760687Ab3BLA0b (ORCPT ); Mon, 11 Feb 2013 19:26:31 -0500 Message-ID: <1360628726.17442.19.camel@pasglop> Subject: Re: [PATCH] drivers/block/xsysace - replace in(out)_8/in(out)_be16/in(out)_le16 with generic iowrite(read)8/16(be) From: Benjamin Herrenschmidt To: Michal Simek Cc: Arnd Bergmann , Geert Uytterhoeven , Grant Likely , Alexey Brodkin , Vineet Gupta , Linux Kernel Mailing List , Alan Cox , dahinds@users.sourceforge.net Date: Tue, 12 Feb 2013 11:25:26 +1100 In-Reply-To: References: <1359475380-31512-1-git-send-email-abrodkin@synopsys.com> <201302111526.37892.arnd@arndb.de> <201302111543.46196.arnd@arndb.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.6.2-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2013-02-11 at 16:57 +0100, Michal Simek wrote: > But it reminds me that maybe the easiest solution is not to use endian > accessors just use two simple macros which should work on all systems. > > #define _readreg(offset) ({__raw_readl(offset); rmb(); }) > #define _writereg(offset, val) ({wmb(); __raw_writel(val, offset); }) > > which is probably the faster solution which add minimum additional code > to driver and can also remove endian detection code. Except that rmb & wmb might not be the right barriers for IOs ... Cheers, Ben.