Skip to contentSkip to conversation

First block of the tty backlog

PATCH In review Alan Cox 6 participants 33 messages Oct 10, 2008 – Dec 29, 2008

Subsystems (5)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

cover First block of the tty backlog

This series of patches implements the various corrections, removals and fixups that do not form part of the core tty updates. It also omits some 8250 patches which have a dependancy on Ingo's upcoming submission to remove NR_IRQ.

These have been sitting in linux-next for quite some time

Alan
---

Adrian Bunk (1):
coldfire: scheduled SERIAL_COLDFIRE removal

Akinobu Mita (1):
ip2: avoid add_timer with pending timer

Alan Cox (4):
serial_8250: pci_enable_device fail is not fully handled
ftdi: A few errors are err() that should be debug which causes much spewage
nozomi: Fix close on error
epca: call tty_port_init

Andrew Morton (1):
serial-make-uart_ports-ioport-unsigned-long-fix

David Miller (1):
serial: Make uart_port's ioport "unsigned long".

Graf Yang (1):
Blackfin Serial Driver: Fix bug - ircp fails on sir over Blackfin UART

Jason Wessel (1):
usb: fix pl2303 initialization

Jiri Slaby (6):
ip2, init/deinit cleanup
ip2, fix sparse warnings
ip2, cleanup globals
Char: merge ip2main and ip2base
Char: sx, fix io unmapping
Char: cyclades. remove bogus iomap

Julia Lawall (2):
drivers/char/hvc_console.c: adjust call to put_tty_driver drivers/serial/crisv10.c: add missing put_tty_driver

Mike Frysinger (3):
Blackfin Serial Driver: move common variables out of serial headers and into the serial driver Blackfin Serial Driver: trim trailing whitespace -- no functional changes Blackfin Serial Driver: use __initdata for data, not __init

Miloslav Trmac (1):
audit: Handle embedded NUL in TTY input auditing

Scott Ashcroft (1):
Fix oti6858 debug level

Sonic Zhang (4):
Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode Blackfin Serial Driver: Fix bug - Don't call tx_stop in tx_transfer. Blackfin Serial Driver: Remove useless stop
Blackfin Serial Driver: Fix bug - should suspend/resume/remove all uart ports.

 Documentation/feature-removal-schedule.txt         |    8 
 arch/blackfin/kernel/bfin_dma_5xx.c                |   13 
 .../mach-bf527/include/mach/bfin_serial_5xx.h      |    6 
 .../mach-bf533/include/mach/bfin_serial_5xx.h      |    4 
 .../mach-bf537/include/mach/bfin_serial_5xx.h      |    6 
 .../mach-bf548/include/mach/bfin_serial_5xx.h      |    6 
 .../mach-bf561/include/mach/bfin_serial_5xx.h      |    4 
 drivers/char/cyclades.c                            |   21 
 drivers/char/epca.c                                |    5 
 drivers/char/hvc_console.c                         |    4 
 drivers/char/ip2/Makefile                          |    2 
 drivers/char/ip2/i2ellis.c                         |   32 
 drivers/char/ip2/i2ellis.h                         |    2 
 drivers/char/ip2/ip2base.c                         |  108 -
 drivers/char/ip2/ip2main.c                         |  544 +++---
 drivers/char/nozomi.c                              |    5 
 drivers/char/sx.c                                  |    4 
 drivers/char/tty_audit.c                           |    2 
 drivers/serial/8250_pci.c                          |    4 
 drivers/serial/Kconfig                             |   16 
 drivers/serial/Makefile                            |    1 
 drivers/serial/bfin_5xx.c                          |  123 +
 drivers/serial/crisv10.c                           |    2 
 drivers/serial/mcfserial.c                         | 1965 --------------------
 drivers/serial/mcfserial.h                         |   74 -
 drivers/serial/serial_core.c                       |    5 
 drivers/usb/serial/ftdi_sio.c                      |    6 
 drivers/usb/serial/oti6858.c                       |    4 
 drivers/usb/serial/pl2303.c                        |   11 
 include/linux/serial_core.h                        |    2 
 30 files changed, 430 insertions(+), 2559 deletions(-)
 delete mode 100644 drivers/char/ip2/ip2base.c
 delete mode 100644 drivers/serial/mcfserial.c
 delete mode 100644 drivers/serial/mcfserial.h
Signature · 1 line
Signature
author
#1 lore raw

PATCH 1/27 drivers/serial/crisv10.c: add missing put_tty_driver

From: Julia Lawall <[email protected]>

alloc_tty_driver is called at the beginning of the function containing the lines of code shown in the patch. Thus, put_tty_driver is needed before returning in the error handling code.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@nr exists@
local idexpression x;
expression E,f;
position p1,p2,p3;
identifier l;
statement S;
@@

x = alloc_tty_driver@p1(...)
...
if (x == NULL) S
... when != E = x

    when != put_tty_driver(x)
    when != goto l;

(
return \(0\|x\);
|
return@p3 ...;
)

@script:python@
p1 << nr.p1;
p3 << nr.p3;
@@

print "%s: call on line %s not freed or saved before return on line %s" % (p1[0].file,p1[0].line,p3[0].line) // </smpl>

---

 drivers/serial/crisv10.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/serial/crisv10.c +2 -0
index bf94a77..a467c77 100644
@@ -4419,6 +4419,7 @@ rs_init(void)
 			rs485_pa_bit)) {
 		printk(KERN_CRIT "ETRAX100LX serial: Could not allocate "
 			"RS485 pin\n");
+		put_tty_driver(driver);
 		return -EBUSY;
 	}
 #endif
@@ -4427,6 +4428,7 @@ rs_init(void)
 			rs485_port_g_bit)) {
 		printk(KERN_CRIT "ETRAX100LX serial: Could not allocate "
 			"RS485 pin\n");
+		put_tty_driver(driver);
 		return -EBUSY;
 	}
 #endif
#2 lore raw

Should <linux/serial.h> define __u32?

Hi Alan and Linus,

A little background to explain the reason for my question:

My linux distribution just updated /usr/include/linux to 2.6.28, which broke the compilation of wine.

The cause for the breakage is this commit by Linus:
commit c26c56c0f40e200e61d1390629c806f6adaffbcc

Author: Alan Cox <[email protected]>
Date:   Mon Oct 13 10:37:48 2008 +0100

tty: Cris has a nice RS485 ioctl so we should steal it

That commit introduced this new struct in serial.h:

+struct serial_rs485 {

+       __u32   flags;                  /* RS485 feature flags */
+#define SER_RS485_ENABLED              (1 << 0)
+#define SER_RS485_RTS_ON_SEND          (1 << 1)
+#define SER_RS485_RTS_AFTER_SEND       (1 << 2)
+       __u32   delay_rts_before_send;  /* Milliseconds */
+       __u32   padding[6];             /* Memory is cheap, new structs

+ are a royal PITA .. */
+};

The proximate cause of the wine breakage is the __u32, which wasn't used in serial.h until now.

So, my question is: who should be responsible for defining that __u32, the author of serial.h or the author of the wine code that includes serial.h?

I'm not a professional programmer, just a hobbyist who loves doing this stuff. When I try to trace the chain of definitions in /usr/include I'm generally overwhelmed by the complexity of what seems to be an endless chain of includes.

Could you give me The Big Picture here? (For example I'm assuming that POSIX plays a confounding role in all of this, but I don't know just how.)

Many thanks for any clues!

#3 lore raw

Re: Should <linux/serial.h> define __u32?

Quoted 6 lines · On Sun, 28 Dec 2008 14:24:36 -0800 walt <[email protected]> wrote:

Hi Alan and Linus,

A little background to explain the reason for my question:

My linux distribution just updated /usr/include/linux to 2.6.28, which broke the compilation of wine.

I believe there is a patch queued for that one. It's certainly already got a bug filed and I'm pretty sure its in the patch queue. I'll take a look when I'm back at work.

#4 lore raw

Re: Should <linux/serial.h> define __u32?

In reply to walt
Quoted 3 lines · walt

So, my question is: who should be responsible for defining that __u32, the author of serial.h or the author of the wine code that includes serial.h?

the kernel header should be doing #include <linux/serial.h>

if your distro doesnt patch their current headers to do this, then you should open a bug report for them
-mike

author
#5 lore raw

PATCH 2/27 drivers/char/hvc_console.c: adjust call to put_tty_driver

In reply to Alan Cox

From: Julia Lawall <[email protected]>

The call to put_tty_driver is out of place and is applied to the wrong argument.

The function enclosing the patched code calls alloc_tty_driver and stores the result in drv. Subsequently, there are two occurrences of error handling code, one making a goto to put_tty and one making a goto to stop_thread. At the point of the first one the assignment hvc_driver = drv has not yet been executed, and from inspecting the rest of the file it seems that hvc_driver would be NULL. Thus the current call to put_tty_driver is useless, and one applied to drv is needed. The goto stop_thread is in the error handling code for a call to tty_register_driver, but the error cases in tty_register_driver do not free its argument, so it should be done here. Thus, I have moved the put_tty label after the stop_thread label, so that put_tty_driver is called in both cases.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
expression E,f;
position p1,p2,p3;
identifier l;
statement S;
@@

x = alloc_tty_driver@p1(...)
...
if (x == NULL) S
... when != E = x

    when != put_tty_driver(x)
goto@p2 l;
... when != E = x
    when != f(...,x,...)
    when any

(
return \(0\|x\);
|
return@p3 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
p3 << r.p3;
@@

print "%s: call on line %s not freed or saved before return on line %s via line %s" % (p1[0].file,p1[0].line,p3[0].line,p2[0].line) // </smpl>

---

 drivers/char/hvc_console.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/char/hvc_console.c +2 -2
index fd64137..ec7aded 100644
@@ -819,11 +819,11 @@ static int hvc_init(void)
 	hvc_driver = drv;
 	return 0;
 
-put_tty:
-	put_tty_driver(hvc_driver);
 stop_thread:
 	kthread_stop(hvc_task);
 	hvc_task = NULL;
+put_tty:
+	put_tty_driver(drv);
 out:
 	return err;
 }
author
#6 lore raw

PATCH 3/27 coldfire: scheduled SERIAL_COLDFIRE removal

In reply to Alan Cox

From: Adrian Bunk <[email protected]>

This patch contains the scheduled removal of the obsolete SERIAL_COLDFIRE driver.

---

 Documentation/feature-removal-schedule.txt |    8 
 drivers/serial/Kconfig                     |   16 
 drivers/serial/Makefile                    |    1 
 drivers/serial/mcfserial.c                 | 1965 ----------------------------
 drivers/serial/mcfserial.h                 |   74 -
 5 files changed, 2 insertions(+), 2062 deletions(-)
 delete mode 100644 drivers/serial/mcfserial.c
 delete mode 100644 drivers/serial/mcfserial.h
Documentation/feature-removal-schedule.txt +0 -8
index 83c88ca..e5c3f9d 100644
@@ -266,14 +266,6 @@ Who:	Glauber Costa <[email protected]>
 
 ---------------------------
 
-What:	old style serial driver for ColdFire (CONFIG_SERIAL_COLDFIRE)
-When:	2.6.28
-Why:	This driver still uses the old interface and has been replaced
-	by CONFIG_SERIAL_MCF.
-Who:	Sebastian Siewior <[email protected]>
-
----------------------------
-
 What:	/sys/o2cb symlink
 When:	January 2010
 Why:	/sys/fs/o2cb is the proper location for this information - /sys/o2cb
drivers/serial/Kconfig +2 -14
index 77cb342..0db2045 100644
@@ -994,24 +994,12 @@ config SERIAL_68328_RTS_CTS
 	bool "Support RTS/CTS on 68328 serial port"
 	depends on SERIAL_68328
 
-config SERIAL_COLDFIRE
-	bool "ColdFire serial support (DEPRECATED)"
-	depends on COLDFIRE
-	help
-	  This driver supports the built-in serial ports of the Motorola ColdFire
-	  family of CPUs.
-	  This driver is deprecated because it supports only the old interface
-	  for serial drivers and features like magic keys are not working.
-	  Please switch to the new style driver because this driver will be
-	  removed soon.
-
 config SERIAL_MCF
-	bool "Coldfire serial support (new style driver)"
+	bool "Coldfire serial support"
 	depends on COLDFIRE
 	select SERIAL_CORE
 	help
-	  This new serial driver supports the Freescale Coldfire serial ports
-	  using the new serial driver subsystem.
+	  This serial driver supports the Freescale Coldfire serial ports.
 
 config SERIAL_MCF_BAUDRATE
 	int "Default baudrate for Coldfire serial ports"
drivers/serial/Makefile +0 -1
index 7e7383e..1462eb3 100644
@@ -40,7 +40,6 @@ obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o
 obj-$(CONFIG_SERIAL_MUX) += mux.o
 obj-$(CONFIG_SERIAL_68328) += 68328serial.o
 obj-$(CONFIG_SERIAL_68360) += 68360serial.o
-obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o
 obj-$(CONFIG_SERIAL_MCF) += mcf.o
 obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o
 obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o
drivers/serial/mcfserial.c deleted +0 -1965

1,965 lines not on this page · raw message

drivers/serial/mcfserial.h deleted +0 -74

74 lines not on this page · raw message

author
#7 lore raw

PATCH 4/27 epca: call tty_port_init

In reply to Alan Cox

---

 drivers/char/epca.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/char/epca.c +1 -4
index 456e4ed..4998b27 100644
@@ -1376,6 +1376,7 @@ static void post_fep_init(unsigned int crd)
 		unsigned long flags;
 		u16 tseg, rseg;
 
+		tty_port_init(&ch->port);
 		ch->brdchan = bc;
 		ch->mailbox = gd;
 		INIT_WORK(&ch->tqueue, do_softint);
@@ -1510,10 +1511,6 @@ static void post_fep_init(unsigned int crd)
 		ch->fepstopca = 0;
 
 		ch->close_delay = 50;
-		ch->port.count = 0;
-		ch->port.blocked_open = 0;
-		init_waitqueue_head(&ch->port.open_wait);
-		init_waitqueue_head(&ch->port.close_wait);
 
 		spin_unlock_irqrestore(&epca_lock, flags);
 	}
author
#8 lore raw

PATCH 5/27 Blackfin Serial Driver: use __initdata for data, not __init

In reply to Alan Cox

From: Mike Frysinger <[email protected]>

---

 drivers/serial/bfin_5xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/bfin_5xx.c +1 -1
index 4a0d30b..4a023c6 100644
@@ -1056,7 +1056,7 @@ static __init void early_serial_write(struct console *con, const char *s,
 	}
 }
 
-static struct __init console bfin_early_serial_console = {
+static struct __initdata console bfin_early_serial_console = {
 	.name = "early_BFuart",
 	.write = early_serial_write,
 	.device = uart_console_device,
author
#9 lore raw

PATCH 6/27 Blackfin Serial Driver: Fix bug - should suspend/resume/remove all uart ports.

In reply to Alan Cox

From: Sonic Zhang <[email protected]>

---

 drivers/serial/bfin_5xx.c |   39 ++++++++++++++++++++++-----------------
 1 files changed, 22 insertions(+), 17 deletions(-)
drivers/serial/bfin_5xx.c +22 -17
index 4a023c6..04eeef0 100644
@@ -1100,20 +1100,26 @@ static struct uart_driver bfin_serial_reg = {
 
 static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state)
 {
-	struct bfin_serial_port *uart = platform_get_drvdata(dev);
+	int i;
 
-	if (uart)
-		uart_suspend_port(&bfin_serial_reg, &uart->port);
+	for (i = 0; i < nr_ports; i++) {
+		if (bfin_serial_ports[i].port.dev != &dev->dev)
+			continue;
+		uart_suspend_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
+	}
 
 	return 0;
 }
 
 static int bfin_serial_resume(struct platform_device *dev)
 {
-	struct bfin_serial_port *uart = platform_get_drvdata(dev);
+	int i;
 
-	if (uart)
-		uart_resume_port(&bfin_serial_reg, &uart->port);
+	for (i = 0; i < nr_ports; i++) {
+		if (bfin_serial_ports[i].port.dev != &dev->dev)
+			continue;
+		uart_resume_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
+	}
 
 	return 0;
 }
@@ -1133,27 +1139,26 @@ static int bfin_serial_probe(struct platform_device *dev)
 				continue;
 			bfin_serial_ports[i].port.dev = &dev->dev;
 			uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
-			platform_set_drvdata(dev, &bfin_serial_ports[i]);
 		}
 	}
 
 	return 0;
 }
 
-static int bfin_serial_remove(struct platform_device *pdev)
+static int bfin_serial_remove(struct platform_device *dev)
 {
-	struct bfin_serial_port *uart = platform_get_drvdata(pdev);
-
+	int i;
 
+	for (i = 0; i < nr_ports; i++) {
+		if (bfin_serial_ports[i].port.dev != &dev->dev)
+			continue;
+		uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
+		bfin_serial_ports[i].port.dev = NULL;
 #ifdef CONFIG_SERIAL_BFIN_CTSRTS
-	gpio_free(uart->cts_pin);
-	gpio_free(uart->rts_pin);
+		gpio_free(bfin_serial_ports[i].cts_pin);
+		gpio_free(bfin_serial_ports[i].rts_pin);
 #endif
-
-	platform_set_drvdata(pdev, NULL);
-
-	if (uart)
-		uart_remove_one_port(&bfin_serial_reg, &uart->port);
+	}
 
 	return 0;
 }
author
#10 lore raw

PATCH 7/27 Blackfin Serial Driver: trim trailing whitespace -- no functional changes

In reply to Alan Cox

From: Mike Frysinger <[email protected]>

---

 drivers/serial/bfin_5xx.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/serial/bfin_5xx.c +4 -4
index 04eeef0..976de91 100644
@@ -1,7 +1,7 @@
 /*
  * Blackfin On-Chip Serial Driver
  *
- * Copyright 2006-2007 Analog Devices Inc.
+ * Copyright 2006-2008 Analog Devices Inc.
  *
  * Enter bugs at http://blackfin.uclinux.org/
  *
@@ -126,13 +126,13 @@ static int kgdb_entry_state;
 void kgdb_put_debug_char(int chr)
 {
 	struct bfin_serial_port *uart;
-	
+
 	if (CONFIG_KGDB_UART_PORT < 0
 		|| CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS)
 		uart = &bfin_serial_ports[0];
 	else
 		uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];
-	
+
 	while (!(UART_GET_LSR(uart) & THRE)) {
 		SSYNC();
 	}
@@ -152,7 +152,7 @@ int kgdb_get_debug_char(void)
 		uart = &bfin_serial_ports[0];
 	else
 		uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];
-	
+
 	while(!(UART_GET_LSR(uart) & DR)) {
 		SSYNC();
 	}
author
#11 lore raw

PATCH 8/27 Blackfin Serial Driver: move common variables out of serial headers and into the serial driver

In reply to Alan Cox

From: Mike Frysinger <[email protected]>

move common variables out of serial headers and into the serial driver and rename "nr_ports" to "nr_active_ports" so as to easily differentiat between BFIN_UART_NR_PORTS (the # of available) and nr_ports (the # of enabled)

---

 .../mach-bf527/include/mach/bfin_serial_5xx.h      |    3 ---
 .../mach-bf533/include/mach/bfin_serial_5xx.h      |    2 --
 .../mach-bf537/include/mach/bfin_serial_5xx.h      |    3 ---
 .../mach-bf548/include/mach/bfin_serial_5xx.h      |    3 ---
 .../mach-bf561/include/mach/bfin_serial_5xx.h      |    2 --
 drivers/serial/bfin_5xx.c                          |   17 ++++++++++-------
 6 files changed, 10 insertions(+), 20 deletions(-)
arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h +0 -3
index 2526b6e..a23d047 100644
@@ -119,7 +119,6 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
 	bfin_write16(uart->port.membase + OFFSET_LSR, -1);
 }
 
-struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
 struct bfin_serial_res {
 	unsigned long uart_base_addr;
 	int uart_irq;
@@ -164,8 +163,6 @@ struct bfin_serial_res bfin_serial_resource[] = {
 #endif
 };
 
-int nr_ports = ARRAY_SIZE(bfin_serial_resource);
-
 #define DRIVER_NAME "bfin-uart"
 
 static void bfin_serial_hw_init(struct bfin_serial_port *uart)
arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h +0 -2
index ebf592b..20471cd 100644
@@ -111,7 +111,6 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
 	bfin_write16(uart->port.membase + OFFSET_LSR, -1);
 }
 
-struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
 struct bfin_serial_res {
 	unsigned long	uart_base_addr;
 	int		uart_irq;
@@ -142,7 +141,6 @@ struct bfin_serial_res bfin_serial_resource[] = {
 
 #define DRIVER_NAME "bfin-uart"
 
-int nr_ports = BFIN_UART_NR_PORTS;
 static void bfin_serial_hw_init(struct bfin_serial_port *uart)
 {
 
arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h +0 -3
index 1bf56ff..08dfe30 100644
@@ -119,7 +119,6 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
 	bfin_write16(uart->port.membase + OFFSET_LSR, -1);
 }
 
-struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
 struct bfin_serial_res {
 	unsigned long	uart_base_addr;
 	int		uart_irq;
@@ -164,8 +163,6 @@ struct bfin_serial_res bfin_serial_resource[] = {
 #endif
 };
 
-int nr_ports = ARRAY_SIZE(bfin_serial_resource);
-
 #define DRIVER_NAME "bfin-uart"
 
 static void bfin_serial_hw_init(struct bfin_serial_port *uart)
arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h +0 -3
index 5e29446..76976b1 100644
@@ -105,7 +105,6 @@ struct bfin_serial_port {
 #endif
 };
 
-struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
 struct bfin_serial_res {
 	unsigned long	uart_base_addr;
 	int		uart_irq;
@@ -170,8 +169,6 @@ struct bfin_serial_res bfin_serial_resource[] = {
 #endif
 };
 
-int nr_ports = ARRAY_SIZE(bfin_serial_resource);
-
 #define DRIVER_NAME "bfin-uart"
 
 static void bfin_serial_hw_init(struct bfin_serial_port *uart)
arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h +0 -2
index 8aa0278..6cddca4 100644
@@ -111,7 +111,6 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart)
 	bfin_write16(uart->port.membase + OFFSET_LSR, -1);
 }
 
-struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
 struct bfin_serial_res {
 	unsigned long	uart_base_addr;
 	int		uart_irq;
@@ -142,7 +141,6 @@ struct bfin_serial_res bfin_serial_resource[] = {
 
 #define DRIVER_NAME "bfin-uart"
 
-int nr_ports = BFIN_UART_NR_PORTS;
 static void bfin_serial_hw_init(struct bfin_serial_port *uart)
 {
 
drivers/serial/bfin_5xx.c +10 -7
index 976de91..382fb8d 100644
@@ -42,6 +42,9 @@
 #define BFIN_SERIAL_MAJOR	204
 #define BFIN_SERIAL_MINOR	64
 
+static struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
+static int nr_active_ports = ARRAY_SIZE(bfin_serial_resource);
+
 /*
  * Setup for console. Argument comes from the menuconfig
  */
@@ -859,7 +862,7 @@ static void __init bfin_serial_init_ports(void)
 		return;
 	first = 0;
 
-	for (i = 0; i < nr_ports; i++) {
+	for (i = 0; i < nr_active_ports; i++) {
 		bfin_serial_ports[i].port.uartclk   = get_sclk();
 		bfin_serial_ports[i].port.ops       = &bfin_serial_pops;
 		bfin_serial_ports[i].port.line      = i;
@@ -961,7 +964,7 @@ bfin_serial_console_setup(struct console *co, char *options)
 	 * if so, search for the first available port that does have
 	 * console support.
 	 */
-	if (co->index == -1 || co->index >= nr_ports)
+	if (co->index == -1 || co->index >= nr_active_ports)
 		co->index = 0;
 	uart = &bfin_serial_ports[co->index];
 
@@ -1072,7 +1075,7 @@ struct console __init *bfin_earlyserial_init(unsigned int port,
 	struct bfin_serial_port *uart;
 	struct ktermios t;
 
-	if (port == -1 || port >= nr_ports)
+	if (port == -1 || port >= nr_active_ports)
 		port = 0;
 	bfin_serial_init_ports();
 	bfin_early_serial_console.index = port;
@@ -1102,7 +1105,7 @@ static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state)
 {
 	int i;
 
-	for (i = 0; i < nr_ports; i++) {
+	for (i = 0; i < nr_active_ports; i++) {
 		if (bfin_serial_ports[i].port.dev != &dev->dev)
 			continue;
 		uart_suspend_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
@@ -1115,7 +1118,7 @@ static int bfin_serial_resume(struct platform_device *dev)
 {
 	int i;
 
-	for (i = 0; i < nr_ports; i++) {
+	for (i = 0; i < nr_active_ports; i++) {
 		if (bfin_serial_ports[i].port.dev != &dev->dev)
 			continue;
 		uart_resume_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
@@ -1134,7 +1137,7 @@ static int bfin_serial_probe(struct platform_device *dev)
 			break;
 
 	if (i < dev->num_resources) {
-		for (i = 0; i < nr_ports; i++, res++) {
+		for (i = 0; i < nr_active_ports; i++, res++) {
 			if (bfin_serial_ports[i].port.mapbase != res->start)
 				continue;
 			bfin_serial_ports[i].port.dev = &dev->dev;
@@ -1149,7 +1152,7 @@ static int bfin_serial_remove(struct platform_device *dev)
 {
 	int i;
 
-	for (i = 0; i < nr_ports; i++) {
+	for (i = 0; i < nr_active_ports; i++) {
 		if (bfin_serial_ports[i].port.dev != &dev->dev)
 			continue;
 		uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
author
#12 lore raw

PATCH 9/27 Blackfin Serial Driver: Remove useless stop

In reply to Alan Cox

From: Sonic Zhang <[email protected]>

---

 drivers/serial/bfin_5xx.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/serial/bfin_5xx.c +0 -3
index 382fb8d..8d2d757 100644
@@ -320,9 +320,6 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&uart->port);
-
-	if (uart_circ_empty(xmit))
-		bfin_serial_stop_tx(&uart->port);
 }
 
 static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id)
author
#13 lore raw

PATCH 10/27 Blackfin Serial Driver: Fix bug - Don't call tx_stop in tx_transfer.

In reply to Alan Cox

From: Sonic Zhang <[email protected]>

Disable irq and return immediately.

---

 drivers/serial/bfin_5xx.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/serial/bfin_5xx.c +5 -1
index 8d2d757..5e20f50 100644
@@ -301,7 +301,11 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
 	bfin_serial_mctrl_check(uart);
 
 	if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) {
-		bfin_serial_stop_tx(&uart->port);
+#ifdef CONFIG_BF54x
+		/* Clear TFI bit */
+		UART_PUT_LSR(uart, TFI);
+#endif
+		UART_CLEAR_IER(uart, ETBEI);
 		return;
 	}
 
author
#14 lore raw

PATCH 11/27 Blackfin Serial Driver: Fix bug - ircp fails on sir over Blackfin UART

In reply to Alan Cox

From: Graf Yang <[email protected]>

We now use the sir_dev/irtty_sir/uart/bfin_serial drivers framework to monitor the TX status.

---

 .../mach-bf527/include/mach/bfin_serial_5xx.h      |    3 +++
 .../mach-bf533/include/mach/bfin_serial_5xx.h      |    2 ++
 .../mach-bf537/include/mach/bfin_serial_5xx.h      |    3 +++
 .../mach-bf548/include/mach/bfin_serial_5xx.h      |    3 +++
 .../mach-bf561/include/mach/bfin_serial_5xx.h      |    2 ++
 drivers/serial/bfin_5xx.c                          |    4 ++++
 6 files changed, 17 insertions(+), 0 deletions(-)
arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h +3 -0
index a23d047..75722d6 100644
@@ -78,6 +78,9 @@
 #  define CONFIG_UART1_RTS_PIN -1
 # endif
 #endif
+
+#define BFIN_UART_TX_FIFO_SIZE	2
+
 /*
  * The pin configuration is different from schematic
  */
arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h +2 -0
index 20471cd..815bfe5 100644
@@ -69,6 +69,8 @@
 # endif
 #endif
 
+#define BFIN_UART_TX_FIFO_SIZE	2
+
 struct bfin_serial_port {
         struct uart_port        port;
         unsigned int            old_status;
arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h +3 -0
index 08dfe30..b3f87e1 100644
@@ -78,6 +78,9 @@
 #  define CONFIG_UART1_RTS_PIN -1
 # endif
 #endif
+
+#define BFIN_UART_TX_FIFO_SIZE	2
+
 /*
  * The pin configuration is different from schematic
  */
arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h +3 -0
index 76976b1..e4cf35e 100644
@@ -82,6 +82,9 @@
 #  define CONFIG_UART1_RTS_PIN -1
 # endif
 #endif
+
+#define BFIN_UART_TX_FIFO_SIZE	2
+
 /*
  * The pin configuration is different from schematic
  */
arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h +2 -0
index 6cddca4..e0ce0c1 100644
@@ -69,6 +69,8 @@
 # endif
 #endif
 
+#define BFIN_UART_TX_FIFO_SIZE	2
+
 struct bfin_serial_port {
         struct uart_port        port;
         unsigned int            old_status;
drivers/serial/bfin_5xx.c +4 -0
index 5e20f50..a5cf0e7 100644
@@ -761,6 +761,9 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
 	val |= UCEN;
 	UART_PUT_GCTL(uart, val);
 
+	/* Port speed changed, update the per-port timeout. */
+	uart_update_timeout(port, termios->c_cflag, baud);
+
 	spin_unlock_irqrestore(&uart->port.lock, flags);
 }
 
@@ -865,6 +868,7 @@ static void __init bfin_serial_init_ports(void)
 
 	for (i = 0; i < nr_active_ports; i++) {
 		bfin_serial_ports[i].port.uartclk   = get_sclk();
+		bfin_serial_ports[i].port.fifosize  = BFIN_UART_TX_FIFO_SIZE;
 		bfin_serial_ports[i].port.ops       = &bfin_serial_pops;
 		bfin_serial_ports[i].port.line      = i;
 		bfin_serial_ports[i].port.iotype    = UPIO_MEM;
author
#15 lore raw

PATCH 12/27 Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode

In reply to Alan Cox

From: Sonic Zhang <[email protected]>

---

 arch/blackfin/kernel/bfin_dma_5xx.c |   13 ++++-----
 drivers/serial/bfin_5xx.c           |   50 +++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 7 deletions(-)
arch/blackfin/kernel/bfin_dma_5xx.c +6 -7
index 93229b3..339293d 100644
@@ -117,15 +117,14 @@ int request_dma(unsigned int channel, char *device_id)
 
 #ifdef CONFIG_BF54x
 	if (channel >= CH_UART2_RX && channel <= CH_UART3_TX) {
-		if (strncmp(device_id, "BFIN_UART", 9) == 0) {
-			dma_ch[channel].regs->peripheral_map &= 0x0FFF;
-			dma_ch[channel].regs->peripheral_map |=
+		unsigned int per_map;
+		per_map = dma_ch[channel].regs->peripheral_map & 0xFFF;
+		if (strncmp(device_id, "BFIN_UART", 9) == 0)
+			dma_ch[channel].regs->peripheral_map = per_map |
 				((channel - CH_UART2_RX + 0xC)<<12);
-		} else {
-			dma_ch[channel].regs->peripheral_map &= 0x0FFF;
-			dma_ch[channel].regs->peripheral_map |=
+		else
+			dma_ch[channel].regs->peripheral_map = per_map |
 				((channel - CH_UART2_RX + 0x6)<<12);
-		}
 	}
 #endif
 
drivers/serial/bfin_5xx.c +50 -0

62 lines not on this page · raw message

author
#16 lore raw

PATCH 13/27 Fix oti6858 debug level

In reply to Alan Cox

From: Scott Ashcroft <[email protected]>

For some reason the oti6858 driver undefines and redefines the dbg macro. This makes it spew debugging messages at KERN_INFO instead of KERN_DEBUG.

This patch removes the undef and define making the driver log like every other USB serial driver.

---

 drivers/usb/serial/oti6858.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/usb/serial/oti6858.c +0 -4
index 81db571..42f9281 100644
@@ -224,10 +224,6 @@ struct oti6858_private {
 	struct usb_serial_port *port;   /* USB port with which associated */
 };
 
-#undef dbg
-/* #define dbg(format, arg...) printk(KERN_INFO "%s: " format "\n", __FILE__, ## arg) */
-#define dbg(format, arg...) printk(KERN_INFO "" format "\n", ## arg)
-
 static void setup_line(struct work_struct *work)
 {
 	struct oti6858_private *priv = container_of(work,
author
#17 lore raw

PATCH 14/27 Char: cyclades. remove bogus iomap

In reply to Alan Cox

From: Jiri Slaby <[email protected]>

readl/writel are not expected to accept iomap return value. Replace bogus mapping by standard ioremap.

---

 drivers/char/cyclades.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
drivers/char/cyclades.c +12 -9
index fe6d774..5e5b1dc 100644
@@ -4993,12 +4993,14 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 			device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) {
 		card_name = "Cyclom-Y";
 
-		addr0 = pci_iomap(pdev, 0, CyPCI_Yctl);
+		addr0 = ioremap_nocache(pci_resource_start(pdev, 0),
+				CyPCI_Yctl);
 		if (addr0 == NULL) {
 			dev_err(&pdev->dev, "can't remap ctl region\n");
 			goto err_reg;
 		}
-		addr2 = pci_iomap(pdev, 2, CyPCI_Ywin);
+		addr2 = ioremap_nocache(pci_resource_start(pdev, 2),
+				CyPCI_Ywin);
 		if (addr2 == NULL) {
 			dev_err(&pdev->dev, "can't remap base region\n");
 			goto err_unmap;
@@ -5013,7 +5015,8 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 	} else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Hi) {
 		struct RUNTIME_9060 __iomem *ctl_addr;
 
-		ctl_addr = addr0 = pci_iomap(pdev, 0, CyPCI_Zctl);
+		ctl_addr = addr0 = ioremap_nocache(pci_resource_start(pdev, 0),
+				CyPCI_Zctl);
 		if (addr0 == NULL) {
 			dev_err(&pdev->dev, "can't remap ctl region\n");
 			goto err_reg;
@@ -5026,8 +5029,8 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 
 		mailbox = (u32)readl(&ctl_addr->mail_box_0);
 
-		addr2 = pci_iomap(pdev, 2, mailbox == ZE_V1 ?
-				CyPCI_Ze_win : CyPCI_Zwin);
+		addr2 = ioremap_nocache(pci_resource_start(pdev, 2),
+				mailbox == ZE_V1 ? CyPCI_Ze_win : CyPCI_Zwin);
 		if (addr2 == NULL) {
 			dev_err(&pdev->dev, "can't remap base region\n");
 			goto err_unmap;
@@ -5159,9 +5162,9 @@ err_null:
 	cy_card[card_no].base_addr = NULL;
 	free_irq(irq, &cy_card[card_no]);
 err_unmap:
-	pci_iounmap(pdev, addr0);
+	iounmap(addr0);
 	if (addr2)
-		pci_iounmap(pdev, addr2);
+		iounmap(addr2);
 err_reg:
 	pci_release_regions(pdev);
 err_dis:
@@ -5186,9 +5189,9 @@ static void __devexit cy_pci_remove(struct pci_dev *pdev)
 		cy_writew(cinfo->ctl_addr + 0x68,
 				readw(cinfo->ctl_addr + 0x68) & ~0x0900);
 
-	pci_iounmap(pdev, cinfo->base_addr);
+	iounmap(cinfo->base_addr);
 	if (cinfo->ctl_addr)
-		pci_iounmap(pdev, cinfo->ctl_addr);
+		iounmap(cinfo->ctl_addr);
 	if (cinfo->irq
 #ifndef CONFIG_CYZ_INTR
 		&& !IS_CYC_Z(*cinfo)
author
#18 lore raw

PATCH 15/27 Char: sx, fix io unmapping

In reply to Alan Cox

From: Jiri Slaby <[email protected]>

board->base is increased for CF cards after mapping. Use board->base2 for unmapping the region, since it holds the original/correct address.

---

 drivers/char/sx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/char/sx.c +2 -2
index c385206..5b8d7a1 100644
@@ -2504,7 +2504,7 @@ static void __devexit sx_remove_card(struct sx_board *board,
 		del_timer(&board->timer);
 		if (pdev) {
 #ifdef CONFIG_PCI
-			pci_iounmap(pdev, board->base);
+			pci_iounmap(pdev, board->base2);
 			pci_release_region(pdev, IS_CF_BOARD(board) ? 3 : 2);
 #endif
 		} else {
@@ -2703,7 +2703,7 @@ static int __devinit sx_pci_probe(struct pci_dev *pdev,
 
 	return 0;
 err_unmap:
-	pci_iounmap(pdev, board->base);
+	pci_iounmap(pdev, board->base2);
 err_reg:
 	pci_release_region(pdev, reg);
 err_flag:
author
#19 lore raw

PATCH 16/27 Char: merge ip2main and ip2base

In reply to Alan Cox

From: Jiri Slaby <[email protected]>

It's pretty useless to have one setup() function separated along with module_init() which only calls a function from ip2main anyway. Get rid of ip2base.

Remove also checks of always-true now.

---

 drivers/char/ip2/Makefile  |    2 -
 drivers/char/ip2/ip2base.c |  108 --------------------------------------------
 drivers/char/ip2/ip2main.c |   92 +++++++++++++++++++++++++++++++------
 3 files changed, 77 insertions(+), 125 deletions(-)
 delete mode 100644 drivers/char/ip2/ip2base.c
drivers/char/ip2/Makefile +1 -1
index 939618f..bc397d9 100644
@@ -4,5 +4,5 @@
 
 obj-$(CONFIG_COMPUTONE)         += ip2.o
 
-ip2-objs			:= ip2base.o ip2main.o
+ip2-objs			:= ip2main.o
 
drivers/char/ip2/ip2base.c deleted +0 -108

108 lines not on this page · raw message

drivers/char/ip2/ip2main.c +76 -16

140 lines not on this page · raw message

author
#20 lore raw

PATCH 17/27 ip2, cleanup globals

In reply to Alan Cox

From: Jiri Slaby <[email protected]>

- do not init .bss zeroed data to zero again (by memset or explicit assignment)
- use char [] instead of char * for string constants

---

 drivers/char/ip2/ip2main.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
drivers/char/ip2/ip2main.c +7 -11
index 79bca61..1d46284 100644
@@ -150,12 +150,12 @@ static int ip2_read_proc(char *, char **, off_t, int, int *, void * );
 /*************/
 
 /* String constants to identify ourselves */
-static char *pcName    = "Computone IntelliPort Plus multiport driver";
-static char *pcVersion = "1.2.14";
+static const char pcName[] = "Computone IntelliPort Plus multiport driver";
+static const char pcVersion[] = "1.2.14";
 
 /* String constants for port names */
-static char *pcDriver_name   = "ip2";
-static char *pcIpl    		 = "ip2ipl";
+static const char pcDriver_name[] = "ip2";
+static const char pcIpl[] = "ip2ipl";
 
 /***********************/
 /* Function Prototypes */
@@ -237,8 +237,8 @@ static const struct file_operations ip2_ipl = {
 	.open		= ip2_ipl_open,
 }; 
 
-static unsigned long irq_counter = 0;
-static unsigned long bh_counter = 0;
+static unsigned long irq_counter;
+static unsigned long bh_counter;
 
 // Use immediate queue to service interrupts
 #define USE_IQI
@@ -286,7 +286,7 @@ MODULE_AUTHOR("Doug McNash");
 MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
 MODULE_LICENSE("GPL");
 
-static int poll_only = 0;
+static int poll_only;
 
 static int Eisa_irq;
 static int Eisa_slot;
@@ -615,10 +615,6 @@ static int ip2_loadmain(void)
 	/* Initialise the iiEllis subsystem. */
 	iiEllisInit();
 
-	/* Initialize arrays. */
-	memset( i2BoardPtrTable, 0, sizeof i2BoardPtrTable );
-	memset( DevTable, 0, sizeof DevTable );
-
 	/* Initialise all the boards we can find (up to the maximum). */
 	for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
 		switch ( ip2config.addr[i] ) { 
author
#21 lore raw

PATCH 18/27 ip2, fix sparse warnings

In reply to Alan Cox

From: Jiri Slaby <[email protected]>

---

 drivers/char/ip2/ip2main.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
drivers/char/ip2/ip2main.c +5 -9
index 1d46284..098c9de 100644
@@ -375,9 +375,7 @@ have_requested_irq( char irq )
 /* handle subsequent installations of the driver. All memory allocated by the */
 /* driver should be returned since it may be unloaded from memory.            */
 /******************************************************************************/
-#ifdef MODULE
-void __exit
-ip2_cleanup_module(void)
+static void __exit ip2_cleanup_module(void)
 {
 	int err;
 	int i;
@@ -431,7 +429,8 @@ ip2_cleanup_module(void)
 			ip2config.pci_dev[i] = NULL;
 		}
 #endif
-		if ((pB = i2BoardPtrTable[i]) != 0 ) {
+		pB = i2BoardPtrTable[i];
+		if (pB != NULL) {
 			kfree ( pB );
 			i2BoardPtrTable[i] = NULL;
 		}
@@ -448,7 +447,6 @@ ip2_cleanup_module(void)
 #endif
 }
 module_exit(ip2_cleanup_module);
-#endif /* MODULE */
 
 static const struct tty_operations ip2_ops = {
 	.open            = ip2_open,
@@ -1255,9 +1253,8 @@ ip2_polled_interrupt(void)
 {
 	int i;
 	i2eBordStrPtr  pB;
-	const int irq = 0;
 
-	ip2trace (ITRC_NO_PORT, ITRC_INTR, 99, 1, irq );
+	ip2trace(ITRC_NO_PORT, ITRC_INTR, 99, 1, 0);
 
 	/* Service just the boards on the list using this irq */
 	for( i = 0; i < i2nBoards; ++i ) {
@@ -1266,9 +1263,8 @@ ip2_polled_interrupt(void)
 //		Only process those boards which match our IRQ.
 //			IRQ = 0 for polled boards, we won't poll "IRQ" boards
 
-		if ( pB && (pB->i2eUsingIrq == irq) ) {
+		if (pB && pB->i2eUsingIrq == 0)
 			ip2_irq_work(pB);
-		}
 	}
 
 	++irq_counter;
author
#22 lore raw

PATCH 19/27 ip2, init/deinit cleanup

In reply to Alan Cox

From: Jiri Slaby <[email protected]>

Cleanup of module_init/exit:
- mostly whitespace
- remove empty functions
- replace c++ comments
- remove useless prints (module loaded, unloaded)
- mark the calls as __exit and __init
- use break; and return; to save some indent levels after it
- note resource leakage

It's still mess, but now it's readable.

---

 drivers/char/ip2/i2ellis.c |   32 ---
 drivers/char/ip2/i2ellis.h |    2 
 drivers/char/ip2/ip2main.c |  415 +++++++++++++++++++++-----------------------
 3 files changed, 198 insertions(+), 251 deletions(-)
drivers/char/ip2/i2ellis.c +0 -32
index 3601017..29db44d 100644
@@ -69,38 +69,6 @@ static DEFINE_RWLOCK(Dl_spinlock);
 //=======================================================
 
 //******************************************************************************
-// Function:   iiEllisInit()
-// Parameters: None
-//
-// Returns:    Nothing
-//
-// Description:
-//
-// This routine performs any required initialization of the iiEllis subsystem.
-//
-//******************************************************************************
-static void
-iiEllisInit(void)
-{
-}
-
-//******************************************************************************
-// Function:   iiEllisCleanup()
-// Parameters: None
-//
-// Returns:    Nothing
-//
-// Description:
-//
-// This routine performs any required cleanup of the iiEllis subsystem.
-//
-//******************************************************************************
-static void
-iiEllisCleanup(void)
-{
-}
-
-//******************************************************************************
 // Function:   iiSetAddress(pB, address, delay)
 // Parameters: pB      - pointer to the board structure
 //             address - the purported I/O address of the board
drivers/char/ip2/i2ellis.h +0 -2
index c88a64e..fb6df24 100644
@@ -511,7 +511,6 @@ typedef void (*delayFunc_t)(unsigned int);
 //
 // Initialization of a board & structure is in four (five!) parts:
 //
-// 0) iiEllisInit()  - Initialize iiEllis subsystem.
 // 1) iiSetAddress() - Define the board address & delay function for a board.
 // 2) iiReset()      - Reset the board   (provided it exists)
 //       -- Note you may do this to several boards --
@@ -523,7 +522,6 @@ typedef void (*delayFunc_t)(unsigned int);
 // loadware.  To change loadware, you must begin again with step 2, resetting
 // the board again (step 1 not needed).
 
-static void iiEllisInit(void);
 static int iiSetAddress(i2eBordStrPtr, int, delayFunc_t );
 static int iiReset(i2eBordStrPtr);
 static int iiResetDelay(i2eBordStrPtr);
drivers/char/ip2/ip2main.c +198 -217

585 lines not on this page · raw message

author
#23 lore raw

PATCH 20/27 ip2: avoid add_timer with pending timer

In reply to Alan Cox

From: Akinobu Mita <[email protected]>

add_timer() is not suppose to be called when the timer is pending. ip2 driver attempts to avoid that condition by setting and resetting a flag (TimerOn) in timer function. But there is some gap between add_timer() and setting TimerOn.

This patch fix this problem by using mod_timer() and remove TimerOn which has been unnecessary by this change.

---

 drivers/char/ip2/ip2main.c |   19 ++++---------------
 1 files changed, 4 insertions(+), 15 deletions(-)
drivers/char/ip2/ip2main.c +4 -15
index 39269d1..66f52a2 100644
@@ -249,7 +249,6 @@ static unsigned long bh_counter;
  */
 #define  POLL_TIMEOUT   (jiffies + 1)
 static DEFINE_TIMER(PollTimer, ip2_poll, 0, 0);
-static char  TimerOn;
 
 #ifdef IP2DEBUG_TRACE
 /* Trace (debug) buffer data */
@@ -374,11 +373,7 @@ static void __exit ip2_cleanup_module(void)
 	int err;
 	int i;
 
-	/* Stop poll timer if we had one. */
-	if (TimerOn) {
-		del_timer(&PollTimer);
-		TimerOn = 0;
-	}
+	del_timer_sync(&PollTimer);
 
 	/* Reset the boards we have. */
 	for (i = 0; i < IP2_MAX_BOARDS; i++)
@@ -774,10 +769,8 @@ static int __init ip2_loadmain(void)
 		}
 		if (ip2config.irq[i] == CIR_POLL) {
 retry:
-			if (!TimerOn) {
-				PollTimer.expires = POLL_TIMEOUT;
-				add_timer(&PollTimer);
-				TimerOn = 1;
+			if (!timer_pending(&PollTimer)) {
+				mod_timer(&PollTimer, POLL_TIMEOUT);
 				printk(KERN_INFO "IP2: polling\n");
 			}
 		} else {
@@ -1283,16 +1276,12 @@ ip2_poll(unsigned long arg)
 {
 	ip2trace (ITRC_NO_PORT, ITRC_INTR, 100, 0 );
 
-	TimerOn = 0; // it's the truth but not checked in service
-
 	// Just polled boards, IRQ = 0 will hit all non-interrupt boards.
 	// It will NOT poll boards handled by hard interrupts.
 	// The issue of queued BH interrupts is handled in ip2_interrupt().
 	ip2_polled_interrupt();
 
-	PollTimer.expires = POLL_TIMEOUT;
-	add_timer( &PollTimer );
-	TimerOn = 1;
+	mod_timer(&PollTimer, POLL_TIMEOUT);
 
 	ip2trace (ITRC_NO_PORT, ITRC_INTR, ITRC_RETURN, 0 );
 }
author
#24 lore raw

PATCH 21/27 audit: Handle embedded NUL in TTY input auditing

In reply to Alan Cox

From: Miloslav Trmac <[email protected]>

Data read from a TTY can contain an embedded NUL byte (e.g. after pressing Ctrl-2, or sent to a PTY). After the previous patch, the data would be logged only up to the first NUL.

This patch modifies the AUDIT_TTY record to always use the hexadecimal format, which does not terminate at the first NUL byte. The vast majority of recorded TTY input data will contain either ' ' or '\n', so the hexadecimal format would have been used anyway.

---

 drivers/char/tty_audit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/tty_audit.c +1 -1
index 3582f43..5787249 100644
@@ -93,7 +93,7 @@ static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid,
 		get_task_comm(name, tsk);
 		audit_log_untrustedstring(ab, name);
 		audit_log_format(ab, " data=");
-		audit_log_n_untrustedstring(ab, buf->data, buf->valid);
+		audit_log_n_hex(ab, buf->data, buf->valid);
 		audit_log_end(ab);
 	}
 	buf->valid = 0;
author
#25 lore raw

PATCH 22/27 serial: Make uart_port's ioport "unsigned long".

In reply to Alan Cox

From: David Miller <[email protected]>

Otherwise the top 32-bits of the resource value get chopped off on 64-bit systems, and the resulting I/O accesses go to random places.

Thanks to testing and debugging by Josip Rodin, which helped track this down.

---

 include/linux/serial_core.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/serial_core.h +1 -1
index 3b2f6c0..e27f216 100644
@@ -241,7 +241,7 @@ typedef unsigned int __bitwise__ upf_t;
 
 struct uart_port {
 	spinlock_t		lock;			/* port lock */
-	unsigned int		iobase;			/* in/out[bwl] */
+	unsigned long		iobase;			/* in/out[bwl] */
 	unsigned char __iomem	*membase;		/* read/write[bwl] */
 	unsigned int		irq;			/* irq number */
 	unsigned int		uartclk;		/* base uart clock */
#26 lore raw

Re: [PATCH 22/27] serial: Make uart_port's ioport "unsigned long".

Quoted 11 lines · Alan Cox

From: David Miller <[email protected]>

Otherwise the top 32-bits of the resource value get chopped off on 64-bit systems, and the resulting I/O accesses go to random places.

Thanks to testing and debugging by Josip Rodin, which helped track this down.

I emailed on an earlier posting of this about using resource_size_t instead as we have 32-bit CPUs with 64-bit address spaces. If I'm totally wrong, that's fine but I'm still wondering if that would be a better general solution.

josh

#27 lore raw

Re: [PATCH 22/27] serial: Make uart_port's ioport "unsigned long".

From: Josh Boyer <[email protected]>
Date: Fri, 10 Oct 2008 08:54:34 -0400

Quoted 10 lines · Alan Cox
Quoted 9 lines

From: David Miller <[email protected]>

Otherwise the top 32-bits of the resource value get chopped off on 64-bit systems, and the resulting I/O accesses go to random places.

Thanks to testing and debugging by Josip Rodin, which helped track this down.

Quoted 7 lines
Quoted 2 lines

I emailed on an earlier posting of this about using resource_size_t instead as we have 32-bit CPUs with 64-bit address spaces. If I'm totally wrong, that's fine but I'm still wondering if that would be a better general solution.

That seems like a fine idea to me, please post a follow-on patch if you like :-)

author
#28 lore raw

PATCH 23/27 nozomi: Fix close on error

In reply to Alan Cox

Nozomi assumes the close method isn't called if open errors. The tty layer is different to other drives in this respect however. Pointed out by Denis J Barrow.

---

 drivers/char/nozomi.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/char/nozomi.c +4 -1
index 66a0f93..9a34a19 100644
@@ -1599,7 +1599,10 @@ static int ntty_open(struct tty_struct *tty, struct file *file)
 	return 0;
 }
 
-/* Called when the userspace process close the tty, /dev/noz*. */
+/* Called when the userspace process close the tty, /dev/noz*. Also
+   called immediately if ntty_open fails in which case tty->driver_data
+   will be NULL an we exit by the first return */
+
 static void ntty_close(struct tty_struct *tty, struct file *file)
 {
 	struct nozomi *dc = get_dc_by_tty(tty);
author
#29 lore raw

PATCH 24/27 serial-make-uart_ports-ioport-unsigned-long-fix

In reply to Alan Cox

From: Andrew Morton <[email protected]>

---

 drivers/serial/serial_core.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/serial/serial_core.c +2 -3
index f977c98..308588e 100644
@@ -2154,12 +2154,11 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
 
 	switch (port->iotype) {
 	case UPIO_PORT:
-		snprintf(address, sizeof(address),
-			 "I/O 0x%x", port->iobase);
+		snprintf(address, sizeof(address), "I/O 0x%lx", port->iobase);
 		break;
 	case UPIO_HUB6:
 		snprintf(address, sizeof(address),
-			 "I/O 0x%x offset 0x%x", port->iobase, port->hub6);
+			 "I/O 0x%lx offset 0x%x", port->iobase, port->hub6);
 		break;
 	case UPIO_MEM:
 	case UPIO_MEM32:
author
#30 lore raw

PATCH 25/27 usb: fix pl2303 initialization

In reply to Alan Cox

From: Jason Wessel <[email protected]>

This patch removes the private check for the termios_initialized for the pl2303 usb driver. It forced the baud to 9600 on the first call to pl2303_set_termios()

Based on the tty changes in the 2.6.27 kernel, the termios passed to the *_set_termios functions is always populated the first time.

This means there is no need to privately initialize the settings the first time, and doing so will not allow the use of the kernel parameter "console=ttyUSB0,115200" as an example.

---

 drivers/usb/serial/pl2303.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)
drivers/usb/serial/pl2303.c +0 -11
index 1ede144..8d60068 100644
@@ -154,7 +154,6 @@ struct pl2303_private {
 	wait_queue_head_t delta_msr_wait;
 	u8 line_control;
 	u8 line_status;
-	u8 termios_initialized;
 	enum pl2303_type type;
 };
 
@@ -526,16 +525,6 @@ static void pl2303_set_termios(struct tty_struct *tty,
 
 	dbg("%s -  port %d", __func__, port->number);
 
-	spin_lock_irqsave(&priv->lock, flags);
-	if (!priv->termios_initialized) {
-		*(tty->termios) = tty_std_termios;
-		tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
-		tty->termios->c_ispeed = 9600;
-		tty->termios->c_ospeed = 9600;
-		priv->termios_initialized = 1;
-	}
-	spin_unlock_irqrestore(&priv->lock, flags);
-
 	/* The PL2303 is reported to lose bytes if you change
 	   serial settings even to the same values as before. Thus
 	   we actually need to filter in this specific case */
author
#31 lore raw

PATCH 26/27 ftdi: A few errors are err() that should be debug which causes much spewage

In reply to Alan Cox

Fixes #10783

---

 drivers/usb/serial/ftdi_sio.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/serial/ftdi_sio.c +3 -3
index 3dc93b5..1ac7e80 100644
@@ -860,7 +860,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
 
 	kfree(buf);
 	if (rv < 0) {
-		err("%s Error from MODEM_CTRL urb: DTR %s, RTS %s",
+		dbg("%s Error from MODEM_CTRL urb: DTR %s, RTS %s",
 				__func__,
 				(set & TIOCM_DTR) ? "HIGH" :
 				(clear & TIOCM_DTR) ? "LOW" : "unchanged",
@@ -2256,7 +2256,7 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file)
 			   0, 0,
 			   buf, 1, WDR_TIMEOUT);
 		if (ret < 0) {
-			err("%s Could not get modem status of device - err: %d", __func__,
+			dbg("%s Could not get modem status of device - err: %d", __func__,
 			    ret);
 			return ret;
 		}
@@ -2275,7 +2275,7 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file)
 				   0, priv->interface,
 				   buf, 2, WDR_TIMEOUT);
 		if (ret < 0) {
-			err("%s Could not get modem status of device - err: %d", __func__,
+			dbg("%s Could not get modem status of device - err: %d", __func__,
 			    ret);
 			return ret;
 		}
author
#32 lore raw

PATCH 27/27 serial_8250: pci_enable_device fail is not fully handled

In reply to Alan Cox

<rmk> talking about leaks - I noticed that the 'check return of pci_enable_dev()' in the 8250 pci resume function finally made it in, inspite my objections against it (causing stuff in higher levels to leak).

---

 drivers/serial/8250_pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/serial/8250_pci.c +2 -2
index c2f2393..c014ffb 100644
@@ -2041,9 +2041,9 @@ static int pciserial_resume_one(struct pci_dev *dev)
 		 * The device may have been disabled.  Re-enable it.
 		 */
 		err = pci_enable_device(dev);
+		/* FIXME: We cannot simply error out here */
 		if (err)
-			return err;
-
+			printk(KERN_ERR "pciserial: Unable to re-enable ports, trying to continue.\n");
 		pciserial_resume_ports(priv);
 	}
 	return 0;