Blackfin: add bfin_write_{or,and} helpers
authorMike Frysinger <vapier@gentoo.org>
Tue, 11 Jan 2011 16:33:15 +0000 (16:33 +0000)
committerMike Frysinger <vapier@gentoo.org>
Fri, 18 Mar 2011 07:49:24 +0000 (03:49 -0400)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/include/asm/def_LPBlackfin.h

index e3f0f4c49819e4a0d3823d6344f71fbf61a2ffc6..7600fe0696af1c9cda33471b1bf8a963e43df303 100644 (file)
     ({ BUG(); 0; }); \
 })
 #define bfin_write(addr, val) \
-({ \
+do { \
        switch (sizeof(*(addr))) { \
        case 1: bfin_write8(addr, val);  break; \
        case 2: bfin_write16(addr, val); break; \
        case 4: bfin_write32(addr, val); break; \
        default: BUG(); \
        } \
-})
+} while (0)
+
+#define bfin_write_or(addr, bits) \
+do { \
+       void *__addr = (void *)(addr); \
+       bfin_write(__addr, bfin_read(__addr) | (bits)); \
+} while (0)
+
+#define bfin_write_and(addr, bits) \
+do { \
+       void *__addr = (void *)(addr); \
+       bfin_write(__addr, bfin_read(__addr) & (bits)); \
+} while (0)
 
 #endif /* __ASSEMBLY__ */