From patchwork Tue Nov 6 21:55:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12704 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5627023E00 for ; Tue, 6 Nov 2012 21:55:58 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 017B2A18710 for ; Tue, 6 Nov 2012 21:55:57 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so618566iag.11 for ; Tue, 06 Nov 2012 13:55:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-provags-id:x-gm-message-state; bh=49trp3/lTD0stId9kM6REV3nyNQ+j+8RXfEG4+6rjng=; b=oW5m6sNqG3siRrQXKhsOCjHHRHO/ricO2NlsPEKFNe0d7P2Juw/MgzeO/tPkN6HLjd CpWtcGz2I3oNuwHLOcJz4+6L/ADBE/0XmjnRHPaox8Jol/h/JnZMguBTU4DKhLbkBOhb AZSqSadJvNg0C92IRjIReLwrZusazuujCUQXjsajRttl/d//eztAAMK4MVMJR7t6y7Eg SP00pRrhgjXcq46gBx0vPhDvEwTmpmr8kyKmS0UPjrW3OKfKWCMAJCadW3y8V0gcYyI3 y11ZRAeHRhD6yqxCwg81Pw8J3poBhIu2cym53awnT6FX4QdAU2Zqksp8V7doy4m4Vev4 qkUg== Received: by 10.50.91.195 with SMTP id cg3mr14582105igb.57.1352238957755; Tue, 06 Nov 2012 13:55:57 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp114530igt; Tue, 6 Nov 2012 13:55:57 -0800 (PST) Received: by 10.14.173.195 with SMTP id v43mr7639873eel.39.1352238956617; Tue, 06 Nov 2012 13:55:56 -0800 (PST) Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.126.187]) by mx.google.com with ESMTPS id z46si14373240eeo.4.2012.11.06.13.55.56 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Nov 2012 13:55:56 -0800 (PST) Received-SPF: neutral (google.com: 212.227.126.187 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.126.187; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.227.126.187 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mail=arnd@arndb.de Received: from localhost.localdomain (HSI-KBW-149-172-5-253.hsi13.kabel-badenwuerttemberg.de [149.172.5.253]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0M2Wmb-1TF0Yb1WHl-00ryFa; Tue, 06 Nov 2012 22:55:40 +0100 From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , David Woodhouse , Artem Bityutskiy , linux-mtd@lists.infradead.org Subject: [PATCH 2/8] mtd: diskonchip: use inline functions for DocRead/DocWrite Date: Tue, 6 Nov 2012 22:55:27 +0100 Message-Id: <1352238933-4886-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1352238933-4886-1-git-send-email-arnd@arndb.de> References: <1352238933-4886-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:j4mQo1ldyP1BbZvo8WfNWDjUWTVvKfnJuxh4OuqeALG MT3FZF1vR8D+sG2pQHqL9bulhM499WjyO99Otpv46bEw6dD1ue FtwkTpZbuJ4X6snzr2hjwAPBlqlYlVSz2L+S+eTzPzSO2F5V2s fhFq86HQun6bfNHvfW/sqf+Dq6pBlzbWeznZk86u4aD8OqSGMN RgwjqIAm43+0MYihuBmlyOvPKpjuuqlvDRylzUCKu8dv9qOp5o N1DGRJVtuxjnQtwCWehBUlnETvTl28t6/KRa+hNuG2jgD6/Fa0 QQvM021o24fwivHQAhzAtSJYdgv2O0wSdSI/ASBfuI2zW4K2Lu cctlIiIZPkcM5uVKNXF05+PLAVROuC/HVMfc+aRTF7tPwX0bFe 6RcfiTDooAEpw== X-Gm-Message-State: ALoCoQkl5KoW+ZBxNrw6LulldL0yWAvswSKonEe8XeasF5wS/R0FzH7STh25rGdmeHZt4jnjY+qZ The diskonchip drivers traditionally use home-grown macros for doing MMIO accesses, which cause a lot of warnings, at least on ARM machines: drivers/mtd/devices/doc2000.c: In function 'doc_write': drivers/mtd/devices/doc2000.c:854:5: warning: value computed is not used [-Wunused-value] drivers/mtd/devices/doc2000.c: In function 'doc_erase': drivers/mtd/devices/doc2000.c:1123:5: warning: value computed is not used [-Wunused-value drivers/mtd/nand/diskonchip.c: In function 'doc2000_read_byte': drivers/mtd/nand/diskonchip.c:318:3: warning: value computed is not used [-Wunused-value] A nicer solution is to use the architecture-defined I/O accessors. Here, we use the __raw_readl/__raw_writel style, instead of the proper readl/writel ones, in order to preserve the odd semantics of the existing macros that have their own barrier implementation and no byte swap. It would be nice to fix this properly and use the correct accessors as well as make the word size independent from the architecture, but I guess the hardware is obsolete enough that we should better not mess the driver an more than necessary. Signed-off-by: Arnd Bergmann Cc: David Woodhouse Cc: Artem Bityutskiy Cc: linux-mtd@lists.infradead.org --- include/linux/mtd/doc2000.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h index 0f6fea7..407d1e5 100644 --- a/include/linux/mtd/doc2000.h +++ b/include/linux/mtd/doc2000.h @@ -92,12 +92,26 @@ * Others use readb/writeb */ #if defined(__arm__) -#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)))) -#define WriteDOC_(d, adr, reg) do{ *(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)) = (__u32)d; wmb();} while(0) +static inline u8 ReadDOC_(u32 __iomem *addr, unsigned long reg) +{ + return __raw_readl(addr + reg); +} +static inline void WriteDOC_(u8 data, u32 __iomem *addr, unsigned long reg) +{ + __raw_writel(data, addr + reg); + wmb(); +} #define DOC_IOREMAP_LEN 0x8000 #elif defined(__ppc__) -#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)))) -#define WriteDOC_(d, adr, reg) do{ *(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)) = (__u16)d; wmb();} while(0) +static inline u8 ReadDOC_(u16 __iomem *addr, unsigned long reg) +{ + return __raw_readw(addr + reg); +} +static inline void WriteDOC_(u8 data, u16 __iomem *addr, unsigned long reg) +{ + __raw_writew(data, addr + reg); + wmb(); +} #define DOC_IOREMAP_LEN 0x4000 #else #define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg))