linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] serial: make serial_uart_config non-global
@ 2012-08-20 23:56 Paul Gortmaker
  2012-08-20 23:56 ` [PATCH 1/3] m32r_sio: remove dependency on struct serial_uart_config Paul Gortmaker
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paul Gortmaker @ 2012-08-20 23:56 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Paul Gortmaker, Hirokazu Takata,
	David S. Miller

I happened to notice that serial_uart_config was largely a relic
of the past and only used by two drivers (one of which was just
a trivial use case) so it seemed to make sense to reduce its scope
by removing the trivial use case and giving exclusive ownership
of the struct to the one real remaining user (sparc's sunsu.c).

Build tested on sparc64 defconfig and m32r defconfig.

Paul.
---

Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: "David S. Miller" <davem@davemloft.net>

Paul Gortmaker (3):
  m32r_sio: remove dependency on struct serial_uart_config
  serial: sunsu.c - don't explicitly tie array size to dynamic entity
  serial: diminish usage of struct serial_uart_config

 drivers/staging/speakup/serialio.h |  3 +--
 drivers/tty/serial/8250/8250.h     |  3 ---
 drivers/tty/serial/m32r_sio.c      | 36 ++----------------------------------
 drivers/tty/serial/sunsu.c         |  8 +++++++-
 include/linux/serial.h             |  6 ------
 5 files changed, 10 insertions(+), 46 deletions(-)

-- 
1.7.11.1


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

* [PATCH 1/3] m32r_sio: remove dependency on struct serial_uart_config
  2012-08-20 23:56 [PATCH 0/3] serial: make serial_uart_config non-global Paul Gortmaker
@ 2012-08-20 23:56 ` Paul Gortmaker
  2012-08-20 23:56 ` [PATCH 2/3] serial: sunsu.c - don't explicitly tie array size to dynamic entity Paul Gortmaker
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2012-08-20 23:56 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Paul Gortmaker, Hirokazu Takata

The struct serial_uart_config is hardly used at all, and the
use case like this one are somewhat needless.  Remove the
trivial usage so that we can remove serial_uart_config.

Since the type field isn't really used at all, we also delete
the initialization and references of it here as well.

Cc: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/serial/m32r_sio.c | 36 ++----------------------------------
 1 file changed, 2 insertions(+), 34 deletions(-)

diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c
index a070362..b13949a 100644
--- a/drivers/tty/serial/m32r_sio.c
+++ b/drivers/tty/serial/m32r_sio.c
@@ -44,8 +44,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#define PORT_M32R_BASE	PORT_M32R_SIO
-#define PORT_INDEX(x)	(x - PORT_M32R_BASE + 1)
 #define BAUD_RATE	115200
 
 #include <linux/serial_core.h>
@@ -132,22 +130,6 @@ struct irq_info {
 
 static struct irq_info irq_lists[NR_IRQS];
 
-/*
- * Here we define the default xmit fifo size used for each type of UART.
- */
-static const struct serial_uart_config uart_config[] = {
-	[PORT_UNKNOWN] = {
-		.name			= "unknown",
-		.dfl_xmit_fifo_size	= 1,
-		.flags			= 0,
-	},
-	[PORT_INDEX(PORT_M32R_SIO)] = {
-		.name			= "M32RSIO",
-		.dfl_xmit_fifo_size	= 1,
-		.flags			= 0,
-	},
-};
-
 #ifdef CONFIG_SERIAL_M32R_PLDSIO
 
 #define __sio_in(x) inw((unsigned long)(x))
@@ -907,8 +889,7 @@ static void m32r_sio_config_port(struct uart_port *port, int unused)
 
 	spin_lock_irqsave(&up->port.lock, flags);
 
-	up->port.type = (PORT_M32R_SIO - PORT_M32R_BASE + 1);
-	up->port.fifosize = uart_config[up->port.type].dfl_xmit_fifo_size;
+	up->port.fifosize = 1;
 
 	spin_unlock_irqrestore(&up->port.lock, flags);
 }
@@ -916,23 +897,11 @@ static void m32r_sio_config_port(struct uart_port *port, int unused)
 static int
 m32r_sio_verify_port(struct uart_port *port, struct serial_struct *ser)
 {
-	if (ser->irq >= nr_irqs || ser->irq < 0 ||
-	    ser->baud_base < 9600 || ser->type < PORT_UNKNOWN ||
-	    ser->type >= ARRAY_SIZE(uart_config))
+	if (ser->irq >= nr_irqs || ser->irq < 0 || ser->baud_base < 9600)
 		return -EINVAL;
 	return 0;
 }
 
-static const char *
-m32r_sio_type(struct uart_port *port)
-{
-	int type = port->type;
-
-	if (type >= ARRAY_SIZE(uart_config))
-		type = 0;
-	return uart_config[type].name;
-}
-
 static struct uart_ops m32r_sio_pops = {
 	.tx_empty	= m32r_sio_tx_empty,
 	.set_mctrl	= m32r_sio_set_mctrl,
@@ -946,7 +915,6 @@ static struct uart_ops m32r_sio_pops = {
 	.shutdown	= m32r_sio_shutdown,
 	.set_termios	= m32r_sio_set_termios,
 	.pm		= m32r_sio_pm,
-	.type		= m32r_sio_type,
 	.release_port	= m32r_sio_release_port,
 	.request_port	= m32r_sio_request_port,
 	.config_port	= m32r_sio_config_port,
-- 
1.7.11.1


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

* [PATCH 2/3] serial: sunsu.c - don't explicitly tie array size to dynamic entity
  2012-08-20 23:56 [PATCH 0/3] serial: make serial_uart_config non-global Paul Gortmaker
  2012-08-20 23:56 ` [PATCH 1/3] m32r_sio: remove dependency on struct serial_uart_config Paul Gortmaker
@ 2012-08-20 23:56 ` Paul Gortmaker
  2012-08-20 23:56 ` [PATCH 3/3] serial: diminish usage of struct serial_uart_config Paul Gortmaker
  2012-08-21  9:06 ` [PATCH 0/3] serial: make serial_uart_config non-global Alan Cox
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2012-08-20 23:56 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Paul Gortmaker, David S. Miller

The addition of 8250-like entities continues to grow, while this
driver has a snapshot of a select few common 8250 UARTs.  So it
has no need to grow with the new additions, since it calls out
its own (largely historic) static list which does not grow.

Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/tty/serial/sunsu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 675303b..d919095 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -61,7 +61,7 @@ static char *su_typev[] = { "su(???)", "su(mouse)", "su(kbd)", "su(serial)" };
 /*
  * Here we define the default xmit fifo size used for each type of UART.
  */
-static const struct serial_uart_config uart_config[PORT_MAX_8250+1] = {
+static const struct serial_uart_config uart_config[] = {
 	{ "unknown",	1,	0 },
 	{ "8250",	1,	0 },
 	{ "16450",	1,	0 },
-- 
1.7.11.1


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

* [PATCH 3/3] serial: diminish usage of struct serial_uart_config
  2012-08-20 23:56 [PATCH 0/3] serial: make serial_uart_config non-global Paul Gortmaker
  2012-08-20 23:56 ` [PATCH 1/3] m32r_sio: remove dependency on struct serial_uart_config Paul Gortmaker
  2012-08-20 23:56 ` [PATCH 2/3] serial: sunsu.c - don't explicitly tie array size to dynamic entity Paul Gortmaker
@ 2012-08-20 23:56 ` Paul Gortmaker
  2012-08-21  9:06 ` [PATCH 0/3] serial: make serial_uart_config non-global Alan Cox
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2012-08-20 23:56 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Paul Gortmaker, David S. Miller

This structure might have made sense many years ago, but at this
point it is only used in one specific driver, and referenced in
stale comments elsewhere.  Rather than change the sunsu.c driver,
simply move the struct to be within the exclusive domain of that
driver, so it won't get inadvertently picked up and used by other
serial drivers going forward.  The comments referencing the now
driver specific struct are updated accordingly.

Note that 8250.c has a struct that is similar in usage, with the
name serial8250_config; but is 100% independent and untouched here.

Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/staging/speakup/serialio.h | 3 +--
 drivers/tty/serial/8250/8250.h     | 3 ---
 drivers/tty/serial/sunsu.c         | 6 ++++++
 include/linux/serial.h             | 6 ------
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/speakup/serialio.h b/drivers/staging/speakup/serialio.h
index 614271f..55d68b5 100644
--- a/drivers/staging/speakup/serialio.h
+++ b/drivers/staging/speakup/serialio.h
@@ -1,8 +1,7 @@
 #ifndef _SPEAKUP_SERIAL_H
 #define _SPEAKUP_SERIAL_H
 
-#include <linux/serial.h>	/* for rs_table, serial constants &
-				   serial_uart_config */
+#include <linux/serial.h>	/* for rs_table, serial constants */
 #include <linux/serial_reg.h>	/* for more serial constants */
 #ifndef __sparc__
 #include <asm/serial.h>
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 972b521..0c5e908 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -26,9 +26,6 @@ struct old_serial_port {
 	unsigned long irqflags;
 };
 
-/*
- * This replaces serial_uart_config in include/linux/serial.h
- */
 struct serial8250_config {
 	const char	*name;
 	unsigned short	fifo_size;
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index d919095..b97913d 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -58,6 +58,12 @@
 enum su_type { SU_PORT_NONE, SU_PORT_MS, SU_PORT_KBD, SU_PORT_PORT };
 static char *su_typev[] = { "su(???)", "su(mouse)", "su(kbd)", "su(serial)" };
 
+struct serial_uart_config {
+	char	*name;
+	int	dfl_xmit_fifo_size;
+	int	flags;
+};
+
 /*
  * Here we define the default xmit fifo size used for each type of UART.
  */
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 90e9f98..11f365c 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -83,12 +83,6 @@ struct serial_struct {
 #define SERIAL_IO_HUB6	1
 #define SERIAL_IO_MEM	2
 
-struct serial_uart_config {
-	char	*name;
-	int	dfl_xmit_fifo_size;
-	int	flags;
-};
-
 #define UART_CLEAR_FIFO		0x01
 #define UART_USE_FIFO		0x02
 #define UART_STARTECH		0x04
-- 
1.7.11.1


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

* Re: [PATCH 0/3] serial: make serial_uart_config non-global
  2012-08-20 23:56 [PATCH 0/3] serial: make serial_uart_config non-global Paul Gortmaker
                   ` (2 preceding siblings ...)
  2012-08-20 23:56 ` [PATCH 3/3] serial: diminish usage of struct serial_uart_config Paul Gortmaker
@ 2012-08-21  9:06 ` Alan Cox
  3 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2012-08-21  9:06 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-serial, Alan Cox, Greg Kroah-Hartman, Hirokazu Takata,
	David S. Miller

On Mon, 20 Aug 2012 19:56:25 -0400
Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> I happened to notice that serial_uart_config was largely a relic
> of the past and only used by two drivers (one of which was just
> a trivial use case) so it seemed to make sense to reduce its scope
> by removing the trivial use case and giving exclusive ownership
> of the struct to the one real remaining user (sparc's sunsu.c).
> 
> Build tested on sparc64 defconfig and m32r defconfig.

Looks good to me from the tty side.


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

end of thread, other threads:[~2012-08-21  9:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 23:56 [PATCH 0/3] serial: make serial_uart_config non-global Paul Gortmaker
2012-08-20 23:56 ` [PATCH 1/3] m32r_sio: remove dependency on struct serial_uart_config Paul Gortmaker
2012-08-20 23:56 ` [PATCH 2/3] serial: sunsu.c - don't explicitly tie array size to dynamic entity Paul Gortmaker
2012-08-20 23:56 ` [PATCH 3/3] serial: diminish usage of struct serial_uart_config Paul Gortmaker
2012-08-21  9:06 ` [PATCH 0/3] serial: make serial_uart_config non-global Alan Cox

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