Skip to content

Commit c8ee610

Browse files
committed
ARC: uaccess: elide unaliged handling if hardware supports
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
1 parent f798f91 commit c8ee610

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

arch/arc/include/asm/uaccess.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n)
146146
if (n == 0)
147147
return 0;
148148

149-
/* unaligned */
150-
if (((unsigned long)to & 0x3) || ((unsigned long)from & 0x3)) {
149+
/* fallback for unaligned access when hardware doesn't support */
150+
if (!IS_ENABLED(CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS) &&
151+
(((unsigned long)to & 0x3) || ((unsigned long)from & 0x3))) {
151152

152153
unsigned char tmp;
153154

@@ -373,8 +374,9 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
373374
if (n == 0)
374375
return 0;
375376

376-
/* unaligned */
377-
if (((unsigned long)to & 0x3) || ((unsigned long)from & 0x3)) {
377+
/* fallback for unaligned access when hardware doesn't support */
378+
if (!IS_ENABLED(CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS) &&
379+
(((unsigned long)to & 0x3) || ((unsigned long)from & 0x3))) {
378380

379381
unsigned char tmp;
380382

0 commit comments

Comments
 (0)