2021-04-05 04:57:08

by Xiaofei Tan

[permalink] [raw]
Subject: [PATCH 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.

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-05 05:02:52

by Xiaofei Tan

[permalink] [raw]
Subject: [PATCH 04/10] tty: tty_jobctrl: Fix coding style issues of block comments

Fix coding style issues of block comments, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <[email protected]>
---
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;

--
2.8.1

2021-04-06 13:34:30

by Xiaofei Tan

[permalink] [raw]
Subject: Re: [PATCH 04/10] tty: tty_jobctrl: Fix coding style issues of block comments

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 <[email protected]>
>> ---
>> 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;
>>
>
>

2021-04-06 15:23:13

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 04/10] tty: tty_jobctrl: Fix coding style issues of block comments

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 <[email protected]>
> ---
> 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;
>
>


--
js