From: 黄涛 Date: Thu, 12 May 2011 11:12:58 +0000 (+0800) Subject: rk29: pl330: avoid unaligned accesses X-Git-Tag: firefly_0821_release~10330 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ac682a0749c3e007956e510e13f3ae10eac88297;p=firefly-linux-kernel-4.4.55.git rk29: pl330: avoid unaligned accesses --- diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c index 27098b722da2..8bc5c6a89138 100644 --- a/arch/arm/common/pl330.c +++ b/arch/arm/common/pl330.c @@ -28,6 +28,7 @@ #include #include +#include #include /* Register and Bit field Definitions */ @@ -394,7 +395,7 @@ static inline u32 _emit_ADDH(unsigned dry_run, u8 buf[], buf[0] = CMD_DMAADDH; buf[0] |= (da << 1); - *((u16 *)&buf[1]) = val; + put_unaligned(val, (u16 *)&buf[1]); //*((u16 *)&buf[1]) = val; PL330_DBGCMD_DUMP(SZ_DMAADDH, "\tDMAADDH %s %u\n", da == 1 ? "DA" : "SA", val); @@ -548,7 +549,7 @@ static inline u32 _emit_MOV(unsigned dry_run, u8 buf[], buf[0] = CMD_DMAMOV; buf[1] = dst; - *((u32 *)&buf[2]) = val; + put_unaligned(val, (u32 *)&buf[2]); //*((u32 *)&buf[2]) = val; PL330_DBGCMD_DUMP(SZ_DMAMOV, "\tDMAMOV %s 0x%x\n", dst == SAR ? "SAR" : (dst == DAR ? "DAR" : "CCR"), val); @@ -726,7 +727,7 @@ static inline u32 _emit_GO(unsigned dry_run, u8 buf[], buf[1] = chan & 0x7; - *((u32 *)&buf[2]) = addr; + put_unaligned(addr, (u32 *)&buf[2]); //*((u32 *)&buf[2]) = addr; return SZ_DMAGO; }