linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mips/kgdb: prepare arch_kgdb_ops for constness
@ 2018-12-06 20:07 Christophe Leroy
  2018-12-06 20:07 ` [PATCH v2 2/2] kgdb/treewide: constify struct kgdb_arch arch_kgdb_ops Christophe Leroy
  2018-12-19 16:57 ` [PATCH v2 1/2] mips/kgdb: prepare arch_kgdb_ops for constness Daniel Thompson
  0 siblings, 2 replies; 6+ messages in thread
From: Christophe Leroy @ 2018-12-06 20:07 UTC (permalink / raw)
  To: Vineet Gupta, Russell King, Catalin Marinas, Will Deacon,
	Yoshinori Sato, Richard Kuo, Michal Simek, Ralf Baechle,
	Paul Burton, James Hogan, Ley Foon Tan, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Rich Felker, David S. Miller,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86, Jason Wessel,
	Daniel Thompson, GitAuthor: Christophe Leroy, Douglas Anderson,
	Randy Dunlap, Gustavo A. R. Silva
  Cc: linux-snps-arc, linux-kernel, linux-arm-kernel, uclinux-h8-devel,
	linux-hexagon, linux-mips, nios2-dev, linuxppc-dev, linux-sh,
	sparclinux, kgdb-bugreport

MIPS is the only architecture modifying arch_kgdb_ops during init.
This patch makes the init static, so that it can be changed to
const in following patch, as recommended by checkpatch.pl

Suggested-by: Paul Burton <paul.burton@mips.com>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 v2: Added acks from Daniel and Paul.

 arch/mips/kernel/kgdb.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index eb6c0d582626..31eff1bec577 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -394,18 +394,16 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
 	return -1;
 }
 
-struct kgdb_arch arch_kgdb_ops;
+struct kgdb_arch arch_kgdb_ops = {
+#ifdef CONFIG_CPU_BIG_ENDIAN
+	.gdb_bpt_instr = { spec_op << 2, 0x00, 0x00, break_op },
+#else
+	.gdb_bpt_instr = { break_op, 0x00, 0x00, spec_op << 2 },
+#endif
+};
 
 int kgdb_arch_init(void)
 {
-	union mips_instruction insn = {
-		.r_format = {
-			.opcode = spec_op,
-			.func	= break_op,
-		}
-	};
-	memcpy(arch_kgdb_ops.gdb_bpt_instr, insn.byte, BREAK_INSTR_SIZE);
-
 	register_die_notifier(&kgdb_notifier);
 
 	return 0;
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-19 16:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 20:07 [PATCH v2 1/2] mips/kgdb: prepare arch_kgdb_ops for constness Christophe Leroy
2018-12-06 20:07 ` [PATCH v2 2/2] kgdb/treewide: constify struct kgdb_arch arch_kgdb_ops Christophe Leroy
2018-12-06 21:12   ` Borislav Petkov
2018-12-07 11:15   ` Michael Ellerman
2018-12-19 16:57   ` Daniel Thompson
2018-12-19 16:57 ` [PATCH v2 1/2] mips/kgdb: prepare arch_kgdb_ops for constness Daniel Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).