linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] tty/sysrq: change the definition of sysrq_key_table's element to make it more readable
@ 2022-04-05 15:36 wujunwen
  2022-04-06  9:57 ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: wujunwen @ 2022-04-05 15:36 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, wujunwen

the definition of sysrq_key_table's elements, like sysrq_thaw_op and 
sysrq_showallcpus_op are massive, so we should make it consistent.

Signed-off-by: wujunwen <wudaemon@163.com>
---
 drivers/tty/sysrq.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index bbfd004449b5..9485156bf48b 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -274,6 +274,8 @@ static const struct sysrq_key_op sysrq_showallcpus_op = {
 	.action_msg	= "Show backtrace of all active CPUs",
 	.enable_mask	= SYSRQ_ENABLE_DUMP,
 };
+#else
+#define sysrq_showallcpus_op (*(const struct sysrq_key_op *)NULL)
 #endif
 
 static void sysrq_handle_showregs(int key)
@@ -405,6 +407,7 @@ static const struct sysrq_key_op sysrq_moom_op = {
 	.enable_mask	= SYSRQ_ENABLE_SIGNAL,
 };
 
+#ifdef CONFIG_BLOCK
 static void sysrq_handle_thaw(int key)
 {
 	emergency_thaw_all();
@@ -415,6 +418,9 @@ static const struct sysrq_key_op sysrq_thaw_op = {
 	.action_msg	= "Emergency Thaw of all frozen filesystems",
 	.enable_mask	= SYSRQ_ENABLE_SIGNAL,
 };
+#else
+#define sysrq_thaw_op (*(const struct sysrq_key_op *)NULL)
+#endif
 
 static void sysrq_handle_kill(int key)
 {
@@ -468,17 +474,9 @@ static const struct sysrq_key_op *sysrq_key_table[62] = {
 	NULL,				/* g */
 	NULL,				/* h - reserved for help */
 	&sysrq_kill_op,			/* i */
-#ifdef CONFIG_BLOCK
 	&sysrq_thaw_op,			/* j */
-#else
-	NULL,				/* j */
-#endif
 	&sysrq_SAK_op,			/* k */
-#ifdef CONFIG_SMP
 	&sysrq_showallcpus_op,		/* l */
-#else
-	NULL,				/* l */
-#endif
 	&sysrq_showmem_op,		/* m */
 	&sysrq_unrt_op,			/* n */
 	/* o: This will often be registered as 'Off' at init time */
-- 
2.25.1


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

* Re: [PATCH v1] tty/sysrq: change the definition of sysrq_key_table's element to make it more readable
  2022-04-05 15:36 [PATCH v1] tty/sysrq: change the definition of sysrq_key_table's element to make it more readable wujunwen
@ 2022-04-06  9:57 ` Jiri Slaby
  2022-04-10  8:01   ` Junwen Wu
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2022-04-06  9:57 UTC (permalink / raw)
  To: wujunwen, gregkh; +Cc: linux-kernel

Hi,

On 05. 04. 22, 17:36, wujunwen wrote:
> the definition of sysrq_key_table's elements, like sysrq_thaw_op and

The starts the sentence, so should be with capital T.

> sysrq_showallcpus_op are massive,

massive?

> so we should make it consistent.

You should elaborate consistent to what.

> Signed-off-by: wujunwen <wudaemon@163.com>

Is this really your real full name?

Other than that, the patch appears to be correct.

>   drivers/tty/sysrq.c | 14 ++++++--------
>   1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index bbfd004449b5..9485156bf48b 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -274,6 +274,8 @@ static const struct sysrq_key_op sysrq_showallcpus_op = {
>   	.action_msg	= "Show backtrace of all active CPUs",
>   	.enable_mask	= SYSRQ_ENABLE_DUMP,
>   };
> +#else
> +#define sysrq_showallcpus_op (*(const struct sysrq_key_op *)NULL)
>   #endif
>   
>   static void sysrq_handle_showregs(int key)
> @@ -405,6 +407,7 @@ static const struct sysrq_key_op sysrq_moom_op = {
>   	.enable_mask	= SYSRQ_ENABLE_SIGNAL,
>   };
>   
> +#ifdef CONFIG_BLOCK
>   static void sysrq_handle_thaw(int key)
>   {
>   	emergency_thaw_all();
> @@ -415,6 +418,9 @@ static const struct sysrq_key_op sysrq_thaw_op = {
>   	.action_msg	= "Emergency Thaw of all frozen filesystems",
>   	.enable_mask	= SYSRQ_ENABLE_SIGNAL,
>   };
> +#else
> +#define sysrq_thaw_op (*(const struct sysrq_key_op *)NULL)
> +#endif
>   
>   static void sysrq_handle_kill(int key)
>   {
> @@ -468,17 +474,9 @@ static const struct sysrq_key_op *sysrq_key_table[62] = {
>   	NULL,				/* g */
>   	NULL,				/* h - reserved for help */
>   	&sysrq_kill_op,			/* i */
> -#ifdef CONFIG_BLOCK
>   	&sysrq_thaw_op,			/* j */
> -#else
> -	NULL,				/* j */
> -#endif
>   	&sysrq_SAK_op,			/* k */
> -#ifdef CONFIG_SMP
>   	&sysrq_showallcpus_op,		/* l */
> -#else
> -	NULL,				/* l */
> -#endif
>   	&sysrq_showmem_op,		/* m */
>   	&sysrq_unrt_op,			/* n */
>   	/* o: This will often be registered as 'Off' at init time */


-- 
js
suse labs

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

* Re: [PATCH v1] tty/sysrq: change the definition of sysrq_key_table's element to make it more readable
  2022-04-06  9:57 ` Jiri Slaby
@ 2022-04-10  8:01   ` Junwen Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Junwen Wu @ 2022-04-10  8:01 UTC (permalink / raw)
  To: jirislaby; +Cc: gregkh, linux-kernel, wudaemon

Dear Jiri
     Sorry ,sysrq_showallcpus_op etc. are  not massive,but confused.  "CONFIG_TRACING" make the definition of the sysrq_ftrace_dump outside sysrq_key_table
but "CONFIG_SMP" make the definition of the sysrq_showallcpus_op inside sysrq_key_table. so unitify the code will make code more readable.
wujunwen is realy my name,Junwen Wu is better.

Jiri, I plan to modify the commit message as follow:
Subject: [PATCH v1] tty/sysrq: change the definition of sysrq_key_table's element to make it more readable

The definition of sysrq_key_table's elements, like sysrq_thaw_op and
sysrq_showallcpus_op are not consistent with sysrq_ftrace_dump_op, Consistency makes code more readable.

Signed-off-by: Junwen Wu <wudaemon@163.com>

Is this ok?

beside,if this commit message is ok,the subject will comment PATCH v2 ?

Thanks


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

end of thread, other threads:[~2022-04-10  8:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 15:36 [PATCH v1] tty/sysrq: change the definition of sysrq_key_table's element to make it more readable wujunwen
2022-04-06  9:57 ` Jiri Slaby
2022-04-10  8:01   ` Junwen Wu

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