2021-04-07 22:29:40

by Xiaofei Tan

[permalink] [raw]
Subject: [PATCH v3 00/10] tty: Fix some coding style issues

Fix some issues reported by checkpatch.pl. All of them are
coding style issues, no function changes.

Differences from v2 to v3:
- Fix the misunderstanding of 'period' for the patch 04/10.

Differences from v1 to v2:
- Remove one redundant tab for the patch 02/10.
- Add some expression optimization for some sentenses following
- Jiri's advice for the patch 04/10.

Xiaofei Tan (10):
tty/sysrq: Add a blank line after declarations
tty/sysrq: Fix issues of code indent should use tabs
tty: tty_jobctrl: Add a blank line after declarations
tty: tty_jobctrl: Fix coding style issues of block comments
tty: tty_jobctrl: Remove spaces before tabs
tty: tty_ldisc: Fix an issue of code indent should use tabs
tty: tty_ldisc: Add a blank line after declarations
tty: tty_ldisc: Fix coding style issues of block comments
tty: tty_ldisc: Do not use assignment in if condition
tty: tty_ldisc: Remove the repeated word 'the'

drivers/tty/sysrq.c | 35 ++++++++++++++++++-----------------
drivers/tty/tty_jobctrl.c | 29 +++++++++++++++++++----------
drivers/tty/tty_ldisc.c | 41 ++++++++++++++++++++++++++---------------
3 files changed, 63 insertions(+), 42 deletions(-)

--
2.8.1


2021-04-07 22:30:06

by Xiaofei Tan

[permalink] [raw]
Subject: [PATCH v3 09/10] tty: tty_ldisc: Do not use assignment in if condition

Do not use assignment in if condition following the advice of
checkpatch.pl.

Signed-off-by: Xiaofei Tan <[email protected]>
---
drivers/tty/tty_ldisc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 874d238..56e67f7 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -508,7 +508,8 @@ static int tty_ldisc_failto(struct tty_struct *tty, int ld)
return PTR_ERR(disc);
tty->ldisc = disc;
tty_set_termios_ldisc(tty, ld);
- if ((r = tty_ldisc_open(tty, disc)) < 0)
+ r = tty_ldisc_open(tty, disc);
+ if (r < 0)
tty_ldisc_put(disc);
return r;
}
--
2.8.1

2021-04-07 22:30:08

by Xiaofei Tan

[permalink] [raw]
Subject: [PATCH v3 06/10] tty: tty_ldisc: Fix an issue of code indent should use tabs

Fix an issue of code indent should use tabs, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <[email protected]>
---
drivers/tty/tty_ldisc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 1ba74d6..2992319 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -459,7 +459,7 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld)
WARN_ON(test_and_set_bit(TTY_LDISC_OPEN, &tty->flags));
if (ld->ops->open) {
int ret;
- /* BTM here locks versus a hangup event */
+ /* BTM here locks versus a hangup event */
ret = ld->ops->open(tty);
if (ret)
clear_bit(TTY_LDISC_OPEN, &tty->flags);
--
2.8.1

2021-04-07 22:30:47

by Xiaofei Tan

[permalink] [raw]
Subject: [PATCH v3 01/10] tty/sysrq: Add a blank line after declarations

Add a blank line after declarations, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <[email protected]>
---
drivers/tty/sysrq.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 959f9e1..0372ed7 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -118,6 +118,7 @@ static const struct sysrq_key_op sysrq_loglevel_op = {
static void sysrq_handle_SAK(int key)
{
struct work_struct *SAK_work = &vc_cons[fg_console].SAK_work;
+
schedule_work(SAK_work);
}
static const struct sysrq_key_op sysrq_SAK_op = {
--
2.8.1

2021-04-07 22:30:48

by Xiaofei Tan

[permalink] [raw]
Subject: [PATCH v3 02/10] tty/sysrq: Fix issues of code indent should use tabs

Fix issues of code indent should use tabs, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <[email protected]>
---
drivers/tty/sysrq.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 0372ed7..6628792 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -548,22 +548,22 @@ static int sysrq_key_table_key2index(int key)
*/
static const struct sysrq_key_op *__sysrq_get_key_op(int key)
{
- const struct sysrq_key_op *op_p = NULL;
- int i;
+ const struct sysrq_key_op *op_p = NULL;
+ int i;

i = sysrq_key_table_key2index(key);
if (i != -1)
- op_p = sysrq_key_table[i];
+ op_p = sysrq_key_table[i];

- return op_p;
+ return op_p;
}

static void __sysrq_put_key_op(int key, const struct sysrq_key_op *op_p)
{
- int i = sysrq_key_table_key2index(key);
+ int i = sysrq_key_table_key2index(key);

- if (i != -1)
- sysrq_key_table[i] = op_p;
+ if (i != -1)
+ sysrq_key_table[i] = op_p;
}

void __handle_sysrq(int key, bool check_mask)
@@ -587,8 +587,8 @@ void __handle_sysrq(int key, bool check_mask)
orig_log_level = console_loglevel;
console_loglevel = CONSOLE_LOGLEVEL_DEFAULT;

- op_p = __sysrq_get_key_op(key);
- if (op_p) {
+ op_p = __sysrq_get_key_op(key);
+ if (op_p) {
/*
* Should we check for enabled operations (/proc/sysrq-trigger
* should not) and is the invoked operation enabled?
@@ -637,13 +637,13 @@ static int sysrq_reset_downtime_ms;

/* Simple translation table for the SysRq keys */
static const unsigned char sysrq_xlate[KEY_CNT] =
- "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
- "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
- "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
- "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
- "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
- "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
- "\r\000/"; /* 0x60 - 0x6f */
+ "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
+ "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
+ "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
+ "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
+ "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
+ "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
+ "\r\000/"; /* 0x60 - 0x6f */

struct sysrq_state {
struct input_handle handle;
@@ -1108,7 +1108,7 @@ int sysrq_toggle_support(int enable_mask)
EXPORT_SYMBOL_GPL(sysrq_toggle_support);

static int __sysrq_swap_key_ops(int key, const struct sysrq_key_op *insert_op_p,
- const struct sysrq_key_op *remove_op_p)
+ const struct sysrq_key_op *remove_op_p)
{
int retval;

--
2.8.1