Skip to content

Commit f05523a

Browse files
committed
ARC: fpu: declutter code, move bits out into fpu.h
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent bd71c45 commit f05523a

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
lines changed

arch/arc/include/asm/fpu.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
4+
*
5+
*/
6+
7+
#ifndef _ASM_ARC_FPU_H
8+
#define _ASM_ARC_FPU_H
9+
10+
#ifdef CONFIG_ARC_FPU_SAVE_RESTORE
11+
12+
#include <asm/ptrace.h>
13+
14+
/* These DPFP regs need to be saved/restored across ctx-sw */
15+
struct arc_fpu {
16+
struct {
17+
unsigned int l, h;
18+
} aux_dpfp[2];
19+
};
20+
21+
extern void fpu_save_restore(struct task_struct *p, struct task_struct *n);
22+
23+
#else
24+
25+
#define fpu_save_restore(p, n)
26+
27+
#endif /* CONFIG_ARC_FPU_SAVE_RESTORE */
28+
29+
#endif /* _ASM_ARC_FPU_H */

arch/arc/include/asm/processor.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,7 @@
1414
#ifndef __ASSEMBLY__
1515

1616
#include <asm/ptrace.h>
17-
18-
#ifdef CONFIG_ARC_FPU_SAVE_RESTORE
19-
/* These DPFP regs need to be saved/restored across ctx-sw */
20-
struct arc_fpu {
21-
struct {
22-
unsigned int l, h;
23-
} aux_dpfp[2];
24-
};
25-
#endif
17+
#include <asm/fpu.h>
2618

2719
#ifdef CONFIG_ARC_PLAT_EZNPS
2820
struct eznps_dp {

arch/arc/include/asm/switch_to.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,7 @@
99
#ifndef __ASSEMBLY__
1010

1111
#include <linux/sched.h>
12-
13-
#ifdef CONFIG_ARC_FPU_SAVE_RESTORE
14-
15-
extern void fpu_save_restore(struct task_struct *p, struct task_struct *n);
16-
#define ARC_FPU_PREV(p, n) fpu_save_restore(p, n)
17-
#define ARC_FPU_NEXT(t)
18-
19-
#else
20-
21-
#define ARC_FPU_PREV(p, n)
22-
#define ARC_FPU_NEXT(n)
23-
24-
#endif /* !CONFIG_ARC_FPU_SAVE_RESTORE */
12+
#include <asm/fpu.h>
2513

2614
#ifdef CONFIG_ARC_PLAT_EZNPS
2715
extern void dp_save_restore(struct task_struct *p, struct task_struct *n);
@@ -36,9 +24,8 @@ struct task_struct *__switch_to(struct task_struct *p, struct task_struct *n);
3624
#define switch_to(prev, next, last) \
3725
do { \
3826
ARC_EZNPS_DP_PREV(prev, next); \
39-
ARC_FPU_PREV(prev, next); \
27+
fpu_save_restore(prev, next); \
4028
last = __switch_to(prev, next);\
41-
ARC_FPU_NEXT(next); \
4229
mb(); \
4330
} while (0)
4431

arch/arc/kernel/fpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
#include <linux/sched.h>
9-
#include <asm/switch_to.h>
9+
#include <asm/fpu.h>
1010

1111
/*
1212
* To save/restore FPU regs, simplest scheme would use LR/SR insns.

0 commit comments

Comments
 (0)