linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next 0/9] various tty cleanups
@ 2014-11-05 17:26 Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 1/9] tty: Replace open-coded test with tty_hung_up_p() Peter Hurley
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

Hi Greg,

These patches are a mixture of dead declaration removals, uapi cleanup,
and other miscellany.

This series depends on the 10-patch 'serial core fixes' series.

Regards,

Peter Hurley (9):
  tty: Replace open-coded test with tty_hung_up_p()
  tty: Call methods in modern style
  tty: Remove defunct pcxe_open() declaration
  tty: Remove defunct serial_console_init() declaration
  serial: hp300: Remove obsolete comments
  cris: Remove obsolete ASYNC_SPLIT_TERMIOS behavior
  tty: Document defunct ASYNC_SPLIT_TERMIOS flag in uapi header
  vt: Remove vt_get_kmsg_redirect() from uapi header
  serial: 8250_em: Remove out-of-memory message

 drivers/tty/serial/8250/8250_em.c    |  4 +---
 drivers/tty/serial/8250/8250_hp300.c |  4 ----
 drivers/tty/serial/crisv10.c         | 12 ------------
 drivers/tty/serial/crisv10.h         |  1 -
 drivers/tty/tty_io.c                 | 14 +++++++-------
 drivers/tty/tty_ioctl.c              |  4 ++--
 drivers/tty/vt/vt.c                  |  2 ++
 include/linux/tty.h                  |  8 --------
 include/uapi/linux/tty_flags.h       |  2 +-
 include/uapi/linux/vt.h              |  3 ---
 10 files changed, 13 insertions(+), 41 deletions(-)

-- 
2.1.3


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

* [PATCH -next 1/9] tty: Replace open-coded test with tty_hung_up_p()
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 2/9] tty: Call methods in modern style Peter Hurley
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

tty_hung_up_p() is equivalent to the open-coded test in tty_open().

Signed-off-by: Peter Hurley <peter@hurleysoftware.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 4bd48f7..1262368 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2129,7 +2129,7 @@ retry_open:
 		/*
 		 * Need to reset f_op in case a hangup happened.
 		 */
-		if (filp->f_op == &hung_up_tty_fops)
+		if (tty_hung_up_p(filp))
 			filp->f_op = &tty_fops;
 		goto retry_open;
 	}
-- 
2.1.3


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

* [PATCH -next 2/9] tty: Call methods in modern style
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 1/9] tty: Replace open-coded test with tty_hung_up_p() Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  2014-11-05 18:41   ` [PATCH] checkpatch: Add --strict test for function pointer calling style Joe Perches
  2014-11-05 17:26 ` [PATCH -next 3/9] tty: Remove defunct pcxe_open() declaration Peter Hurley
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

The use of older function ptr calling style, (*fn)(), makes static
analysis more error-prone; replace with modern fn() style.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/tty_io.c    | 12 ++++++------
 drivers/tty/tty_ioctl.c |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 1262368..01d45fd 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -981,7 +981,7 @@ void __stop_tty(struct tty_struct *tty)
 		return;
 	tty->stopped = 1;
 	if (tty->ops->stop)
-		(tty->ops->stop)(tty);
+		tty->ops->stop(tty);
 }
 
 void stop_tty(struct tty_struct *tty)
@@ -1012,7 +1012,7 @@ void __start_tty(struct tty_struct *tty)
 		return;
 	tty->stopped = 0;
 	if (tty->ops->start)
-		(tty->ops->start)(tty);
+		tty->ops->start(tty);
 	tty_wakeup(tty);
 }
 
@@ -1066,7 +1066,7 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
 	   situation */
 	ld = tty_ldisc_ref_wait(tty);
 	if (ld->ops->read)
-		i = (ld->ops->read)(tty, file, buf, count);
+		i = ld->ops->read(tty, file, buf, count);
 	else
 		i = -EIO;
 	tty_ldisc_deref(ld);
@@ -2182,7 +2182,7 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait)
 
 	ld = tty_ldisc_ref_wait(tty);
 	if (ld->ops->poll)
-		ret = (ld->ops->poll)(tty, filp, wait);
+		ret = ld->ops->poll(tty, filp, wait);
 	tty_ldisc_deref(ld);
 	return ret;
 }
@@ -2905,7 +2905,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		break;
 	}
 	if (tty->ops->ioctl) {
-		retval = (tty->ops->ioctl)(tty, cmd, arg);
+		retval = tty->ops->ioctl(tty, cmd, arg);
 		if (retval != -ENOIOCTLCMD)
 			return retval;
 	}
@@ -2932,7 +2932,7 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
 		return -EINVAL;
 
 	if (tty->ops->compat_ioctl) {
-		retval = (tty->ops->compat_ioctl)(tty, cmd, arg);
+		retval = tty->ops->compat_ioctl(tty, cmd, arg);
 		if (retval != -ENOIOCTLCMD)
 			return retval;
 	}
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 24a1360..1787fa4 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -550,14 +550,14 @@ int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
 	unset_locked_termios(&tty->termios, &old_termios, &tty->termios_locked);
 
 	if (tty->ops->set_termios)
-		(*tty->ops->set_termios)(tty, &old_termios);
+		tty->ops->set_termios(tty, &old_termios);
 	else
 		tty_termios_copy_hw(&tty->termios, &old_termios);
 
 	ld = tty_ldisc_ref(tty);
 	if (ld != NULL) {
 		if (ld->ops->set_termios)
-			(ld->ops->set_termios)(tty, &old_termios);
+			ld->ops->set_termios(tty, &old_termios);
 		tty_ldisc_deref(ld);
 	}
 	up_write(&tty->termios_rwsem);
-- 
2.1.3


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

* [PATCH -next 3/9] tty: Remove defunct pcxe_open() declaration
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 1/9] tty: Replace open-coded test with tty_hung_up_p() Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 2/9] tty: Call methods in modern style Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 4/9] tty: Remove defunct serial_console_init() declaration Peter Hurley
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

pcxe_open() has no definition in mainline; remove declaration.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 include/linux/tty.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/linux/tty.h b/include/linux/tty.h
index f6835ea..97cfb31 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -621,10 +621,6 @@ extern long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file,
 
 extern void serial_console_init(void);
 
-/* pcxx.c */
-
-extern int pcxe_open(struct tty_struct *tty, struct file *filp);
-
 /* vt.c */
 
 extern int vt_ioctl(struct tty_struct *tty,
-- 
2.1.3


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

* [PATCH -next 4/9] tty: Remove defunct serial_console_init() declaration
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
                   ` (2 preceding siblings ...)
  2014-11-05 17:26 ` [PATCH -next 3/9] tty: Remove defunct pcxe_open() declaration Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 5/9] serial: hp300: Remove obsolete comments Peter Hurley
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

serial_console_init() is not defined by the tty core; remove
declaration.

Note that the powerpc arch boot code contains a serial_console_init()
declaration in arch/powerpc/boot/ops.h which is restricted to
the powerpc arch boot.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 include/linux/tty.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/linux/tty.h b/include/linux/tty.h
index 97cfb31..c52a689 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -617,10 +617,6 @@ extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
 extern long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file,
 		       unsigned int cmd, unsigned long arg);
 
-/* serial.c */
-
-extern void serial_console_init(void);
-
 /* vt.c */
 
 extern int vt_ioctl(struct tty_struct *tty,
-- 
2.1.3


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

* [PATCH -next 5/9] serial: hp300: Remove obsolete comments
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
                   ` (3 preceding siblings ...)
  2014-11-05 17:26 ` [PATCH -next 4/9] tty: Remove defunct serial_console_init() declaration Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  2014-11-05 18:36   ` Geert Uytterhoeven
  2014-11-05 17:26 ` [PATCH -next 6/9] cris: Remove obsolete ASYNC_SPLIT_TERMIOS behavior Peter Hurley
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

setup_serial_console() is obsolete and has been superseded by
early_serial_setup() which is called at the end of the function.

The IA64 arch does not call this function; only the m68k arch setup
calls this function.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/8250/8250_hp300.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_hp300.c b/drivers/tty/serial/8250/8250_hp300.c
index afffe4d..b488208 100644
--- a/drivers/tty/serial/8250/8250_hp300.c
+++ b/drivers/tty/serial/8250/8250_hp300.c
@@ -88,10 +88,6 @@ extern int hp300_uart_scode;
 /*
  * Parse the bootinfo to find descriptions for headless console and
  * debug serial ports and register them with the 8250 driver.
- * This function should be called before serial_console_init() is called
- * to make sure the serial console will be available for use. IA-64 kernel
- * calls this function from setup_arch() after the EFI and ACPI tables have
- * been parsed.
  */
 int __init hp300_setup_serial_console(void)
 {
-- 
2.1.3


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

* [PATCH -next 6/9] cris: Remove obsolete ASYNC_SPLIT_TERMIOS behavior
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
                   ` (4 preceding siblings ...)
  2014-11-05 17:26 ` [PATCH -next 5/9] serial: hp300: Remove obsolete comments Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  2014-11-06  8:23   ` Jesper Nilsson
  2014-11-05 17:26 ` [PATCH -next 7/9] tty: Document defunct ASYNC_SPLIT_TERMIOS flag in uapi header Peter Hurley
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley, Mikael Starvik, Jesper Nilsson

ASYNC_SPLIT_TERMIOS behavior is a remnant of the long-dead /dev/cuaXX
callout device. Split termios handling was removed tree-wide in v2.5.71 by:

commit 99a21edebbfd8c29e39ee7fcc8a1ffa423657290
Author: Alexander Viro <viro@www.linux.org.uk>
Date:   Wed Jun 11 07:41:28 2003 -0700

    [PATCH] tty_driver refcounting

    killed the last remnants of callout stuff - we don't need to mess with
    storing termios privately anymore.

which pre-dated the re-introduction into the cris serial driver
in v2.6.7 by:

commit 311a5ffeda8ccb3f1f3840069f37234e043092d4
Author: Andrew Morton <akpm@osdl.org>
Date:   Mon May 31 18:52:29 2004 -0700

    [PATCH] CRIS architecture update

    From: "Mikael Starvik" <mikael.starvik@axis.com>

    - Lots of fixes from 2.4.

    - Updated for 2.6.6.

    - Added IDE driver

Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/crisv10.c | 12 ------------
 drivers/tty/serial/crisv10.h |  1 -
 2 files changed, 13 deletions(-)

diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index 58e6f61..0c1825b 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -3676,12 +3676,6 @@ rs_close(struct tty_struct *tty, struct file * filp)
 	}
 	info->port.flags |= ASYNC_CLOSING;
 	/*
-	 * Save the termios structure, since this port may have
-	 * separate termios for callout and dialin.
-	 */
-	if (info->port.flags & ASYNC_NORMAL_ACTIVE)
-		info->normal_termios = tty->termios;
-	/*
 	 * Now we wait for the transmit buffer to clear; and we notify
 	 * the line discipline to only process XON/XOFF characters.
 	 */
@@ -4076,11 +4070,6 @@ rs_open(struct tty_struct *tty, struct file * filp)
 		return retval;
 	}
 
-	if ((info->port.count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) {
-		tty->termios = info->normal_termios;
-		change_speed(info);
-	}
-
 #ifdef SERIAL_DEBUG_OPEN
 	printk("rs_open ttyS%d successful...\n", info->line);
 #endif
@@ -4327,7 +4316,6 @@ static int __init rs_init(void)
 		info->custom_divisor = 0;
 		info->x_char = 0;
 		info->event = 0;
-		info->normal_termios = driver->init_termios;
 		info->xmit.buf = NULL;
 		info->xmit.tail = info->xmit.head = 0;
 		info->first_recv_buffer = info->last_recv_buffer = NULL;
diff --git a/drivers/tty/serial/crisv10.h b/drivers/tty/serial/crisv10.h
index 7599014..15a52ee 100644
--- a/drivers/tty/serial/crisv10.h
+++ b/drivers/tty/serial/crisv10.h
@@ -98,7 +98,6 @@ struct e100_serial {
 
 	struct work_struct	work;
 	struct async_icount	icount;   /* error-statistics etc.*/
-	struct ktermios		normal_termios;
 
 	unsigned long char_time_usec;       /* The time for 1 char, in usecs */
 	unsigned long flush_time_usec;      /* How often we should flush */
-- 
2.1.3


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

* [PATCH -next 7/9] tty: Document defunct ASYNC_SPLIT_TERMIOS flag in uapi header
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
                   ` (5 preceding siblings ...)
  2014-11-05 17:26 ` [PATCH -next 6/9] cris: Remove obsolete ASYNC_SPLIT_TERMIOS behavior Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 8/9] vt: Remove vt_get_kmsg_redirect() from " Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 9/9] serial: 8250_em: Remove out-of-memory message Peter Hurley
  8 siblings, 0 replies; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

The last vestige of ASYNC_SPLIT_TERMIOS was removed by commit
'cris: Remove obsolete ASYNC_SPLIT_TERMIOS behavior'. Mark the flag
as defunct in the uapi header.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 include/uapi/linux/tty_flags.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/tty_flags.h b/include/uapi/linux/tty_flags.h
index 4e021e3..d2bc4ff 100644
--- a/include/uapi/linux/tty_flags.h
+++ b/include/uapi/linux/tty_flags.h
@@ -14,7 +14,7 @@
 				    * on the callout port */
 #define ASYNCB_FOURPORT		 1 /* Set OU1, OUT2 per AST Fourport settings */
 #define ASYNCB_SAK		 2 /* Secure Attention Key (Orange book) */
-#define ASYNCB_SPLIT_TERMIOS	 3 /* Separate termios for dialin/callout */
+#define ASYNCB_SPLIT_TERMIOS	 3 /* [x] Separate termios for dialin/callout */
 #define ASYNCB_SPD_HI		 4 /* Use 56000 instead of 38400 bps */
 #define ASYNCB_SPD_VHI		 5 /* Use 115200 instead of 38400 bps */
 #define ASYNCB_SKIP_TEST	 6 /* Skip UART test during autoconfiguration */
-- 
2.1.3


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

* [PATCH -next 8/9] vt: Remove vt_get_kmsg_redirect() from uapi header
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
                   ` (6 preceding siblings ...)
  2014-11-05 17:26 ` [PATCH -next 7/9] tty: Document defunct ASYNC_SPLIT_TERMIOS flag in uapi header Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  2014-11-05 17:26 ` [PATCH -next 9/9] serial: 8250_em: Remove out-of-memory message Peter Hurley
  8 siblings, 0 replies; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

vt_get_kmsg_redirect() only has meaning to the console driver as
an alias for calling vt_kmsg_redirect(). Move the macro definition
to the only source file which uses it; remove from uapi/linux/vt.h

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/vt/vt.c     | 2 ++
 include/uapi/linux/vt.h | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index b33b00b..3dc5d56 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2509,6 +2509,8 @@ int vt_kmsg_redirect(int new)
 		return kmsg_con;
 }
 
+#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
+
 /*
  *	Console on virtual terminal
  *
diff --git a/include/uapi/linux/vt.h b/include/uapi/linux/vt.h
index 4b59a26..978578b 100644
--- a/include/uapi/linux/vt.h
+++ b/include/uapi/linux/vt.h
@@ -84,7 +84,4 @@ struct vt_setactivate {
 
 #define VT_SETACTIVATE	0x560F	/* Activate and set the mode of a console */
 
-
-#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
-
 #endif /* _UAPI_LINUX_VT_H */
-- 
2.1.3


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

* [PATCH -next 9/9] serial: 8250_em: Remove out-of-memory message
  2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
                   ` (7 preceding siblings ...)
  2014-11-05 17:26 ` [PATCH -next 8/9] vt: Remove vt_get_kmsg_redirect() from " Peter Hurley
@ 2014-11-05 17:26 ` Peter Hurley
  8 siblings, 0 replies; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 17:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

devm_kzalloc() already warns if allocation fails; remove duplicate
message.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/8250/8250_em.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index 56c8723..478599d 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -102,10 +102,8 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	}
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		dev_err(&pdev->dev, "unable to allocate private data\n");
+	if (!priv)
 		return -ENOMEM;
-	}
 
 	priv->sclk = devm_clk_get(&pdev->dev, "sclk");
 	if (IS_ERR(priv->sclk)) {
-- 
2.1.3


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

* Re: [PATCH -next 5/9] serial: hp300: Remove obsolete comments
  2014-11-05 17:26 ` [PATCH -next 5/9] serial: hp300: Remove obsolete comments Peter Hurley
@ 2014-11-05 18:36   ` Geert Uytterhoeven
  0 siblings, 0 replies; 15+ messages in thread
From: Geert Uytterhoeven @ 2014-11-05 18:36 UTC (permalink / raw)
  To: Peter Hurley
  Cc: Greg Kroah-Hartman, Jiri Slaby, One Thousand Gnomes,
	linux-serial, linux-kernel

On Wed, Nov 5, 2014 at 6:26 PM, Peter Hurley <peter@hurleysoftware.com> wrote:
> setup_serial_console() is obsolete and has been superseded by
> early_serial_setup() which is called at the end of the function.
>
> The IA64 arch does not call this function; only the m68k arch setup
> calls this function.
>
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH] checkpatch: Add --strict test for function pointer calling style
  2014-11-05 17:26 ` [PATCH -next 2/9] tty: Call methods in modern style Peter Hurley
@ 2014-11-05 18:41   ` Joe Perches
  2014-11-05 19:12     ` Peter Hurley
  0 siblings, 1 reply; 15+ messages in thread
From: Joe Perches @ 2014-11-05 18:41 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Peter Hurley, linux-kernel

Peter Hurley wrote:

The use of older function ptr calling style, (*fn)(), makes static
analysis more error-prone; replace with modern fn() style.

So make checkpatch emit a --strict test for that condition.

Update the unnecessary parentheses test for dereferencing
objects at the same time and create a $fix mechanism too.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 24d6702..552e5dd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3838,9 +3838,27 @@ sub process {
 # ie: &(foo->bar) should be &foo->bar and *(foo->bar) should be *foo->bar
 
 		while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) {
-			CHK("UNNECESSARY_PARENTHESES",
-			    "Unnecessary parentheses around $1\n" . $herecurr);
-		    }
+			my $var = $1;
+			if (CHK("UNNECESSARY_PARENTHESES",
+				"Unnecessary parentheses around $var\n" . $herecurr) &&
+			    $fix) {
+				$fixed[$fixlinenr] =~ s/\(\s*\Q$var\E\s*\)/$var/;
+			}
+		}
+
+# check for unnecessary parentheses around function pointer uses
+# ie: (foo->bar)(); should be foo->bar();
+# but not "if (foo->bar) (" to avoid some false positives
+		if ($line =~ /(\bif\s*|)(\(\s*$Ident\s*(?:$Member\s*)+\))[ \t]*\(/ && $1 !~ /^if/) {
+			my $var = $2;
+			if (CHK("UNNECESSARY_PARENTHESES",
+				"Unnecessary parentheses around function pointer $var\n" . $herecurr) &&
+			    $fix) {
+				my $var2 = deparenthesize($var);
+				$var2 =~ s/\s//g;
+				$fixed[$fixlinenr] =~ s/\Q$var\E/$var2/;
+			}
+		}
 
 #goto labels aren't indented, allow a single space however
 		if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and



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

* Re: [PATCH] checkpatch: Add --strict test for function pointer calling style
  2014-11-05 18:41   ` [PATCH] checkpatch: Add --strict test for function pointer calling style Joe Perches
@ 2014-11-05 19:12     ` Peter Hurley
  2014-11-05 19:30       ` Joe Perches
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Hurley @ 2014-11-05 19:12 UTC (permalink / raw)
  To: Joe Perches, Andrew Morton; +Cc: linux-kernel

On 11/05/2014 01:41 PM, Joe Perches wrote:
> Peter Hurley wrote:
> 
> The use of older function ptr calling style, (*fn)(), makes static
> analysis more error-prone; replace with modern fn() style.
> 
> So make checkpatch emit a --strict test for that condition.
> 
> Update the unnecessary parentheses test for dereferencing
> objects at the same time and create a $fix mechanism too.

Cool.

perl's not my thing; how does it know not to trip up on

	initcall_t *call;

	(*call)();

[which I verified it properly does not flag in drivers/tty/tty_io.c]

Regards,
Peter Hurley


> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  scripts/checkpatch.pl | 24 +++++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 24d6702..552e5dd 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3838,9 +3838,27 @@ sub process {
>  # ie: &(foo->bar) should be &foo->bar and *(foo->bar) should be *foo->bar
>  
>  		while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) {
> -			CHK("UNNECESSARY_PARENTHESES",
> -			    "Unnecessary parentheses around $1\n" . $herecurr);
> -		    }
> +			my $var = $1;
> +			if (CHK("UNNECESSARY_PARENTHESES",
> +				"Unnecessary parentheses around $var\n" . $herecurr) &&
> +			    $fix) {
> +				$fixed[$fixlinenr] =~ s/\(\s*\Q$var\E\s*\)/$var/;
> +			}
> +		}
> +
> +# check for unnecessary parentheses around function pointer uses
> +# ie: (foo->bar)(); should be foo->bar();
> +# but not "if (foo->bar) (" to avoid some false positives
> +		if ($line =~ /(\bif\s*|)(\(\s*$Ident\s*(?:$Member\s*)+\))[ \t]*\(/ && $1 !~ /^if/) {
> +			my $var = $2;
> +			if (CHK("UNNECESSARY_PARENTHESES",
> +				"Unnecessary parentheses around function pointer $var\n" . $herecurr) &&
> +			    $fix) {
> +				my $var2 = deparenthesize($var);
> +				$var2 =~ s/\s//g;
> +				$fixed[$fixlinenr] =~ s/\Q$var\E/$var2/;
> +			}
> +		}
>  
>  #goto labels aren't indented, allow a single space however
>  		if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
> 
> 


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

* Re: [PATCH] checkpatch: Add --strict test for function pointer calling style
  2014-11-05 19:12     ` Peter Hurley
@ 2014-11-05 19:30       ` Joe Perches
  0 siblings, 0 replies; 15+ messages in thread
From: Joe Perches @ 2014-11-05 19:30 UTC (permalink / raw)
  To: Peter Hurley; +Cc: Andrew Morton, linux-kernel

On Wed, 2014-11-05 at 14:12 -0500, Peter Hurley wrote:
> On 11/05/2014 01:41 PM, Joe Perches wrote:
> > Peter Hurley wrote:
> > 
> > The use of older function ptr calling style, (*fn)(), makes static
> > analysis more error-prone; replace with modern fn() style.
> > 
> > So make checkpatch emit a --strict test for that condition.
> > 
> > Update the unnecessary parentheses test for dereferencing
> > objects at the same time and create a $fix mechanism too.
> 
> Cool.
> 
> perl's not my thing; how does it know not to trip up on
> 
> 	initcall_t *call;
> 
> 	(*call)();
> 
> [which I verified it properly does not flag in drivers/tty/tty_io.c]

because the regex only matches "(foo->bar)("

It doesn't match (*foo->bar)("

and foo->bar could be any number of -> or . uses like

"(foo->bar.baz)("

or

"( foo -> bar . baz ) ("


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

* Re: [PATCH -next 6/9] cris: Remove obsolete ASYNC_SPLIT_TERMIOS behavior
  2014-11-05 17:26 ` [PATCH -next 6/9] cris: Remove obsolete ASYNC_SPLIT_TERMIOS behavior Peter Hurley
@ 2014-11-06  8:23   ` Jesper Nilsson
  0 siblings, 0 replies; 15+ messages in thread
From: Jesper Nilsson @ 2014-11-06  8:23 UTC (permalink / raw)
  To: Peter Hurley
  Cc: Greg Kroah-Hartman, Jiri Slaby, One Thousand Gnomes,
	linux-serial, linux-kernel, Mikael Starvik, Jesper Nilsson

On Wed, Nov 05, 2014 at 06:26:29PM +0100, Peter Hurley wrote:
> ASYNC_SPLIT_TERMIOS behavior is a remnant of the long-dead /dev/cuaXX
> callout device. Split termios handling was removed tree-wide in v2.5.71 by:
> 
> commit 99a21edebbfd8c29e39ee7fcc8a1ffa423657290
> Author: Alexander Viro <viro@www.linux.org.uk>
> Date:   Wed Jun 11 07:41:28 2003 -0700
> 
>     [PATCH] tty_driver refcounting
> 
>     killed the last remnants of callout stuff - we don't need to mess with
>     storing termios privately anymore.
> 
> which pre-dated the re-introduction into the cris serial driver
> in v2.6.7 by:
> 
> commit 311a5ffeda8ccb3f1f3840069f37234e043092d4
> Author: Andrew Morton <akpm@osdl.org>
> Date:   Mon May 31 18:52:29 2004 -0700
> 
>     [PATCH] CRIS architecture update
> 
>     From: "Mikael Starvik" <mikael.starvik@axis.com>
> 
>     - Lots of fixes from 2.4.
> 
>     - Updated for 2.6.6.
> 
>     - Added IDE driver
> 
> Cc: Mikael Starvik <starvik@axis.com>

Agreed.

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>

> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> ---
>  drivers/tty/serial/crisv10.c | 12 ------------
>  drivers/tty/serial/crisv10.h |  1 -
>  2 files changed, 13 deletions(-)
> 
> diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
> index 58e6f61..0c1825b 100644
> --- a/drivers/tty/serial/crisv10.c
> +++ b/drivers/tty/serial/crisv10.c
> @@ -3676,12 +3676,6 @@ rs_close(struct tty_struct *tty, struct file * filp)
>  	}
>  	info->port.flags |= ASYNC_CLOSING;
>  	/*
> -	 * Save the termios structure, since this port may have
> -	 * separate termios for callout and dialin.
> -	 */
> -	if (info->port.flags & ASYNC_NORMAL_ACTIVE)
> -		info->normal_termios = tty->termios;
> -	/*
>  	 * Now we wait for the transmit buffer to clear; and we notify
>  	 * the line discipline to only process XON/XOFF characters.
>  	 */
> @@ -4076,11 +4070,6 @@ rs_open(struct tty_struct *tty, struct file * filp)
>  		return retval;
>  	}
>  
> -	if ((info->port.count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) {
> -		tty->termios = info->normal_termios;
> -		change_speed(info);
> -	}
> -
>  #ifdef SERIAL_DEBUG_OPEN
>  	printk("rs_open ttyS%d successful...\n", info->line);
>  #endif
> @@ -4327,7 +4316,6 @@ static int __init rs_init(void)
>  		info->custom_divisor = 0;
>  		info->x_char = 0;
>  		info->event = 0;
> -		info->normal_termios = driver->init_termios;
>  		info->xmit.buf = NULL;
>  		info->xmit.tail = info->xmit.head = 0;
>  		info->first_recv_buffer = info->last_recv_buffer = NULL;
> diff --git a/drivers/tty/serial/crisv10.h b/drivers/tty/serial/crisv10.h
> index 7599014..15a52ee 100644
> --- a/drivers/tty/serial/crisv10.h
> +++ b/drivers/tty/serial/crisv10.h
> @@ -98,7 +98,6 @@ struct e100_serial {
>  
>  	struct work_struct	work;
>  	struct async_icount	icount;   /* error-statistics etc.*/
> -	struct ktermios		normal_termios;
>  
>  	unsigned long char_time_usec;       /* The time for 1 char, in usecs */
>  	unsigned long flush_time_usec;      /* How often we should flush */
> -- 
> 2.1.3

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

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

end of thread, other threads:[~2014-11-06  8:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-05 17:26 [PATCH -next 0/9] various tty cleanups Peter Hurley
2014-11-05 17:26 ` [PATCH -next 1/9] tty: Replace open-coded test with tty_hung_up_p() Peter Hurley
2014-11-05 17:26 ` [PATCH -next 2/9] tty: Call methods in modern style Peter Hurley
2014-11-05 18:41   ` [PATCH] checkpatch: Add --strict test for function pointer calling style Joe Perches
2014-11-05 19:12     ` Peter Hurley
2014-11-05 19:30       ` Joe Perches
2014-11-05 17:26 ` [PATCH -next 3/9] tty: Remove defunct pcxe_open() declaration Peter Hurley
2014-11-05 17:26 ` [PATCH -next 4/9] tty: Remove defunct serial_console_init() declaration Peter Hurley
2014-11-05 17:26 ` [PATCH -next 5/9] serial: hp300: Remove obsolete comments Peter Hurley
2014-11-05 18:36   ` Geert Uytterhoeven
2014-11-05 17:26 ` [PATCH -next 6/9] cris: Remove obsolete ASYNC_SPLIT_TERMIOS behavior Peter Hurley
2014-11-06  8:23   ` Jesper Nilsson
2014-11-05 17:26 ` [PATCH -next 7/9] tty: Document defunct ASYNC_SPLIT_TERMIOS flag in uapi header Peter Hurley
2014-11-05 17:26 ` [PATCH -next 8/9] vt: Remove vt_get_kmsg_redirect() from " Peter Hurley
2014-11-05 17:26 ` [PATCH -next 9/9] serial: 8250_em: Remove out-of-memory message Peter Hurley

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