Fix some issues reported by checkpatch.pl. All of them are coding style issues, no function changes.
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(-)
Add a blank line after declarations, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- 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 = {
Fix issues of code indent should use tabs, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- 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..1ece100 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;
Hi Xiaofei,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tty/tty-testing] [also build test WARNING on v5.12-rc6 next-20210401] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Xiaofei-Tan/tty-Fix-some-coding-sty... base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing config: x86_64-randconfig-a004-20210405 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 2760a808b9916a2839513b7fd7314a464f52481e) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://github.com/0day-ci/linux/commit/da18c35dce46cd938810b3ca12275fac9c97... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Xiaofei-Tan/tty-Fix-some-coding-style-issues/20210405-113900 git checkout da18c35dce46cd938810b3ca12275fac9c97f64d # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
drivers/tty/sysrq.c:558:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
return op_p; ^ drivers/tty/sysrq.c:555:2: note: previous statement is here if (i != -1) ^ 1 warning generated.
vim +/if +558 drivers/tty/sysrq.c
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 545 ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 546 /* ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 547 * get and put functions for the table, exposed to modules. ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 548 */ 23cbedf812ff7c drivers/tty/sysrq.c Emil Velikov 2020-05-13 549 static const struct sysrq_key_op *__sysrq_get_key_op(int key) bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 550 { 23cbedf812ff7c drivers/tty/sysrq.c Emil Velikov 2020-05-13 551 const struct sysrq_key_op *op_p = NULL; ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 552 int i; ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 553 ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 554 i = sysrq_key_table_key2index(key); bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 555 if (i != -1) bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 556 op_p = sysrq_key_table[i]; 97f5f0cd8cd0a0 drivers/char/sysrq.c Dmitry Torokhov 2010-03-21 557 ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 @558 return op_p; ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 559 } ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 560
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Xiaofei,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tty/tty-testing] [also build test WARNING on v5.12-rc6 next-20210401] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Xiaofei-Tan/tty-Fix-some-coding-sty... base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing config: s390-randconfig-r016-20210405 (attached as .config) compiler: s390-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/da18c35dce46cd938810b3ca12275fac9c97... git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Xiaofei-Tan/tty-Fix-some-coding-style-issues/20210405-113900 git checkout da18c35dce46cd938810b3ca12275fac9c97f64d # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:10, from include/linux/list.h:9, from include/linux/rculist.h:10, from include/linux/sched/signal.h:5, from drivers/tty/sysrq.c:18: drivers/tty/sysrq.c: In function '__sysrq_get_key_op':
include/linux/compiler.h:56:23: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) | ^~ drivers/tty/sysrq.c:555:2: note: in expansion of macro 'if' 555 | if (i != -1) | ^~ drivers/tty/sysrq.c:558:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 558 | return op_p; | ^~~~~~
vim +/if +56 include/linux/compiler.h
2bcd521a684cc9 Steven Rostedt 2008-11-21 50 2bcd521a684cc9 Steven Rostedt 2008-11-21 51 #ifdef CONFIG_PROFILE_ALL_BRANCHES 2bcd521a684cc9 Steven Rostedt 2008-11-21 52 /* 2bcd521a684cc9 Steven Rostedt 2008-11-21 53 * "Define 'is'", Bill Clinton 2bcd521a684cc9 Steven Rostedt 2008-11-21 54 * "Define 'if'", Steven Rostedt 2bcd521a684cc9 Steven Rostedt 2008-11-21 55 */ a15fd609ad53a6 Linus Torvalds 2019-03-20 @56 #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) a15fd609ad53a6 Linus Torvalds 2019-03-20 57
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On 2021/4/5 11:34, Xiaofei Tan wrote:
Fix issues of code indent should use tabs, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com
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..1ece100 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;
Wow, one redundant tab here.
}
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;
Hi Xiaofei,
url: https://github.com/0day-ci/linux/commits/Xiaofei-Tan/tty-Fix-some-coding-sty... base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing config: x86_64-randconfig-m001-20210405 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com Reported-by: Dan Carpenter dan.carpenter@oracle.com
smatch warnings: drivers/tty/sysrq.c:558 __sysrq_get_key_op() warn: curly braces intended?
vim +558 drivers/tty/sysrq.c
23cbedf812ff7c drivers/tty/sysrq.c Emil Velikov 2020-05-13 549 static const struct sysrq_key_op *__sysrq_get_key_op(int key) bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 550 { 23cbedf812ff7c drivers/tty/sysrq.c Emil Velikov 2020-05-13 551 const struct sysrq_key_op *op_p = NULL; ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 552 int i; ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 553 ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 554 i = sysrq_key_table_key2index(key); bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 555 if (i != -1) bf36b9011e3c5b drivers/char/sysrq.c Andrew Morton 2006-03-25 556 op_p = sysrq_key_table[i]; 97f5f0cd8cd0a0 drivers/char/sysrq.c Dmitry Torokhov 2010-03-21 557 ^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 @558 return op_p; ^^^^^^^^^^^ indented too far.
^1da177e4c3f41 drivers/char/sysrq.c Linus Torvalds 2005-04-16 559 }
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-leave@lists.01.org
Add a blank line after declarations, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- drivers/tty/tty_jobctrl.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 4b751b9..86070f7 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -75,6 +75,7 @@ void proc_clear_tty(struct task_struct *p) { unsigned long flags; struct tty_struct *tty; + spin_lock_irqsave(&p->sighand->siglock, flags); tty = p->signal->tty; p->signal->tty = NULL; @@ -173,6 +174,7 @@ EXPORT_SYMBOL_GPL(get_current_tty); void session_clear_tty(struct pid *session) { struct task_struct *p; + do_each_pid_task(session, PIDTYPE_SID, p) { proc_clear_tty(p); } while_each_pid_task(session, PIDTYPE_SID, p); @@ -269,6 +271,7 @@ void disassociate_ctty(int on_exit) tty_vhangup_session(tty); } else { struct pid *tty_pgrp = tty_get_pgrp(tty); + if (tty_pgrp) { kill_pgrp(tty_pgrp, SIGHUP, on_exit); if (!on_exit) @@ -280,6 +283,7 @@ void disassociate_ctty(int on_exit)
} else if (on_exit) { struct pid *old_pgrp; + spin_lock_irq(¤t->sighand->siglock); old_pgrp = current->signal->tty_old_pgrp; current->signal->tty_old_pgrp = NULL; @@ -328,6 +332,7 @@ void no_tty(void) between a new association and proc_clear_tty but possible we need to protect against this anyway */ struct task_struct *tsk = current; + disassociate_ctty(0); proc_clear_tty(tsk); }
Fix coding style issues of block comments, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- drivers/tty/tty_jobctrl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..4d78422 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(&p->sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL; - /* We defer the dereferences outside fo - the tasklist lock */ + /* + * We defer the dereferences outside fo + * the tasklist lock + */ refs++; } if (!p->signal->leader) { @@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) { - /* FIXME: Review locking here. The tty_lock never covered any race - between a new association and proc_clear_tty but possible we need - to protect against this anyway */ + /* + * FIXME: Review locking here. The tty_lock never covered any race + * between a new association and proc_clear_tty but possible we need + * to protect against this anyway + */ struct task_struct *tsk = current;
disassociate_ctty(0); @@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. - */ + */ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY;
On 05. 04. 21, 5:34, Xiaofei Tan wrote:
Fix coding style issues of block comments, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com
drivers/tty/tty_jobctrl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..4d78422 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(&p->sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL;
/* We defer the dereferences outside fo
the tasklist lock */
/*
* We defer the dereferences outside fo
* the tasklist lock
I don't know if it deserves its own patch, but fo -> of fix would be nice. And add a period at the end of the sentence.
*/ refs++; } if (!p->signal->leader) {
@@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) {
- /* FIXME: Review locking here. The tty_lock never covered any race
between a new association and proc_clear_tty but possible we need
to protect against this anyway */
- /*
* FIXME: Review locking here. The tty_lock never covered any race
* between a new association and proc_clear_tty but possible we need
"possibly" or "it's possible", I think (as a non-native).
* to protect against this anyway
Period.
*/
struct task_struct *tsk = current;
disassociate_ctty(0);
@@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty.
- */
if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY;*/
Hi Jiri,
On 2021/4/6 12:42, Jiri Slaby wrote:
On 05. 04. 21, 5:34, Xiaofei Tan wrote:
Fix coding style issues of block comments, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com
drivers/tty/tty_jobctrl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 86070f7..4d78422 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) spin_lock_irq(&p->sighand->siglock); if (p->signal->tty == tty) { p->signal->tty = NULL;
/* We defer the dereferences outside fo
the tasklist lock */
/*
* We defer the dereferences outside fo
* the tasklist lock
I don't know if it deserves its own patch, but fo -> of fix would be nice. And add a period at the end of the sentence.
OK.I will add this fixes.
*/ refs++; } if (!p->signal->leader) {
@@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit) */ void no_tty(void) {
- /* FIXME: Review locking here. The tty_lock never covered any race
between a new association and proc_clear_tty but possible we need
to protect against this anyway */
- /*
* FIXME: Review locking here. The tty_lock never covered any race
* between a new association and proc_clear_tty but possible we need
"possibly" or "it's possible", I think (as a non-native).
OK
* to protect against this anyway
Period.
OK
*/ struct task_struct *tsk = current; disassociate_ctty(0);
@@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ /* * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty.
- */
*/ if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY;
Remove spaces before tabs following the advice of checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- drivers/tty/tty_jobctrl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c index 4d78422..2f7d4ba 100644 --- a/drivers/tty/tty_jobctrl.c +++ b/drivers/tty/tty_jobctrl.c @@ -244,10 +244,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int exit_session) * it wants to disassociate itself from its controlling tty. * * It performs the following functions: - * (1) Sends a SIGHUP and SIGCONT to the foreground process group - * (2) Clears the tty from being controlling the session - * (3) Clears the controlling tty for all processes in the - * session group. + * (1) Sends a SIGHUP and SIGCONT to the foreground process group + * (2) Clears the tty from being controlling the session + * (3) Clears the controlling tty for all processes in the + * session group. * * The argument on_exit is set to 1 if called when a process is * exiting; it is 0 if called by the ioctl TIOCNOTTY.
Fix an issue of code indent should use tabs, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- 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);
Add a blank line after declarations, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- drivers/tty/tty_ldisc.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 2992319..df0b589 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -771,6 +771,7 @@ void tty_ldisc_hangup(struct tty_struct *tty, bool reinit) int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty) { int retval = tty_ldisc_open(tty, tty->ldisc); + if (retval) return retval;
@@ -829,6 +830,7 @@ EXPORT_SYMBOL_GPL(tty_ldisc_release); int tty_ldisc_init(struct tty_struct *tty) { struct tty_ldisc *ld = tty_ldisc_get(tty, N_TTY); + if (IS_ERR(ld)) return PTR_ERR(ld); tty->ldisc = ld;
Fix coding style issues of block comments, reported by checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- drivers/tty/tty_ldisc.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index df0b589..874d238 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -529,9 +529,11 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) const char *name = tty_name(tty);
pr_warn("Falling back ldisc for %s.\n", name); - /* The traditional behaviour is to fall back to N_TTY, we - want to avoid falling back to N_NULL unless we have no - choice to avoid the risk of breaking anything */ + /* + * The traditional behaviour is to fall back to N_TTY, we + * want to avoid falling back to N_NULL unless we have no + * choice to avoid the risk of breaking anything + */ if (tty_ldisc_failto(tty, N_TTY) < 0 && tty_ldisc_failto(tty, N_NULL) < 0) panic("Couldn't open N_NULL ldisc for %s.", name); @@ -600,17 +602,21 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) up_read(&tty->termios_rwsem); }
- /* At this point we hold a reference to the new ldisc and a - reference to the old ldisc, or we hold two references to - the old ldisc (if it was restored as part of error cleanup - above). In either case, releasing a single reference from - the old ldisc is correct. */ + /* + * At this point we hold a reference to the new ldisc and a + * reference to the old ldisc, or we hold two references to + * the old ldisc (if it was restored as part of error cleanup + * above). In either case, releasing a single reference from + * the old ldisc is correct. + */ new_ldisc = old_ldisc; out: tty_ldisc_unlock(tty);
- /* Restart the work queue in case no characters kick it off. Safe if - already running */ + /* + * Restart the work queue in case no characters kick it off. Safe if + * already running + */ tty_buffer_restart_work(tty->port); err: tty_ldisc_put(new_ldisc); /* drop the extra reference */ @@ -812,8 +818,10 @@ void tty_ldisc_release(struct tty_struct *tty) tty_ldisc_kill(o_tty); tty_ldisc_unlock_pair(tty, o_tty);
- /* And the memory resources remaining (buffers, termios) will be - disposed of when the kref hits zero */ + /* + * And the memory resources remaining (buffers, termios) will be + * disposed of when the kref hits zero + */
tty_ldisc_debug(tty, "released\n"); }
Do not use assignment in if condition following the advice of checkpatch.pl.
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- 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; }
Remove the repeated word 'the' following advice of checkpatch.pl
Signed-off-by: Xiaofei Tan tanxiaofei@huawei.com --- 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 56e67f7..fdc4fa3 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -147,7 +147,7 @@ static int tty_ldisc_autoload = IS_BUILTIN(CONFIG_LDISC_AUTOLOAD); * Returns: -EINVAL if the discipline index is not [N_TTY..NR_LDISCS] or * if the discipline is not registered * -EAGAIN if request_module() failed to load or register the - * the discipline + * discipline * -ENOMEM if allocation failure * * Otherwise, returns a pointer to the discipline and bumps the