aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-11-06 16:55:27 -0500
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-11-16 03:57:38 -0500
commitd611d41b46c96195b9a168a21992782458826e07 (patch)
tree6b3acda5c25d5f424b07c85351e66da3dc6dddb0
parentca796f85901880c1247e19053d70b640f996813e (diff)
mtd: diskonchip: use inline functions for DocRead/DocWrite
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 <arnd@arndb.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r--include/linux/mtd/doc2000.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 0f6fea73a1f..407d1e556c3 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -92,12 +92,26 @@
92 * Others use readb/writeb 92 * Others use readb/writeb
93 */ 93 */
94#if defined(__arm__) 94#if defined(__arm__)
95#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)))) 95static inline u8 ReadDOC_(u32 __iomem *addr, unsigned long reg)
96#define WriteDOC_(d, adr, reg) do{ *(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)) = (__u32)d; wmb();} while(0) 96{
97 return __raw_readl(addr + reg);
98}
99static inline void WriteDOC_(u8 data, u32 __iomem *addr, unsigned long reg)
100{
101 __raw_writel(data, addr + reg);
102 wmb();
103}
97#define DOC_IOREMAP_LEN 0x8000 104#define DOC_IOREMAP_LEN 0x8000
98#elif defined(__ppc__) 105#elif defined(__ppc__)
99#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)))) 106static inline u8 ReadDOC_(u16 __iomem *addr, unsigned long reg)
100#define WriteDOC_(d, adr, reg) do{ *(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)) = (__u16)d; wmb();} while(0) 107{
108 return __raw_readw(addr + reg);
109}
110static inline void WriteDOC_(u8 data, u16 __iomem *addr, unsigned long reg)
111{
112 __raw_writew(data, addr + reg);
113 wmb();
114}
101#define DOC_IOREMAP_LEN 0x4000 115#define DOC_IOREMAP_LEN 0x4000
102#else 116#else
103#define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg)) 117#define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg))