linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/17] tty: Fix some coding style issues
@ 2021-05-12  9:26 Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 01/17] tty: tty_baudrate: Remove unnecessary tab and spaces in comment sentence Xiaofei Tan
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

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

Xiaofei Tan (17):
  tty: tty_baudrate: Remove unnecessary tab and spaces in comment
    sentence
  tty: tty_baudrate: Fix coding style issues of block comments
  tty: tty_buffer: Add a blank line after declarations
  tty: tty_buffer: Remove the repeated word 'the'
  tty: tty_buffer: Fix coding style issues of block comments
  tty: tty_io: Remove spaces before tabs
  tty: tty_io: Add a blank line after declarations
  tty: tty_io: Fix spaces required around that ':'
  tty: tty_io: Fix trailing whitespace issues
  tty: tty_io: Fix coding style issues of block comments
  tty: tty_io: Remove the repeated word 'can'
  tty: tty_io: Fix an issue of code indent for conditional statements
  tty: tty_io: Delete a blank line before EXPORT_SYMBOL(foo)
  tty: tty_io: Remove return in void function
  tty: tty_port: Delete a blank line before EXPORT_SYMBOL(foo)
  tty: tty_port: Add a blank line after declarations
  tty: tty_port: Fix coding style issues of block comments

 drivers/tty/tty_baudrate.c | 13 ++++++----
 drivers/tty/tty_buffer.c   | 20 +++++++++++----
 drivers/tty/tty_io.c       | 61 ++++++++++++++++++++++++++--------------------
 drivers/tty/tty_port.c     | 16 +++++++-----
 4 files changed, 67 insertions(+), 43 deletions(-)

-- 
2.8.1


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

* [PATCH 01/17] tty: tty_baudrate: Remove unnecessary tab and spaces in comment sentence
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 02/17] tty: tty_baudrate: Fix coding style issues of block comments Xiaofei Tan
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Remove unnecessary tab and spaces in comment sentence, reported
by checkpatch.pl.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_baudrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c
index 48b5de6..b3f5ba9 100644
--- a/drivers/tty/tty_baudrate.c
+++ b/drivers/tty/tty_baudrate.c
@@ -147,7 +147,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
 	int iclose = ibaud/50, oclose = obaud/50;
 	int ibinput = 0;
 
-	if (obaud == 0)			/* CD dropped 		  */
+	if (obaud == 0)			/* CD dropped */
 		ibaud = 0;		/* Clear ibaud to be sure */
 
 	termios->c_ispeed = ibaud;
-- 
2.8.1


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

* [PATCH 02/17] tty: tty_baudrate: Fix coding style issues of block comments
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 01/17] tty: tty_baudrate: Remove unnecessary tab and spaces in comment sentence Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 03/17] tty: tty_buffer: Add a blank line after declarations Xiaofei Tan
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Fix coding style issues of block comments, reported by checkpatch.pl.
Besides, add a period at the end of comment sentenses.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_baudrate.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c
index b3f5ba9..426b125 100644
--- a/drivers/tty/tty_baudrate.c
+++ b/drivers/tty/tty_baudrate.c
@@ -159,8 +159,9 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
 #endif
 #ifdef BOTHER
 	/* If the user asked for a precise weird speed give a precise weird
-	   answer. If they asked for a Bfoo speed they may have problems
-	   digesting non-exact replies so fuzz a bit */
+	 * answer. If they asked for a Bfoo speed they may have problems
+	 * digesting non-exact replies so fuzz a bit.
+	 */
 
 	if ((termios->c_cflag & CBAUD) == BOTHER) {
 		oclose = 0;
@@ -191,7 +192,8 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
 		if (ibaud - iclose <= baud_table[i] &&
 		    ibaud + iclose >= baud_table[i]) {
 			/* For the case input == output don't set IBAUD bits
-			   if the user didn't do so */
+			 * if the user didn't do so.
+			 */
 			if (ofound == i && !ibinput)
 				ifound  = i;
 #ifdef IBSHIFT
@@ -211,7 +213,8 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
 	if (ofound == -1)
 		termios->c_cflag |= BOTHER;
 	/* Set exact input bits only if the input and output differ or the
-	   user already did */
+	 * user already did.
+	 */
 	if (ifound == -1 && (ibaud != obaud || ibinput))
 		termios->c_cflag |= (BOTHER << IBSHIFT);
 #else
-- 
2.8.1


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

* [PATCH 03/17] tty: tty_buffer: Add a blank line after declarations
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 01/17] tty: tty_baudrate: Remove unnecessary tab and spaces in comment sentence Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 02/17] tty: tty_baudrate: Fix coding style issues of block comments Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 04/17] tty: tty_buffer: Remove the repeated word 'the' Xiaofei Tan
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

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

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_buffer.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 9733469..5509b5d 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -91,6 +91,7 @@ EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive);
 int tty_buffer_space_avail(struct tty_port *port)
 {
 	int space = port->buf.mem_limit - atomic_read(&port->buf.mem_used);
+
 	return max(space, 0);
 }
 EXPORT_SYMBOL_GPL(tty_buffer_space_avail);
@@ -312,11 +313,13 @@ int tty_insert_flip_string_fixed_flag(struct tty_port *port,
 		const unsigned char *chars, char flag, size_t size)
 {
 	int copied = 0;
+
 	do {
 		int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE);
 		int flags = (flag == TTY_NORMAL) ? TTYB_NORMAL : 0;
 		int space = __tty_buffer_request_room(port, goal, flags);
 		struct tty_buffer *tb = port->buf.tail;
+
 		if (unlikely(space == 0))
 			break;
 		memcpy(char_buf_ptr(tb, tb->used), chars, space);
@@ -348,10 +351,12 @@ int tty_insert_flip_string_flags(struct tty_port *port,
 		const unsigned char *chars, const char *flags, size_t size)
 {
 	int copied = 0;
+
 	do {
 		int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE);
 		int space = tty_buffer_request_room(port, goal);
 		struct tty_buffer *tb = port->buf.tail;
+
 		if (unlikely(space == 0))
 			break;
 		memcpy(char_buf_ptr(tb, tb->used), chars, space);
@@ -431,8 +436,10 @@ int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars,
 		size_t size)
 {
 	int space = __tty_buffer_request_room(port, size, TTYB_NORMAL);
+
 	if (likely(space)) {
 		struct tty_buffer *tb = port->buf.tail;
+
 		*chars = char_buf_ptr(tb, tb->used);
 		if (~tb->flags & TTYB_NORMAL)
 			memset(flag_buf_ptr(tb, tb->used), TTY_NORMAL, space);
-- 
2.8.1


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

* [PATCH 04/17] tty: tty_buffer: Remove the repeated word 'the'
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (2 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 03/17] tty: tty_buffer: Add a blank line after declarations Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 05/17] tty: tty_buffer: Fix coding style issues of block comments Xiaofei Tan
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Remove the repeated word 'the' following advice of checkpatch.pl
Besides, add a period at the end of comment sentence.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 5509b5d..721491df 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -32,8 +32,8 @@
  * We default to dicing tty buffer allocations to this many characters
  * in order to avoid multiple page allocations. We know the size of
  * tty_buffer itself but it must also be taken into account that the
- * the buffer is 256 byte aligned. See tty_buffer_find for the allocation
- * logic this must match
+ * buffer is 256 byte aligned. See tty_buffer_find for the allocation
+ * logic this must match.
  */
 
 #define TTY_BUFFER_PAGE	(((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF)
-- 
2.8.1


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

* [PATCH 05/17] tty: tty_buffer: Fix coding style issues of block comments
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (3 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 04/17] tty: tty_buffer: Remove the repeated word 'the' Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 06/17] tty: tty_io: Remove spaces before tabs Xiaofei Tan
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Fix coding style issues of block comments, reported by checkpatch.pl.
Besides, add a period at the end of the sentenses.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_buffer.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 721491df..e9ff5dd 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -170,7 +170,8 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
 	}
 
 	/* Should possibly check if this fails for the largest buffer we
-	   have queued and recycle that ? */
+	 * have queued and recycle that ?
+	 */
 	if (atomic_read(&port->buf.mem_used) > port->buf.mem_limit)
 		return NULL;
 	p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
@@ -329,7 +330,8 @@ int tty_insert_flip_string_fixed_flag(struct tty_port *port,
 		copied += space;
 		chars += space;
 		/* There is a small chance that we need to split the data over
-		   several buffers. If this is the case we must loop */
+		 * several buffers. If this is the case we must loop.
+		 */
 	} while (unlikely(size > copied));
 	return copied;
 }
@@ -366,7 +368,8 @@ int tty_insert_flip_string_flags(struct tty_port *port,
 		chars += space;
 		flags += space;
 		/* There is a small chance that we need to split the data over
-		   several buffers. If this is the case we must loop */
+		 * several buffers. If this is the case we must loop.
+		 */
 	} while (unlikely(size > copied));
 	return copied;
 }
-- 
2.8.1


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

* [PATCH 06/17] tty: tty_io: Remove spaces before tabs
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (4 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 05/17] tty: tty_buffer: Fix coding style issues of block comments Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 07/17] tty: tty_io: Add a blank line after declarations Xiaofei Tan
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Remove spaces before tabs following the advice of checkpatch.pl.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 5b5e996..c5b0e49 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -33,7 +33,7 @@
  *	-- Nick Holloway <alfie@dcs.warwick.ac.uk>, 27th May 1993.
  *
  * Rewrote canonical mode and added more termios flags.
- * 	-- julian@uhunix.uhcc.hawaii.edu (J. Cowley), 13Jan94
+ *	-- julian@uhunix.uhcc.hawaii.edu (J. Cowley), 13Jan94
  *
  * Reorganized FASYNC support so mouse code can share it.
  *	-- ctm@ardi.com, 9Sep95
@@ -1114,7 +1114,7 @@ void tty_write_message(struct tty_struct *tty, char *msg)
 static ssize_t file_tty_write(struct file *file, struct kiocb *iocb, struct iov_iter *from)
 {
 	struct tty_struct *tty = file_tty(file);
- 	struct tty_ldisc *ld;
+	struct tty_ldisc *ld;
 	ssize_t ret;
 
 	if (tty_paranoia_check(tty, file_inode(file), "tty_write"))
@@ -1928,8 +1928,8 @@ static struct tty_struct *tty_open_current_tty(dev_t device, struct file *filp)
  *	@index: index for the device in the @return driver
  *	@return: driver for this inode (with increased refcount)
  *
- * 	If @return is not erroneous, the caller is responsible to decrement the
- * 	refcount by tty_driver_kref_put.
+ *	If @return is not erroneous, the caller is responsible to decrement the
+ *	refcount by tty_driver_kref_put.
  *
  *	Locking: tty_mutex protects get_tty_driver
  */
@@ -3317,11 +3317,11 @@ struct device *tty_register_device_attr(struct tty_driver *driver,
 EXPORT_SYMBOL_GPL(tty_register_device_attr);
 
 /**
- * 	tty_unregister_device - unregister a tty device
- * 	@driver: the tty driver that describes the tty device
- * 	@index: the index in the tty driver for this tty device
+ *	tty_unregister_device - unregister a tty device
+ *	@driver: the tty driver that describes the tty device
+ *	@index: the index in the tty driver for this tty device
  *
- * 	If a tty device is registered with a call to tty_register_device() then
+ *	If a tty device is registered with a call to tty_register_device() then
  *	this function must be called when the tty device is gone.
  *
  *	Locking: ??
-- 
2.8.1


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

* [PATCH 07/17] tty: tty_io: Add a blank line after declarations
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (5 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 06/17] tty: tty_io: Remove spaces before tabs Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 08/17] tty: tty_io: Fix spaces required around that ':' Xiaofei Tan
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

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

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index c5b0e49..8b9430c 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -320,6 +320,7 @@ static struct tty_driver *get_tty_driver(dev_t device, int *index)
 
 	list_for_each_entry(p, &tty_drivers, tty_drivers) {
 		dev_t base = MKDEV(p->major, p->minor_start);
+
 		if (device < base || device >= base + p->num)
 			continue;
 		*index = device - base;
@@ -1033,6 +1034,7 @@ static inline ssize_t do_tty_write(
 	/* Do the write .. */
 	for (;;) {
 		size_t size = count;
+
 		if (size > chunk)
 			size = chunk;
 
@@ -1155,6 +1157,7 @@ ssize_t redirected_tty_write(struct kiocb *iocb, struct iov_iter *iter)
 	 */
 	if (p) {
 		ssize_t res;
+
 		res = file_tty_write(p, iocb, iter);
 		fput(p);
 		return res;
@@ -1942,6 +1945,7 @@ static struct tty_driver *tty_lookup_driver(dev_t device, struct file *filp,
 #ifdef CONFIG_VT
 	case MKDEV(TTY_MAJOR, 0): {
 		extern struct tty_driver *console_driver;
+
 		driver = tty_driver_kref_get(console_driver);
 		*index = fg_console;
 		break;
@@ -1949,6 +1953,7 @@ static struct tty_driver *tty_lookup_driver(dev_t device, struct file *filp,
 #endif
 	case MKDEV(TTYAUX_MAJOR, 1): {
 		struct tty_driver *console_driver = console_device(index);
+
 		if (console_driver) {
 			driver = tty_driver_kref_get(console_driver);
 			if (driver && filp) {
@@ -2388,6 +2393,7 @@ EXPORT_SYMBOL(tty_do_resize);
 static int tiocswinsz(struct tty_struct *tty, struct winsize __user *arg)
 {
 	struct winsize tmp_ws;
+
 	if (copy_from_user(&tmp_ws, arg, sizeof(*arg)))
 		return -EFAULT;
 
@@ -2412,6 +2418,7 @@ static int tioccons(struct file *file)
 		return -EPERM;
 	if (file->f_op->write_iter == redirected_tty_write) {
 		struct file *f;
+
 		spin_lock(&redirect_lock);
 		f = redirect;
 		redirect = NULL;
@@ -2734,6 +2741,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	case TIOCGEXCL:
 	{
 		int excl = test_bit(TTY_EXCLUSIVE, &tty->flags);
+
 		return put_user(excl, (int __user *)p);
 	}
 	case TIOCGETD:
@@ -2748,6 +2756,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	case TIOCGDEV:
 	{
 		unsigned int ret = new_encode_dev(tty_devnum(real_tty));
+
 		return put_user(ret, (unsigned int __user *)p);
 	}
 	/*
@@ -3103,6 +3112,7 @@ EXPORT_SYMBOL(do_SAK);
 static struct device *tty_get_device(struct tty_struct *tty)
 {
 	dev_t devt = tty_devnum(tty);
+
 	return class_find_device_by_devt(tty_class, devt);
 }
 
-- 
2.8.1


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

* [PATCH 08/17] tty: tty_io: Fix spaces required around that ':'
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (6 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 07/17] tty: tty_io: Add a blank line after declarations Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 09/17] tty: tty_io: Fix trailing whitespace issues Xiaofei Tan
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Fix spaces required around that ':', reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 8b9430c..93a9142 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2341,7 +2341,7 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg)
 	err = copy_to_user(arg, &tty->winsize, sizeof(*arg));
 	mutex_unlock(&tty->winsize_mutex);
 
-	return err ? -EFAULT: 0;
+	return err ? -EFAULT : 0;
 }
 
 /**
-- 
2.8.1


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

* [PATCH 09/17] tty: tty_io: Fix trailing whitespace issues
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (7 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 08/17] tty: tty_io: Fix spaces required around that ':' Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 10/17] tty: tty_io: Fix coding style issues of block comments Xiaofei Tan
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Fix trailing whitespace issues, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 93a9142..5ad2b73 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3015,7 +3015,7 @@ static int this_tty(const void *t, struct file *file, unsigned fd)
 		return 0;
 	return file_tty(file) != t ? 0 : fd + 1;
 }
-	
+
 /*
  * This implements the "Secure Attention Key" ---  the idea is to
  * prevent trojan horses by killing all processes associated with this
-- 
2.8.1


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

* [PATCH 10/17] tty: tty_io: Fix coding style issues of block comments
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (8 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 09/17] tty: tty_io: Fix trailing whitespace issues Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 11/17] tty: tty_io: Remove the repeated word 'can' Xiaofei Tan
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Fix coding style issues of block comments, reported by checkpatch.pl.
Besides, add a period at the end of the sentenses.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 5ad2b73..72f90ef 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -135,8 +135,9 @@ struct ktermios tty_std_termios = {	/* for the benefit of tty drivers  */
 EXPORT_SYMBOL(tty_std_termios);
 
 /* This list gets poked at by procfs and various bits of boot up code. This
-   could do with some rationalisation such as pulling the tty proc function
-   into this file */
+ * could do with some rationalisation such as pulling the tty proc function
+ * into this file.
+ */
 
 LIST_HEAD(tty_drivers);			/* linked list of tty drivers */
 
@@ -614,8 +615,9 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session)
 	set_bit(TTY_HUPPING, &tty->flags);
 
 	/* inuse_filps is protected by the single tty lock,
-	   this really needs to change if we want to flush the
-	   workqueue with the lock held */
+	 * this really needs to change if we want to flush the
+	 * workqueue with the lock held.
+	 */
 	check_tty_count(tty, "tty_hangup");
 
 	spin_lock(&tty->files_lock);
@@ -942,7 +944,8 @@ static ssize_t tty_read(struct kiocb *iocb, struct iov_iter *to)
 		return -EIO;
 
 	/* We want to wait for the line discipline to sort out in this
-	   situation */
+	 * situation.
+	 */
 	ld = tty_ldisc_ref_wait(tty);
 	if (!ld)
 		return hung_up_tty_read(iocb, to);
@@ -1572,7 +1575,8 @@ static void queue_release_one_tty(struct kref *kref)
 	struct tty_struct *tty = container_of(kref, struct tty_struct, kref);
 
 	/* The hangup queue is now free so we can reuse it rather than
-	   waste a chunk of memory for each port */
+	 *  waste a chunk of memory for each port.
+	 */
 	INIT_WORK(&tty->hangup_work, release_one_tty);
 	schedule_work(&tty->hangup_work);
 }
@@ -1877,7 +1881,8 @@ int tty_release(struct inode *inode, struct file *filp)
 	tty_unlock(tty);
 
 	/* At this point, the tty->count == 0 should ensure a dead tty
-	   cannot be re-opened by a racing opener */
+	 * cannot be re-opened by a racing opener.
+	 */
 
 	if (!final)
 		return 0;
-- 
2.8.1


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

* [PATCH 11/17] tty: tty_io: Remove the repeated word 'can'
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (9 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 10/17] tty: tty_io: Fix coding style issues of block comments Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 12/17] tty: tty_io: Fix an issue of code indent for conditional statements Xiaofei Tan
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Remove the repeated word 'can' following advice of checkpatch.pl

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 72f90ef..12270cb 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1155,7 +1155,7 @@ ssize_t redirected_tty_write(struct kiocb *iocb, struct iov_iter *iter)
 	spin_unlock(&redirect_lock);
 
 	/*
-	 * We know the redirected tty is just another tty, we can can
+	 * We know the redirected tty is just another tty, we can
 	 * call file_tty_write() directly with that file pointer.
 	 */
 	if (p) {
-- 
2.8.1


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

* [PATCH 12/17] tty: tty_io: Fix an issue of code indent for conditional statements
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (10 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 11/17] tty: tty_io: Remove the repeated word 'can' Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 13/17] tty: tty_io: Delete a blank line before EXPORT_SYMBOL(foo) Xiaofei Tan
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Fix an issue of code indent for conditional statements,reported by
checkpatch.pl.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 12270cb..6e65726 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1125,7 +1125,7 @@ static ssize_t file_tty_write(struct file *file, struct kiocb *iocb, struct iov_
 	if (tty_paranoia_check(tty, file_inode(file), "tty_write"))
 		return -EIO;
 	if (!tty || !tty->ops->write ||	tty_io_error(tty))
-			return -EIO;
+		return -EIO;
 	/* Short term debug to catch buggy drivers */
 	if (tty->ops->write_room == NULL)
 		tty_err(tty, "missing write_room method\n");
-- 
2.8.1


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

* [PATCH 13/17] tty: tty_io: Delete a blank line before EXPORT_SYMBOL(foo)
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (11 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 12/17] tty: tty_io: Fix an issue of code indent for conditional statements Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 14/17] tty: tty_io: Remove return in void function Xiaofei Tan
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Delete a blank line before EXPORT_SYMBOL(foo) so that EXPORT_SYMBOL(foo)
immediately follow its function/variable, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 6e65726..ce07aca 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -131,7 +131,6 @@ struct ktermios tty_std_termios = {	/* for the benefit of tty drivers  */
 	.c_ospeed = 38400,
 	/* .c_line = N_TTY, */
 };
-
 EXPORT_SYMBOL(tty_std_termios);
 
 /* This list gets poked at by procfs and various bits of boot up code. This
@@ -249,7 +248,6 @@ const char *tty_name(const struct tty_struct *tty)
 		return "NULL tty";
 	return tty->name;
 }
-
 EXPORT_SYMBOL(tty_name);
 
 const char *tty_driver_name(const struct tty_struct *tty)
@@ -539,7 +537,6 @@ void tty_wakeup(struct tty_struct *tty)
 	}
 	wake_up_interruptible_poll(&tty->write_wait, EPOLLOUT);
 }
-
 EXPORT_SYMBOL_GPL(tty_wakeup);
 
 /**
@@ -697,7 +694,6 @@ void tty_hangup(struct tty_struct *tty)
 	tty_debug_hangup(tty, "hangup\n");
 	schedule_work(&tty->hangup_work);
 }
-
 EXPORT_SYMBOL(tty_hangup);
 
 /**
@@ -714,7 +710,6 @@ void tty_vhangup(struct tty_struct *tty)
 	tty_debug_hangup(tty, "vhangup\n");
 	__tty_hangup(tty, 0);
 }
-
 EXPORT_SYMBOL(tty_vhangup);
 
 
@@ -764,7 +759,6 @@ int tty_hung_up_p(struct file *filp)
 {
 	return (filp && filp->f_op == &hung_up_tty_fops);
 }
-
 EXPORT_SYMBOL(tty_hung_up_p);
 
 /**
@@ -3110,7 +3104,6 @@ void do_SAK(struct tty_struct *tty)
 		return;
 	schedule_work(&tty->SAK_work);
 }
-
 EXPORT_SYMBOL(do_SAK);
 
 /* Must put_device() after it's unused! */
-- 
2.8.1


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

* [PATCH 14/17] tty: tty_io: Remove return in void function
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (12 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 13/17] tty: tty_io: Delete a blank line before EXPORT_SYMBOL(foo) Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 15/17] tty: tty_port: Delete a blank line before EXPORT_SYMBOL(foo) Xiaofei Tan
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Remove return in void function, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_io.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index ce07aca..eef5ccc 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1090,7 +1090,6 @@ void tty_write_message(struct tty_struct *tty, char *msg)
 		tty_unlock(tty);
 		tty_write_unlock(tty);
 	}
-	return;
 }
 
 
-- 
2.8.1


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

* [PATCH 15/17] tty: tty_port: Delete a blank line before EXPORT_SYMBOL(foo)
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (13 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 14/17] tty: tty_io: Remove return in void function Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 16/17] tty: tty_port: Add a blank line after declarations Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 17/17] tty: tty_port: Fix coding style issues of block comments Xiaofei Tan
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Delete a blank line before EXPORT_SYMBOL(foo) so that
EXPORT_SYMBOL(foo) immediately follow its function/variable,
reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_port.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 303c198..397c2fd 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -698,5 +698,4 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
 	mutex_unlock(&port->mutex);
 	return tty_port_block_til_ready(port, tty, filp);
 }
-
 EXPORT_SYMBOL(tty_port_open);
-- 
2.8.1


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

* [PATCH 16/17] tty: tty_port: Add a blank line after declarations
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (14 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 15/17] tty: tty_port: Delete a blank line before EXPORT_SYMBOL(foo) Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  2021-05-12  9:26 ` [PATCH 17/17] tty: tty_port: Fix coding style issues of block comments Xiaofei Tan
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

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

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_port.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 397c2fd..4047954 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -688,6 +688,7 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
 		clear_bit(TTY_IO_ERROR, &tty->flags);
 		if (port->ops->activate) {
 			int retval = port->ops->activate(port, tty);
+
 			if (retval) {
 				mutex_unlock(&port->mutex);
 				return retval;
-- 
2.8.1


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

* [PATCH 17/17] tty: tty_port: Fix coding style issues of block comments
  2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
                   ` (15 preceding siblings ...)
  2021-05-12  9:26 ` [PATCH 16/17] tty: tty_port: Add a blank line after declarations Xiaofei Tan
@ 2021-05-12  9:26 ` Xiaofei Tan
  16 siblings, 0 replies; 18+ messages in thread
From: Xiaofei Tan @ 2021-05-12  9:26 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linuxarm, Xiaofei Tan

Fix coding style issues of block comments, reported by checkpatch.pl.
Besides, add a period at the end of the sentenses.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/tty/tty_port.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 4047954..36d49ac 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -468,7 +468,8 @@ int tty_port_block_til_ready(struct tty_port *port,
 	DEFINE_WAIT(wait);
 
 	/* if non-blocking mode is set we can pass directly to open unless
-	   the port has just hung up or is in another error state */
+	 * the port has just hung up or is in another error state.
+	 */
 	if (tty_io_error(tty)) {
 		tty_port_set_active(port, 1);
 		return 0;
@@ -485,8 +486,9 @@ int tty_port_block_til_ready(struct tty_port *port,
 		do_clocal = 1;
 
 	/* Block waiting until we can proceed. We may need to wait for the
-	   carrier, but we must also wait for any close that is in progress
-	   before the next open may complete */
+	 * carrier, but we must also wait for any close that is in progress
+	 * before the next open may complete.
+	 */
 
 	retval = 0;
 
@@ -503,7 +505,8 @@ int tty_port_block_til_ready(struct tty_port *port,
 
 		prepare_to_wait(&port->open_wait, &wait, TASK_INTERRUPTIBLE);
 		/* Check for a hangup or uninitialised port.
-							Return accordingly */
+		 * Return accordingly.
+		 */
 		if (tty_hung_up_p(filp) || !tty_port_initialized(port)) {
 			if (port->flags & ASYNC_HUP_NOTIFY)
 				retval = -EAGAIN;
@@ -530,7 +533,8 @@ int tty_port_block_til_ready(struct tty_port *port,
 	finish_wait(&port->open_wait, &wait);
 
 	/* Update counts. A parallel hangup will have set count to zero and
-	   we must not mess that up further */
+	 * we must not mess that up further.
+	 */
 	spin_lock_irqsave(&port->lock, flags);
 	if (!tty_hung_up_p(filp))
 		port->count++;
-- 
2.8.1


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

end of thread, other threads:[~2021-05-12  9:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12  9:26 [PATCH 00/17] tty: Fix some coding style issues Xiaofei Tan
2021-05-12  9:26 ` [PATCH 01/17] tty: tty_baudrate: Remove unnecessary tab and spaces in comment sentence Xiaofei Tan
2021-05-12  9:26 ` [PATCH 02/17] tty: tty_baudrate: Fix coding style issues of block comments Xiaofei Tan
2021-05-12  9:26 ` [PATCH 03/17] tty: tty_buffer: Add a blank line after declarations Xiaofei Tan
2021-05-12  9:26 ` [PATCH 04/17] tty: tty_buffer: Remove the repeated word 'the' Xiaofei Tan
2021-05-12  9:26 ` [PATCH 05/17] tty: tty_buffer: Fix coding style issues of block comments Xiaofei Tan
2021-05-12  9:26 ` [PATCH 06/17] tty: tty_io: Remove spaces before tabs Xiaofei Tan
2021-05-12  9:26 ` [PATCH 07/17] tty: tty_io: Add a blank line after declarations Xiaofei Tan
2021-05-12  9:26 ` [PATCH 08/17] tty: tty_io: Fix spaces required around that ':' Xiaofei Tan
2021-05-12  9:26 ` [PATCH 09/17] tty: tty_io: Fix trailing whitespace issues Xiaofei Tan
2021-05-12  9:26 ` [PATCH 10/17] tty: tty_io: Fix coding style issues of block comments Xiaofei Tan
2021-05-12  9:26 ` [PATCH 11/17] tty: tty_io: Remove the repeated word 'can' Xiaofei Tan
2021-05-12  9:26 ` [PATCH 12/17] tty: tty_io: Fix an issue of code indent for conditional statements Xiaofei Tan
2021-05-12  9:26 ` [PATCH 13/17] tty: tty_io: Delete a blank line before EXPORT_SYMBOL(foo) Xiaofei Tan
2021-05-12  9:26 ` [PATCH 14/17] tty: tty_io: Remove return in void function Xiaofei Tan
2021-05-12  9:26 ` [PATCH 15/17] tty: tty_port: Delete a blank line before EXPORT_SYMBOL(foo) Xiaofei Tan
2021-05-12  9:26 ` [PATCH 16/17] tty: tty_port: Add a blank line after declarations Xiaofei Tan
2021-05-12  9:26 ` [PATCH 17/17] tty: tty_port: Fix coding style issues of block comments Xiaofei Tan

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