From: Mike Frysinger Date: Tue, 11 Jan 2011 16:33:15 +0000 (+0000) Subject: Blackfin: add bfin_write_{or,and} helpers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b5fc12df9039a9e6a2c5ae1fc0cee244b6aca8e2;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Blackfin: add bfin_write_{or,and} helpers Signed-off-by: Mike Frysinger --- diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h index e3f0f4c49819..7600fe0696af 100644 --- a/arch/blackfin/include/asm/def_LPBlackfin.h +++ b/arch/blackfin/include/asm/def_LPBlackfin.h @@ -58,14 +58,26 @@ ({ 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__ */