linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: traps_misaligned: do not duplicate stringify
@ 2022-06-23 11:29 Krzysztof Kozlowski
  2022-06-23 13:11 ` Anup Patel
  2022-08-11 15:45 ` Palmer Dabbelt
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-23 11:29 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv, linux-kernel
  Cc: Krzysztof Kozlowski

Use existing stringify macro from the kernel headers.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 arch/riscv/kernel/traps_misaligned.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c
index 46c4dafe3ba0..378f5b151443 100644
--- a/arch/riscv/kernel/traps_misaligned.c
+++ b/arch/riscv/kernel/traps_misaligned.c
@@ -7,6 +7,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/irq.h>
+#include <linux/stringify.h>
 
 #include <asm/processor.h>
 #include <asm/ptrace.h>
@@ -150,9 +151,6 @@
 #define PRECISION_S 0
 #define PRECISION_D 1
 
-#define STR(x) XSTR(x)
-#define XSTR(x) #x
-
 #define DECLARE_UNPRIVILEGED_LOAD_FUNCTION(type, insn)			\
 static inline type load_##type(const type *addr)			\
 {									\
@@ -207,9 +205,9 @@ static inline ulong get_insn(ulong mepc)
 	asm ("and %[tmp], %[addr], 2\n"
 		"bnez %[tmp], 1f\n"
 #if defined(CONFIG_64BIT)
-		STR(LWU) " %[insn], (%[addr])\n"
+		__stringify(LWU) " %[insn], (%[addr])\n"
 #else
-		STR(LW) " %[insn], (%[addr])\n"
+		__stringify(LW) " %[insn], (%[addr])\n"
 #endif
 		"and %[tmp], %[insn], %[rvc_mask]\n"
 		"beq %[tmp], %[rvc_mask], 2f\n"
-- 
2.34.1


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

* Re: [PATCH] riscv: traps_misaligned: do not duplicate stringify
  2022-06-23 11:29 [PATCH] riscv: traps_misaligned: do not duplicate stringify Krzysztof Kozlowski
@ 2022-06-23 13:11 ` Anup Patel
  2022-07-21 16:02   ` Krzysztof Kozlowski
  2022-08-11 15:45 ` Palmer Dabbelt
  1 sibling, 1 reply; 4+ messages in thread
From: Anup Patel @ 2022-06-23 13:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
	linux-kernel@vger.kernel.org List

On Thu, Jun 23, 2022 at 4:59 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> Use existing stringify macro from the kernel headers.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
>  arch/riscv/kernel/traps_misaligned.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c
> index 46c4dafe3ba0..378f5b151443 100644
> --- a/arch/riscv/kernel/traps_misaligned.c
> +++ b/arch/riscv/kernel/traps_misaligned.c
> @@ -7,6 +7,7 @@
>  #include <linux/mm.h>
>  #include <linux/module.h>
>  #include <linux/irq.h>
> +#include <linux/stringify.h>
>
>  #include <asm/processor.h>
>  #include <asm/ptrace.h>
> @@ -150,9 +151,6 @@
>  #define PRECISION_S 0
>  #define PRECISION_D 1
>
> -#define STR(x) XSTR(x)
> -#define XSTR(x) #x
> -
>  #define DECLARE_UNPRIVILEGED_LOAD_FUNCTION(type, insn)                 \
>  static inline type load_##type(const type *addr)                       \
>  {                                                                      \
> @@ -207,9 +205,9 @@ static inline ulong get_insn(ulong mepc)
>         asm ("and %[tmp], %[addr], 2\n"
>                 "bnez %[tmp], 1f\n"
>  #if defined(CONFIG_64BIT)
> -               STR(LWU) " %[insn], (%[addr])\n"
> +               __stringify(LWU) " %[insn], (%[addr])\n"
>  #else
> -               STR(LW) " %[insn], (%[addr])\n"
> +               __stringify(LW) " %[insn], (%[addr])\n"
>  #endif
>                 "and %[tmp], %[insn], %[rvc_mask]\n"
>                 "beq %[tmp], %[rvc_mask], 2f\n"
> --
> 2.34.1
>

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

* Re: [PATCH] riscv: traps_misaligned: do not duplicate stringify
  2022-06-23 13:11 ` Anup Patel
@ 2022-07-21 16:02   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2022-07-21 16:02 UTC (permalink / raw)
  To: Palmer Dabbelt, Paul Walmsley
  Cc: Albert Ou, linux-riscv, linux-kernel@vger.kernel.org List, Anup Patel

On 23/06/2022 15:11, Anup Patel wrote:
> On Thu, Jun 23, 2022 at 4:59 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> Use existing stringify macro from the kernel headers.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> Looks good to me.
> 
> Reviewed-by: Anup Patel <anup@brainfault.org>
> 

Thanks!

Any other comments or reviews? This was sent a month ago, so maybe it
could be merged?


Best regards,
Krzysztof

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

* Re: [PATCH] riscv: traps_misaligned: do not duplicate stringify
  2022-06-23 11:29 [PATCH] riscv: traps_misaligned: do not duplicate stringify Krzysztof Kozlowski
  2022-06-23 13:11 ` Anup Patel
@ 2022-08-11 15:45 ` Palmer Dabbelt
  1 sibling, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2022-08-11 15:45 UTC (permalink / raw)
  To: krzysztof.kozlowski
  Cc: Paul Walmsley, aou, linux-riscv, linux-kernel, krzysztof.kozlowski

On Thu, 23 Jun 2022 04:29:05 PDT (-0700), krzysztof.kozlowski@linaro.org wrote:
> Use existing stringify macro from the kernel headers.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  arch/riscv/kernel/traps_misaligned.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c
> index 46c4dafe3ba0..378f5b151443 100644
> --- a/arch/riscv/kernel/traps_misaligned.c
> +++ b/arch/riscv/kernel/traps_misaligned.c
> @@ -7,6 +7,7 @@
>  #include <linux/mm.h>
>  #include <linux/module.h>
>  #include <linux/irq.h>
> +#include <linux/stringify.h>
>
>  #include <asm/processor.h>
>  #include <asm/ptrace.h>
> @@ -150,9 +151,6 @@
>  #define PRECISION_S 0
>  #define PRECISION_D 1
>
> -#define STR(x) XSTR(x)
> -#define XSTR(x) #x
> -
>  #define DECLARE_UNPRIVILEGED_LOAD_FUNCTION(type, insn)			\
>  static inline type load_##type(const type *addr)			\
>  {									\
> @@ -207,9 +205,9 @@ static inline ulong get_insn(ulong mepc)
>  	asm ("and %[tmp], %[addr], 2\n"
>  		"bnez %[tmp], 1f\n"
>  #if defined(CONFIG_64BIT)
> -		STR(LWU) " %[insn], (%[addr])\n"
> +		__stringify(LWU) " %[insn], (%[addr])\n"
>  #else
> -		STR(LW) " %[insn], (%[addr])\n"
> +		__stringify(LW) " %[insn], (%[addr])\n"
>  #endif
>  		"and %[tmp], %[insn], %[rvc_mask]\n"
>  		"beq %[tmp], %[rvc_mask], 2f\n"

Thanks, this is on for-next.

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

end of thread, other threads:[~2022-08-11 15:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 11:29 [PATCH] riscv: traps_misaligned: do not duplicate stringify Krzysztof Kozlowski
2022-06-23 13:11 ` Anup Patel
2022-07-21 16:02   ` Krzysztof Kozlowski
2022-08-11 15:45 ` Palmer Dabbelt

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).