Skip to contentSkip to conversation

TTY/serial merge for .38

PATCH In review Greg KH 8 participants 51 messages Jan 6, 2011 – Jan 11, 2011

Subsystems (18)
Documentation VFS PowerPC MIPS +14 more subsystems
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 TTY/serial merge for .38

Here is the big tty and serial merge for .38. I'll be sending another smaller one that just moves drivers around after .38-rc1 is out, as is the norm for file moves to handle issues with other trees syncing up properly.

There was some arguing about the tty console detection patches, but as the existing ioctl does not work properly, Kay's patch was accepted to resolve this issue and allow systemd to correctly detect consoles. I know Alan doesn't like this, but I feel it's the best way to solve the issue (combined with the fact that there is no proposed other solution.)

This series also includes the long-out-of-tree ioctl that SUSE and Debian have been dragging around in their kernels for the past 10+ years. Thanks to Werner for finally submitting it in a mergable form.

Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/tty-2.6.git/ tty-next

All of these have been in the linux-next and -mm releases for quite some time.

Patches will be sent to the linux-kernel mailing list, if anyone wants to see them.

thanks,

greg k-h

------------

 Documentation/ABI/testing/sysfs-tty     |   19 +
 Documentation/filesystems/proc.txt      |   24 +
 Documentation/serial/00-INDEX           |    2 +
 Documentation/serial/serial-rs485.txt   |  120 +++
 arch/alpha/include/asm/ioctls.h         |    1 +
 arch/mips/include/asm/ioctls.h          |    1 +
 arch/parisc/include/asm/ioctls.h        |    1 +
 arch/parisc/kernel/pdc_cons.c           |    8 +-
 arch/powerpc/include/asm/ioctls.h       |    1 +
 arch/sh/include/asm/ioctls.h            |    1 +
 arch/sparc/include/asm/ioctls.h         |    1 +
 arch/xtensa/include/asm/ioctls.h        |    1 +
 drivers/char/Kconfig                    |    9 +
 drivers/char/Makefile                   |    1 +
 drivers/char/hvc_dcc.c                  |  133 +++
 drivers/char/ip2/ip2main.c              |    2 +-
 drivers/char/rocket.c                   |    2 +-
 drivers/char/specialix.c                |    2 +-
 drivers/serial/8250.c                   |  109 ++-
 drivers/serial/8250_pci.c               |   36 +
 drivers/serial/Kconfig                  |   25 +
 drivers/serial/Makefile                 |    5 +-
 drivers/serial/apbuart.c                |   53 +-
 drivers/serial/cpm_uart/cpm_uart.h      |    6 -
 drivers/serial/cpm_uart/cpm_uart_core.c |   19 +
 drivers/serial/ifx6x60.c                | 1406 ++++++++++++++++++++++++++++++
 drivers/serial/ifx6x60.h                |  129 +++
 drivers/serial/mpc52xx_uart.c           |    6 +-
 drivers/serial/omap-serial.c            |   38 +-
 drivers/serial/pch_uart.c               | 1451 +++++++++++++++++++++++++++++++
 drivers/serial/serial_core.c            |   10 +-
 drivers/serial/vt8500_serial.c          |  648 ++++++++++++++
 drivers/tty/n_gsm.c                     |  213 +++--
 drivers/tty/tty_io.c                    |   52 +-
 drivers/tty/vt/vt.c                     |   23 +-
 drivers/video/xen-fbfront.c             |    2 +-
 fs/compat_ioctl.c                       |    1 +
 fs/proc/Makefile                        |    1 +
 fs/proc/proc_console.c                  |  114 +++
 include/asm-generic/ioctls.h            |    1 +
 include/linux/console.h                 |    8 +-
 include/linux/serial_core.h             |    7 +-
 include/linux/spi/ifx_modem.h           |   14 +
 include/linux/tty_driver.h              |    9 +-
 kernel/printk.c                         |    8 +-
 45 files changed, 4535 insertions(+), 188 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-tty
 create mode 100644 Documentation/serial/serial-rs485.txt
 create mode 100644 drivers/char/hvc_dcc.c
 create mode 100644 drivers/serial/ifx6x60.c
 create mode 100644 drivers/serial/ifx6x60.h
 create mode 100644 drivers/serial/pch_uart.c
 create mode 100644 drivers/serial/vt8500_serial.c
 create mode 100644 fs/proc/proc_console.c
 create mode 100644 include/linux/spi/ifx_modem.h

---------------

Alan Cox (4):
n_gsm: Fix support for legacy encoding
n_gsm: clean up printks
serial: ifx6x60: The IFX requires SPI
serial: ifx6x60: Fix missing include for msleep

Alexey Charkov (1):
serial: Add support for UART on VIA VT8500 and compatibles

Baurzhan Ismagulov (2):
serial: cpm_uat: reducing CPM serial latency
serial: cpu_uart: Remove unused uart_cpm_port fields

Claudio Scordino (1):
serial: add Documentation about RS485 serial communications

Cosmin Cojocar (1):
serial: omap-serial: Add support for kernel debugger

Daniel Walker (1):
drivers: char: hvc: add arm JTAG DCC console support

Dirk Brandewie (1):
Serial: ce4100: Add PCI UART support for the ce4100

Govindraj.R (1):
Serial: Avoid unbalanced IRQ wake disable during resume

Jamie Iles (2):
8250: use container_of() instead of casting 8250: add a UPIO_DWAPB32 for 32 bit accesses

Jiri Slaby (5):
console: move for_each_console to linux/console.h
TTY: include termios.h in tty_driver.h
VIDEO: xen-fb, switch to for_each_console
console: add /proc/consoles
parisc: cleanup console handling

Kay Sievers (1):
tty: add 'active' sysfs attribute to tty0 and console device

Namhyung Kim (3):
rocket: fix compiler warning on rocket_pci_ids
specialix: fix compiler warning on specialix_pci_tbl
ip2: fix compiler warning on ip2main_pci_tbl

Ondrej Puzman (1):
8250: fix uninitialized FIFOs

Randy Dunlap (1):
serial: fix pch_uart kconfig & build

Russ Gorby (1):
ifx6x60: SPI protocol driver for Infineon 6x60 modem

Thomas Gleixner (2):
drivers: serial: apbuart: Handle OF failures gracefully
serial: apbuart: Fixup apbuart_console_init()

Timur Tabi (1):
tty: fix typos/errors in tty_driver.h comments

Tomoya MORINAGA (2):
Serial: EG20T: add PCH_UART driver
pch_uart : fix warnings for 64bit compile

Vasiliy Kulikov (2):
serial: ifx6x60: free IRQ on error
serial: ifx6x60: fix memory leak

Werner Fink (1):
TTY: Add tty ioctl to figure device node of the system console.

Wolfram Sang (1):
serial: mpc52xx: make printout for type more generic

Yegor Yefremov (1):
RS485 documentation: add 16C950 UART description

#1 lore raw
Quoted 5 lines

There was some arguing about the tty console detection patches, but as the existing ioctl does not work properly, Kay's patch was accepted to resolve this issue and allow systemd to correctly detect consoles. I know Alan doesn't like this, but I feel it's the best way to solve the issue (combined with the fact that there is no proposed other solution.)

I'm a bit confused about this one Greg - all the distributions used the ioctl you refer to below for this purpose and have for years

Quoted 3 lines

This series also includes the long-out-of-tree ioctl that SUSE and Debian have been dragging around in their kernels for the past 10+ years. Thanks to Werner for finally submitting it in a mergable form.

Which I believe means we don't need the sysfs patch as well - Kay ?

#14 lore raw

PATCH 10/36 VIDEO: xen-fb, switch to for_each_console

In reply to Greg KH

From: Jiri Slaby <[email protected]>

Use newly added for_each_console for iterating consoles.

---
 drivers/video/xen-fbfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/xen-fbfront.c +1 -1
index 428d273..4abb0b9 100644
@@ -492,7 +492,7 @@ xenfb_make_preferred_console(void)
 		return;
 
 	acquire_console_sem();
-	for (c = console_drivers; c; c = c->next) {
+	for_each_console(c) {
 		if (!strcmp(c->name, "tty") && c->index = 0)
 			break;
 	}
Signature · 1 line
1.7.3.2
#16 lore raw

PATCH 12/36 parisc: cleanup console handling

In reply to Greg KH

From: Jiri Slaby <[email protected]>

* use newly added for_each_console for iterating consoles
* add proper console locking
* do not initialize tmp twice
* no need to declare console_drivers, it's already done in console.h

---
 arch/parisc/kernel/pdc_cons.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/parisc/kernel/pdc_cons.c +0 -1
index 66d1f17..11bdd68 100644
@@ -92,8 +92,6 @@ static int pdc_console_setup(struct console *co, char *options)
 
 static struct timer_list pdc_console_timer;
 
-extern struct console * console_drivers;
#5 lore raw

PATCH 1/36 ifx6x60: SPI protocol driver for Infineon 6x60 modem

In reply to Greg KH

From: Russ Gorby <[email protected]>

Prototype driver for the IFX6x60 series of SPI attached modems by Jim Stanley and Russ Gorby

[Some reworking and a major cleanup]

---
 drivers/serial/Kconfig        |    6 +
 drivers/serial/Makefile       |    1 +
 drivers/serial/ifx6x60.c      | 1402 +++++++++++++++++++++++++++++++++++++++++
 drivers/serial/ifx6x60.h      |  129 ++++
 include/linux/spi/ifx_modem.h |   14 +
 5 files changed, 1552 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/ifx6x60.c
 create mode 100644 drivers/serial/ifx6x60.h
 create mode 100644 include/linux/spi/ifx_modem.h
drivers/serial/Kconfig +6 -0
index aff9dcd..0b9cc17 100644
@@ -1632,4 +1632,10 @@ config SERIAL_ALTERA_UART_CONSOLE
 	help
 	  Enable a Altera UART port to be the system console.
 
+config SERIAL_IFX6X60
+        tristate "SPI protocol driver for Infineon 6x60 modem (EXPERIMENTAL)"
+	depends on GPIOLIB && EXPERIMENTAL
+	help
+	  Support for the IFX6x60 modem devices on Intel MID platforms.
+
 endmenu
drivers/serial/Makefile +1 -0
index c570576..783638b 100644
@@ -89,3 +89,4 @@ obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
 obj-$(CONFIG_SERIAL_MRST_MAX3110)	+= mrst_max3110.o
 obj-$(CONFIG_SERIAL_MFD_HSU)	+= mfd.o
 obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
+obj-$(CONFIG_SERIAL_IFX6X60)  	+= ifx6x60.o
drivers/serial/ifx6x60.c new file +1402 -0

1,402 lines not on this page · raw message

drivers/serial/ifx6x60.h new file +129 -0

129 lines not on this page · raw message

include/linux/spi/ifx_modem.h new file +14 -0
new file mode 100644
index 0000000..a68f3b1
@@ -0,0 +1,14 @@
+#ifndef LINUX_IFX_MODEM_H
+#define LINUX_IFX_MODEM_H
+
+struct ifx_modem_platform_data {
+	unsigned short rst_out; /* modem reset out */
+	unsigned short pwr_on;  /* power on */
+	unsigned short rst_pmu; /* reset modem */
+	unsigned short tx_pwr;  /* modem power threshold */
+	unsigned short srdy;    /* SRDY */
+	unsigned short mrdy;    /* MRDY */
+	unsigned short is_6160;	/* Modem type */
+};
+
+#endif
Signature · 1 line
1.7.3.2
#6 lore raw

PATCH 2/36 serial: Add support for UART on VIA VT8500 and compatibles

In reply to Greg KH

From: Alexey Charkov <[email protected]>

This adds a driver for the serial ports found in VIA and WonderMedia Systems-on-Chip. Interrupt-driven FIFO operation is implemented. The hardware also supports pure register-based operation (which is slower) and DMA-based FIFO operation. As the FIFOs are only 16 bytes long, DMA operation is probably not worth the hassle.

---
 drivers/serial/Kconfig         |   10 +
 drivers/serial/Makefile        |    1 +
 drivers/serial/vt8500_serial.c |  648 ++++++++++++++++++++++++++++++++++++++++
 include/linux/serial_core.h    |    3 +
 4 files changed, 662 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/vt8500_serial.c
drivers/serial/Kconfig +10 -0
index 0b9cc17..388e371 100644
@@ -1381,6 +1381,16 @@ config SERIAL_MSM_CONSOLE
 	depends on SERIAL_MSM=y
 	select SERIAL_CORE_CONSOLE
 
+config SERIAL_VT8500
+	bool "VIA VT8500 on-chip serial port support"
+	depends on ARM && ARCH_VT8500
+	select SERIAL_CORE
+
+config SERIAL_VT8500_CONSOLE
+	bool "VIA VT8500 serial console support"
+	depends on SERIAL_VT8500=y
+	select SERIAL_CORE_CONSOLE
+
 config SERIAL_NETX
 	tristate "NetX serial port support"
 	depends on ARM && ARCH_NETX
drivers/serial/Makefile +1 -0
index 783638b..a5e2264 100644
@@ -86,6 +86,7 @@ obj-$(CONFIG_SERIAL_TIMBERDALE)	+= timbuart.o
 obj-$(CONFIG_SERIAL_GRLIB_GAISLER_APBUART) += apbuart.o
 obj-$(CONFIG_SERIAL_ALTERA_JTAGUART) += altera_jtaguart.o
 obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
+obj-$(CONFIG_SERIAL_VT8500) += vt8500_serial.o
 obj-$(CONFIG_SERIAL_MRST_MAX3110)	+= mrst_max3110.o
 obj-$(CONFIG_SERIAL_MFD_HSU)	+= mfd.o
 obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
drivers/serial/vt8500_serial.c new file +648 -0

648 lines not on this page · raw message

include/linux/serial_core.h +3 -0
index 212eb4c..41603d6 100644
@@ -199,6 +199,9 @@
 /* TI OMAP-UART */
 #define PORT_OMAP	96
 
+/* VIA VT8500 SoC */
+#define PORT_VT8500	97
+
 #ifdef __KERNEL__
 
 #include <linux/compiler.h>
Signature · 1 line
1.7.3.2
#8 lore raw

PATCH 4/36 n_gsm: clean up printks

In reply to Greg KH

From: Alan Cox <[email protected]>

[Original From Ken Mills but I redid it using pr_ helpers instead]

Also fix up coding style, there are two warnings left but that is where the CodingStyle tools blow up because they cannot handle

	if (blah) {
		foo
	} else switch (x) {
		case 1:
		}
---
 drivers/tty/n_gsm.c |  154 +++++++++++++++++++++++++++------------------------
 1 files changed, 81 insertions(+), 73 deletions(-)
drivers/tty/n_gsm.c +81 -73
index 5256087..11a25fa 100644
@@ -19,7 +19,7 @@
  *
  * TO DO:
  *	Mostly done:	ioctls for setting modes/timing
- *	Partly done: 	hooks so you can pull off frames to non tty devs
+ *	Partly done:	hooks so you can pull off frames to non tty devs
  *	Restart DLCI 0 when it closes ?
  *	Test basic encoding
  *	Improve the tx engine
@@ -73,8 +73,10 @@ module_param(debug, int, 0600);
 #define T2	(2 * HZ)
 #endif
 
-/* Semi-arbitary buffer size limits. 0710 is normally run with 32-64 byte
-   limits so this is plenty */
+/*
+ * Semi-arbitary buffer size limits. 0710 is normally run with 32-64 byte
+ * limits so this is plenty
+ */
 #define MAX_MRU 512
 #define MAX_MTU 512
 
@@ -290,7 +292,7 @@ static spinlock_t gsm_mux_lock;
 #define MDM_DV			0x40
 
 #define GSM0_SOF		0xF9
-#define GSM1_SOF 		0x7E
+#define GSM1_SOF		0x7E
 #define GSM1_ESCAPE		0x7D
 #define GSM1_ESCAPE_BITS	0x20
 #define XON			0x11
@@ -433,61 +435,63 @@ static void gsm_print_packet(const char *hdr, int addr, int cr,
 	if (!(debug & 1))
 		return;
 
-	printk(KERN_INFO "%s %d) %c: ", hdr, addr, "RC"[cr]);
+	pr_info("%s %d) %c: ", hdr, addr, "RC"[cr]);
 
 	switch (control & ~PF) {
 	case SABM:
-		printk(KERN_CONT "SABM");
+		pr_cont("SABM");
 		break;
 	case UA:
-		printk(KERN_CONT "UA");
+		pr_cont("UA");
 		break;
 	case DISC:
-		printk(KERN_CONT "DISC");
+		pr_cont("DISC");
 		break;
 	case DM:
-		printk(KERN_CONT "DM");
+		pr_cont("DM");
 		break;
 	case UI:
-		printk(KERN_CONT "UI");
+		pr_cont("UI");
 		break;
 	case UIH:
-		printk(KERN_CONT "UIH");
+		pr_cont("UIH");
 		break;
 	default:
 		if (!(control & 0x01)) {
-			printk(KERN_CONT "I N(S)%d N(R)%d",
-				(control & 0x0E) >> 1, (control & 0xE)>> 5);
+			pr_cont("I N(S)%d N(R)%d",
+				(control & 0x0E) >> 1, (control & 0xE) >> 5);
 		} else switch (control & 0x0F) {
-		case RR:
-			printk("RR(%d)", (control & 0xE0) >> 5);
-			break;
-		case RNR:
-			printk("RNR(%d)", (control & 0xE0) >> 5);
-			break;
-		case REJ:
-			printk("REJ(%d)", (control & 0xE0) >> 5);
-			break;
-		default:
-			printk(KERN_CONT "[%02X]", control);
+			case RR:
+				pr_cont("RR(%d)", (control & 0xE0) >> 5);
+				break;
+			case RNR:
+				pr_cont("RNR(%d)", (control & 0xE0) >> 5);
+				break;
+			case REJ:
+				pr_cont("REJ(%d)", (control & 0xE0) >> 5);
+				break;
+			default:
+				pr_cont("[%02X]", control);
 		}
 	}
 
 	if (control & PF)
-		printk(KERN_CONT "(P)");
+		pr_cont("(P)");
 	else
-		printk(KERN_CONT "(F)");
+		pr_cont("(F)");
 
 	if (dlen) {
 		int ct = 0;
 		while (dlen--) {
-			if (ct % 8 == 0)
-				printk(KERN_CONT "\n    ");
-			printk(KERN_CONT "%02X ", *data++);
+			if (ct % 8 == 0) {
+				pr_cont("\n");
+				pr_debug("    ");
+			}
+			pr_cont("%02X ", *data++);
 			ct++;
 		}
 	}
-	printk(KERN_CONT "\n");
+	pr_cont("\n");
 }
 
 
@@ -526,11 +530,13 @@ static void hex_packet(const unsigned char *p, int len)
 {
 	int i;
 	for (i = 0; i < len; i++) {
-		if (i && (i % 16) == 0)
-			printk("\n");
-		printk("%02X ", *p++);
+		if (i && (i % 16) == 0) {
+			pr_cont("\n");
+			pr_debug("");
+		}
+		pr_cont("%02X ", *p++);
 	}
-	printk("\n");
+	pr_cont("\n");
 }
 
 /**
@@ -680,7 +686,7 @@ static void gsm_data_kick(struct gsm_mux *gsm)
 		}
 
 		if (debug & 4) {
-			printk("gsm_data_kick: \n");
+			pr_debug("gsm_data_kick:\n");
 			hex_packet(gsm->txframe, len);
 		}
 
@@ -1233,7 +1239,7 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
 }
 
 /**
- *	gsm_control_transmit 	-	send control packet
+ *	gsm_control_transmit	-	send control packet
  *	@gsm: gsm mux
  *	@ctrl: frame to send
  *
@@ -1363,7 +1369,7 @@ static void gsm_dlci_close(struct gsm_dlci *dlci)
 {
 	del_timer(&dlci->t1);
 	if (debug & 8)
-		printk("DLCI %d goes closed.\n", dlci->addr);
+		pr_debug("DLCI %d goes closed.\n", dlci->addr);
 	dlci->state = DLCI_CLOSED;
 	if (dlci->addr != 0) {
 		struct tty_struct  *tty = tty_port_tty_get(&dlci->port);
@@ -1394,7 +1400,7 @@ static void gsm_dlci_open(struct gsm_dlci *dlci)
 	/* This will let a tty open continue */
 	dlci->state = DLCI_OPEN;
 	if (debug & 8)
-		printk("DLCI %d goes open.\n", dlci->addr);
+		pr_debug("DLCI %d goes open.\n", dlci->addr);
 	wake_up(&dlci->gsm->event);
 }
 
@@ -1496,29 +1502,29 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int len)
 	unsigned int modem = 0;
 
 	if (debug & 16)
-		printk("%d bytes for tty %p\n", len, tty);
+		pr_debug("%d bytes for tty %p\n", len, tty);
 	if (tty) {
 		switch (dlci->adaption)  {
-			/* Unsupported types */
-			/* Packetised interruptible data */
-			case 4:
-				break;
-			/* Packetised uininterruptible voice/data */
-			case 3:
-				break;
-			/* Asynchronous serial with line state in each frame */
-			case 2:
-				while (gsm_read_ea(&modem, *data++) == 0) {
-					len--;
-					if (len == 0)
-						return;
-				}
-				gsm_process_modem(tty, dlci, modem);
-			/* Line state will go via DLCI 0 controls only */
-			case 1:
-			default:
-				tty_insert_flip_string(tty, data, len);
-				tty_flip_buffer_push(tty);
+		/* Unsupported types */
+		/* Packetised interruptible data */
+		case 4:
+			break;
+		/* Packetised uininterruptible voice/data */
+		case 3:
+			break;
+		/* Asynchronous serial with line state in each frame */
+		case 2:
+			while (gsm_read_ea(&modem, *data++) == 0) {
+				len--;
+				if (len == 0)
+					return;
+			}
+			gsm_process_modem(tty, dlci, modem);
+		/* Line state will go via DLCI 0 controls only */
+		case 1:
+		default:
+			tty_insert_flip_string(tty, data, len);
+			tty_flip_buffer_push(tty);
 		}
 		tty_kref_put(tty);
 	}
@@ -1656,7 +1662,7 @@ static void gsm_queue(struct gsm_mux *gsm)
 	if (gsm->fcs != GOOD_FCS) {
 		gsm->bad_fcs++;
 		if (debug & 4)
-			printk("BAD FCS %02x\n", gsm->fcs);
+			pr_debug("BAD FCS %02x\n", gsm->fcs);
 		return;
 	}
 	address = gsm->address >> 1;
@@ -1890,7 +1896,7 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c)
 		gsm->state = GSM_DATA;
 		break;
 	case GSM_DATA:		/* Data */
-		if (gsm->count > gsm->mru ) {	/* Allow one for the FCS */
+		if (gsm->count > gsm->mru) {	/* Allow one for the FCS */
 			gsm->state = GSM_OVERRUN;
 			gsm->bad_size++;
 		} else
@@ -2085,7 +2091,7 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
 		return -ENOSPC;
 	}
 	if (debug & 4) {
-		printk("-->%d bytes out\n", len);
+		pr_debug("-->%d bytes out\n", len);
 		hex_packet(data, len);
 	}
 	gsm->tty->ops->write(gsm->tty, data, len);
@@ -2142,7 +2148,7 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
 	char flags;
 
 	if (debug & 4) {
-		printk("Inbytes %dd\n", count);
+		pr_debug("Inbytes %dd\n", count);
 		hex_packet(cp, count);
 	}
 
@@ -2159,7 +2165,7 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
 			gsm->error(gsm, *dp, flags);
 			break;
 		default:
-			printk(KERN_ERR "%s: unknown flag %d\n",
+			WARN_ONCE("%s: unknown flag %d\n",
 			       tty_name(tty, buf), flags);
 			break;
 		}
@@ -2354,7 +2360,7 @@ static int gsmld_config(struct tty_struct *tty, struct gsm_mux *gsm,
 	int need_restart = 0;
 
 	/* Stuff we don't support yet - UI or I frame transport, windowing */
-	if ((c->adaption !=1 && c->adaption != 2) || c->k)
+	if ((c->adaption != 1 && c->adaption != 2) || c->k)
 		return -EOPNOTSUPP;
 	/* Check the MRU/MTU range looks sane */
 	if (c->mru > MAX_MRU || c->mtu > MAX_MTU || c->mru < 8 || c->mtu < 8)
@@ -2448,7 +2454,7 @@ static int gsmld_ioctl(struct tty_struct *tty, struct file *file,
 			c.i = 1;
 		else
 			c.i = 2;
-		printk("Ftype %d i %d\n", gsm->ftype, c.i);
+		pr_debug("Ftype %d i %d\n", gsm->ftype, c.i);
 		c.mru = gsm->mru;
 		c.mtu = gsm->mtu;
 		c.k = 0;
@@ -2742,14 +2748,15 @@ static int __init gsm_init(void)
 	/* Fill in our line protocol discipline, and register it */
 	int status = tty_register_ldisc(N_GSM0710, &tty_ldisc_packet);
 	if (status != 0) {
-		printk(KERN_ERR "n_gsm: can't register line discipline (err = %d)\n", status);
+		pr_err("n_gsm: can't register line discipline (err = %d)\n",
+								status);
 		return status;
 	}
 
 	gsm_tty_driver = alloc_tty_driver(256);
 	if (!gsm_tty_driver) {
 		tty_unregister_ldisc(N_GSM0710);
-		printk(KERN_ERR "gsm_init: tty allocation failed.\n");
+		pr_err("gsm_init: tty allocation failed.\n");
 		return -EINVAL;
 	}
 	gsm_tty_driver->owner	= THIS_MODULE;
@@ -2760,7 +2767,7 @@ static int __init gsm_init(void)
 	gsm_tty_driver->type		= TTY_DRIVER_TYPE_SERIAL;
 	gsm_tty_driver->subtype	= SERIAL_TYPE_NORMAL;
 	gsm_tty_driver->flags	= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV
-							| TTY_DRIVER_HARDWARE_BREAK;
+						| TTY_DRIVER_HARDWARE_BREAK;
 	gsm_tty_driver->init_termios	= tty_std_termios;
 	/* Fixme */
 	gsm_tty_driver->init_termios.c_lflag &= ~ECHO;
@@ -2771,10 +2778,11 @@ static int __init gsm_init(void)
 	if (tty_register_driver(gsm_tty_driver)) {
 		put_tty_driver(gsm_tty_driver);
 		tty_unregister_ldisc(N_GSM0710);
-		printk(KERN_ERR "gsm_init: tty registration failed.\n");
+		pr_err("gsm_init: tty registration failed.\n");
 		return -EBUSY;
 	}
-	printk(KERN_INFO "gsm_init: loaded as %d,%d.\n", gsm_tty_driver->major, gsm_tty_driver->minor_start);
+	pr_debug("gsm_init: loaded as %d,%d.\n",
+			gsm_tty_driver->major, gsm_tty_driver->minor_start);
 	return 0;
 }
 
@@ -2782,10 +2790,10 @@ static void __exit gsm_exit(void)
 {
 	int status = tty_unregister_ldisc(N_GSM0710);
 	if (status != 0)
-		printk(KERN_ERR "n_gsm: can't unregister line discipline (err = %d)\n", status);
+		pr_err("n_gsm: can't unregister line discipline (err = %d)\n",
+								status);
 	tty_unregister_driver(gsm_tty_driver);
 	put_tty_driver(gsm_tty_driver);
-	printk(KERN_INFO "gsm_init: unloaded.\n");
 }
 
 module_init(gsm_init);
Signature · 1 line
1.7.3.2
#12 lore raw

PATCH 8/36 console: move for_each_console to linux/console.h

In reply to Greg KH

From: Jiri Slaby <[email protected]>

Move it out of printk.c so that we can use it all over the code. There are some potential users which will be converted to that macro in next patches.

---
 include/linux/console.h |    6 ++++++
 kernel/printk.c         |    6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/console.h +6 -0
index 95cf6f0..875cfb1 100644
@@ -126,6 +126,12 @@ struct console {
 	struct	 console *next;
 };
 
+/*
+ * for_each_console() allows you to iterate on each console
+ */
+#define for_each_console(con) \
+	for (con = console_drivers; con != NULL; con = con->next)
+
 extern int console_set_on_cmdline;
 
 extern int add_preferred_console(char *name, int idx, char *options);
kernel/printk.c +0 -6
index b2ebaee..bf0420a 100644
@@ -43,12 +43,6 @@
 #include <asm/uaccess.h>
 
 /*
- * for_each_console() allows you to iterate on each console
- */
-#define for_each_console(con) \
-	for (con = console_drivers; con != NULL; con = con->next)
-
-/*
  * Architectures can override it:
  */
 void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...)
Signature · 1 line
1.7.3.2
#11 lore raw

PATCH 7/36 serial: cpu_uart: Remove unused uart_cpm_port fields

In reply to Greg KH

From: Baurzhan Ismagulov <[email protected]>

AFAICT, these fields are not used anywhere.

---
 drivers/serial/cpm_uart/cpm_uart.h |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/serial/cpm_uart/cpm_uart.h +0 -6
index 7274b52..b754dcf 100644
@@ -76,18 +76,12 @@ struct uart_cpm_port {
 	unsigned char		*tx_buf;
 	unsigned char		*rx_buf;
 	u32			flags;
-	void			(*set_lineif)(struct uart_cpm_port *);
 	struct clk		*clk;
 	u8			brg;
 	uint			 dp_addr;
 	void			*mem_addr;
 	dma_addr_t		 dma_addr;
 	u32			mem_size;
-	/* helpers */
-	int			 baud;
-	int			 bits;
-	/* Keep track of 'odd' SMC2 wirings */
-	int			is_portb;
 	/* wait on close if needed */
 	int			wait_closing;
 	/* value to combine with opcode to form cpm command */
Signature · 1 line
1.7.3.2
#15 lore raw

PATCH 11/36 console: add /proc/consoles

In reply to Greg KH

From: Jiri Slaby <[email protected]>

It allows users to see what consoles are currently known to the system and with what flags.

It is based on Werner's patch, the part about traversing fds was removed, the code was moved to kernel/printk.c, where consoles are handled and it makes more sense to me.

---
 Documentation/filesystems/proc.txt |   24 ++++++++
 fs/proc/Makefile                   |    1 +
 fs/proc/proc_console.c             |  114 ++++++++++++++++++++++++++++++++++++
 3 files changed, 139 insertions(+), 0 deletions(-)
 create mode 100644 fs/proc/proc_console.c
Documentation/filesystems/proc.txt +24 -0
index e73df27..9471225 100644
@@ -1181,6 +1181,30 @@ Table 1-12: Files in /proc/fs/ext4/<devname>
  mb_groups       details of multiblock allocator buddy cache of free blocks
 ..............................................................................
 
+2.0 /proc/consoles
+------------------
+Shows registered system console lines.
+
+To see which character device lines are currently used for the system console
+/dev/console, you may simply look into the file /proc/consoles:
+
+  > cat /proc/consoles
+  tty0                 -WU (ECp)       4:7
+  ttyS0                -W- (Ep)        4:64
+
+The columns are:
+
+  device               name of the device
+  operations           R = can do read operations
+                       W = can do write operations
+                       U = can do unblank
+  flags                E = it is enabled
+                       C = it is prefered console
+                       B = it is primary boot console
+                       p = it is used for printk buffer
+                       b = it is not a TTY but a Braille device
+                       a = it is safe to use when cpu is offline
+  major:minor          major and minor number of the device separated by a colon
 
 ------------------------------------------------------------------------------
 Summary
fs/proc/Makefile +1 -0
index 2758e2a..288a49e 100644
@@ -15,6 +15,7 @@ proc-y	+= devices.o
 proc-y	+= interrupts.o
 proc-y	+= loadavg.o
 proc-y	+= meminfo.o
+proc-y	+= proc_console.o
 proc-y	+= stat.o
 proc-y	+= uptime.o
 proc-y	+= version.o
fs/proc/proc_console.c new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#19 lore raw

PATCH 15/36 serial: ifx6x60: Fix missing include for msleep

In reply to Greg KH

From: Alan Cox <[email protected]>

Noted by Stephen Rothwell

---
 drivers/serial/ifx6x60.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/serial/ifx6x60.c +1 -0
index b9b7e06..803264a 100644
@@ -60,6 +60,7 @@
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/spi/ifx_modem.h>
+#include <linux/delay.h>
 
 #include "ifx6x60.h"
 
Signature · 1 line
1.7.3.2
#18 lore raw

PATCH 14/36 serial: ifx6x60: The IFX requires SPI

In reply to Greg KH

From: Alan Cox <[email protected]>

Correct the KConfig as noted by Greg.

---
 drivers/serial/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/Kconfig +1 -1
index 388e371..9f6daae 100644
@@ -1644,7 +1644,7 @@ config SERIAL_ALTERA_UART_CONSOLE
 
 config SERIAL_IFX6X60
         tristate "SPI protocol driver for Infineon 6x60 modem (EXPERIMENTAL)"
-	depends on GPIOLIB && EXPERIMENTAL
+	depends on GPIOLIB && SPI && EXPERIMENTAL
 	help
 	  Support for the IFX6x60 modem devices on Intel MID platforms.
 
Signature · 1 line
1.7.3.2
#20 lore raw

PATCH 16/36 Serial: ce4100: Add PCI UART support for the ce4100

In reply to Greg KH

From: Dirk Brandewie <[email protected]>

This patch adds support for the PCI UART on the ce4100.

---
 drivers/serial/8250_pci.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
drivers/serial/8250_pci.c +36 -0
index 53be4d3..e30356d 100644
@@ -957,6 +957,22 @@ pci_default_setup(struct serial_private *priv,
 	return setup_port(priv, port, bar, offset, board->reg_shift);
 }
 
+static int
+ce4100_serial_setup(struct serial_private *priv,
+		  const struct pciserial_board *board,
+		  struct uart_port *port, int idx)
+{
+	int ret;
+
+	ret = setup_port(priv, port, 0, 0, board->reg_shift);
+	port->iotype = UPIO_MEM32;
+	port->type = PORT_XSCALE;
+	port->flags = (port->flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
+	port->regshift = 2;
+
+	return ret;
+}
+
 static int skip_tx_en_setup(struct serial_private *priv,
 			const struct pciserial_board *board,
 			struct uart_port *port, int idx)
@@ -981,6 +997,7 @@ static int skip_tx_en_setup(struct serial_private *priv,
 #define PCI_SUBDEVICE_ID_POCTAL232	0x0308
 #define PCI_SUBDEVICE_ID_POCTAL422	0x0408
 #define PCI_VENDOR_ID_ADVANTECH		0x13fe
+#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66
 #define PCI_DEVICE_ID_ADVANTECH_PCI3620	0x3620
 #define PCI_DEVICE_ID_TITAN_200I	0x8028
 #define PCI_DEVICE_ID_TITAN_400I	0x8048
@@ -1072,6 +1089,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= skip_tx_en_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_CE4100_UART,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= ce4100_serial_setup,
+	},
 	/*
 	 * ITE
 	 */
@@ -1592,6 +1616,7 @@ enum pci_board_num_t {
 	pbn_ADDIDATA_PCIe_2_3906250,
 	pbn_ADDIDATA_PCIe_4_3906250,
 	pbn_ADDIDATA_PCIe_8_3906250,
+	pbn_ce4100_1_115200,
 };
 
 /*
@@ -2281,6 +2306,12 @@ static struct pciserial_board pci_boards[] __devinitdata = {
 		.uart_offset	= 0x200,
 		.first_offset	= 0x1000,
 	},
+	[pbn_ce4100_1_115200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 1,
+		.base_baud	= 921600,
+		.reg_shift      = 2,
+	},
 };
 
 static const struct pci_device_id softmodem_blacklist[] = {
@@ -3760,6 +3791,11 @@ static struct pci_device_id serial_pci_tbl[] = {
 	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
 		0xA000, 0x3004,
 		0, 0, pbn_b0_bt_4_115200 },
+	/* Intel CE4100 */
+	{	PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART,
+		PCI_ANY_ID,  PCI_ANY_ID, 0, 0,
+		pbn_ce4100_1_115200 },
+
 
 	/*
 	 * These entries match devices with class COMMUNICATION_SERIAL,
Signature · 1 line
1.7.3.2
#26 lore raw

PATCH 22/36 serial: fix pch_uart kconfig & build

In reply to Greg KH

From: Randy Dunlap <[email protected]>

The dma_request_channel/dma_release_channel interfaces are not built when DMADEVICES is not enabled, so make the driver depend on DMADEVICES. Also, the help text says that the driver enables & uses PCH_DMA, which is not enabled, so select that.

ERROR: "__dma_request_channel" [drivers/serial/pch_uart.ko] undefined!
ERROR: "dma_release_channel" [drivers/serial/pch_uart.ko] undefined!

---
 drivers/serial/Kconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/serial/Kconfig +2 -1
index fa02904..ec3c214 100644
@@ -1650,8 +1650,9 @@ config SERIAL_IFX6X60
 
 config SERIAL_PCH_UART
 	tristate "Intel EG20T PCH UART"
+	depends on PCI && DMADEVICES
 	select SERIAL_CORE
-	depends on PCI
+	select PCH_DMA
 	help
 	  This driver is for PCH(Platform controller Hub) UART of Intel EG20T
 	  which is an IOH(Input/Output Hub) for x86 embedded processor.
Signature · 1 line
1.7.3.2
#31 lore raw

PATCH 25/36 8250: add a UPIO_DWAPB32 for 32 bit accesses

In reply to Greg KH

From: Jamie Iles <[email protected]>

Some platforms contain a Synopsys DesignWare APB UART that is attached to a 32-bit APB bus where sub-word accesses are not allowed. Add a new IO type (UPIO_DWAPB32) that performs 32 bit acccesses to the UART.

v2:
- don't test for 32 bit in the output fast path, provide a separate dwabp32_serial_out() function. Refactor dwabp_serial_out() so that we can reuse the LCR saving code.
v3:
- rebased on top of "8250: use container_of() instead of casting"

---
 drivers/serial/8250.c        |   51 ++++++++++++++++++++++++++++++++----------
 drivers/serial/serial_core.c |    2 +
 include/linux/serial_core.h  |    1 +
 3 files changed, 42 insertions(+), 12 deletions(-)
drivers/serial/8250.c +39 -12
index 0b4ce47..9839199 100644
@@ -454,22 +454,40 @@ static void tsi_serial_out(struct uart_port *p, int offset, int value)
 		writeb(value, p->membase + offset);
 }
 
+/* Save the LCR value so it can be re-written when a Busy Detect IRQ occurs. */
+static inline void dwapb_save_out_value(struct uart_port *p, int offset,
+					int value)
+{
+	struct uart_8250_port *up =
+		container_of(p, struct uart_8250_port, port);
+
+	if (offset == UART_LCR)
+		up->lcr = value;
+}
+
+/* Read the IER to ensure any interrupt is cleared before returning from ISR. */
+static inline void dwapb_check_clear_ier(struct uart_port *p, int offset)
+{
+	if (offset == UART_TX || offset == UART_IER)
+		p->serial_in(p, UART_IER);
+}
+
 static void dwapb_serial_out(struct uart_port *p, int offset, int value)
 {
 	int save_offset = offset;
 	offset = map_8250_out_reg(p, offset) << p->regshift;
-	/* Save the LCR value so it can be re-written when a
-	 * Busy Detect interrupt occurs. */
-	if (save_offset == UART_LCR) {
-		struct uart_8250_port *up =
-			container_of(p, struct uart_8250_port, port);
-		up->lcr = value;
-	}
+	dwapb_save_out_value(p, save_offset, value);
 	writeb(value, p->membase + offset);
-	/* Read the IER to ensure any interrupt is cleared before
-	 * returning from ISR. */
-	if (save_offset == UART_TX || save_offset == UART_IER)
-		value = p->serial_in(p, UART_IER);
+	dwapb_check_clear_ier(p, save_offset);
+}
+
+static void dwapb32_serial_out(struct uart_port *p, int offset, int value)
+{
+	int save_offset = offset;
+	offset = map_8250_out_reg(p, offset) << p->regshift;
+	dwapb_save_out_value(p, save_offset, value);
+	writel(value, p->membase + offset);
+	dwapb_check_clear_ier(p, save_offset);
 }
 
 static unsigned int io_serial_in(struct uart_port *p, int offset)
@@ -520,6 +538,11 @@ static void set_io_from_upio(struct uart_port *p)
 		p->serial_out = dwapb_serial_out;
 		break;
 
+	case UPIO_DWAPB32:
+		p->serial_in = mem32_serial_in;
+		p->serial_out = dwapb32_serial_out;
+		break;
+
 	default:
 		p->serial_in = io_serial_in;
 		p->serial_out = io_serial_out;
@@ -538,6 +561,7 @@ serial_out_sync(struct uart_8250_port *up, int offset, int value)
 	case UPIO_MEM32:
 	case UPIO_AU:
 	case UPIO_DWAPB:
+	case UPIO_DWAPB32:
 		p->serial_out(p, offset, value);
 		p->serial_in(p, UART_LCR);	/* safe, no side-effects */
 		break;
@@ -1587,7 +1611,8 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id)
 			handled = 1;
 
 			end = NULL;
-		} else if (up->port.iotype == UPIO_DWAPB &&
+		} else if ((up->port.iotype == UPIO_DWAPB ||
+			    up->port.iotype == UPIO_DWAPB32) &&
 			  (iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
 			/* The DesignWare APB UART has an Busy Detect (0x07)
 			 * interrupt meaning an LCR write attempt occured while the
@@ -2492,6 +2517,7 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
 	case UPIO_MEM32:
 	case UPIO_MEM:
 	case UPIO_DWAPB:
+	case UPIO_DWAPB32:
 		if (!up->port.mapbase)
 			break;
 
@@ -2529,6 +2555,7 @@ static void serial8250_release_std_resource(struct uart_8250_port *up)
 	case UPIO_MEM32:
 	case UPIO_MEM:
 	case UPIO_DWAPB:
+	case UPIO_DWAPB32:
 		if (!up->port.mapbase)
 			break;
 
drivers/serial/serial_core.c +2 -0
index c4ea146..2835e29 100644
@@ -2135,6 +2135,7 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
 	case UPIO_AU:
 	case UPIO_TSI:
 	case UPIO_DWAPB:
+	case UPIO_DWAPB32:
 		snprintf(address, sizeof(address),
 			 "MMIO 0x%llx", (unsigned long long)port->mapbase);
 		break;
@@ -2555,6 +2556,7 @@ int uart_match_port(struct uart_port *port1, struct uart_port *port2)
 	case UPIO_AU:
 	case UPIO_TSI:
 	case UPIO_DWAPB:
+	case UPIO_DWAPB32:
 		return (port1->mapbase == port2->mapbase);
 	}
 	return 0;
include/linux/serial_core.h +1 -0
index 9ff9b7d..7a6daf1 100644
@@ -314,6 +314,7 @@ struct uart_port {
 #define UPIO_TSI		(5)			/* Tsi108/109 type IO */
 #define UPIO_DWAPB		(6)			/* DesignWare APB UART */
 #define UPIO_RM9000		(7)			/* RM9000 type IO */
+#define UPIO_DWAPB32		(8)			/* DesignWare APB UART (32 bit accesses) */
 
 	unsigned int		read_status_mask;	/* driver specific */
 	unsigned int		ignore_status_mask;	/* driver specific */
Signature · 1 line
1.7.3.2
#34 lore raw

PATCH 28/36 ip2: fix compiler warning on ip2main_pci_tbl

In reply to Greg KH

From: Namhyung Kim <[email protected]>

Annotate ip2main_pci_tbl as '__used' to fix following warning:

CC drivers/char/ip2/ip2main.o
drivers/char/ip2/ip2main.c:3227: warning: ‘ip2main_pci_tbl’ defined but not used

---
 drivers/char/ip2/ip2main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/ip2/ip2main.c +1 -1
index fcd02ba..c3a0253 100644
@@ -3224,7 +3224,7 @@ ip2trace (unsigned short pn, unsigned char cat, unsigned char label, unsigned lo
 
 MODULE_LICENSE("GPL");
 
-static struct pci_device_id ip2main_pci_tbl[] __devinitdata = {
+static struct pci_device_id ip2main_pci_tbl[] __devinitdata __used = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_IP2EX) },
 	{ }
 };
Signature · 1 line
1.7.3.2
#35 lore raw

PATCH 29/36 8250: fix uninitialized FIFOs

In reply to Greg KH

From: Ondrej Puzman <[email protected]>

I have found a bug in 8250.c driver which causes that 16550A uart FIFOs are not turned on during initialization if they are manually configured by setserial. UART is then working only as plain 16450 without FIFOs. On systems with higher interrupt latency this causes buffer overruns and loss of received data when using higher communication speeds.

I'm working for a company which produces industrial computers. These devices typically contain high number (8 or more) of traditional 16550A uarts - we use TL16C554A chips, but that is not much relevant. UARTs are connected to the CPU by ISA bus (Celeron based devices) or LPC bus (Atom based devices).

In the Linux the UARTs are using standard 8250.c driver and are initialized using setserial command:
setserial /dev/ttyS4 uart 16550A port 0x3E0 irq 10 baud_base 115200

This executes the UART initialization through serial8250_startup() function. At the beginning of the function up->capabilities is initialized from uart_config:
up->capabilities = uart_config[up->port.type].flags;
Please note that neither up->port.fifosize nor up->tx_loadsz is initialized here!!

Later in the same function serial8250_clear_fifos() is called and disables FIFOs. The above comment says that they will be reenabled in set_termios (they won't ...)

After serial8250_startup() the serial8250_set_termios() is called. In this function the following check fails because up->port.fifosize is zero because it is not initialized correctly.

        if (up->capabilities & UART_CAP_FIFO && up->port.fifosize > 1) {
                if (baud < 2400)
                        fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
                else
                        fcr = uart_config[up->port.type].fcr;
        }

fcr variable remains zero and in the end the FCR register is set to zero which results in disabled FIFOs even if the UART type is 16550A. This is also true for other types of UARTs with FIFOs.

If the UART is autoconfigured via 'setserial /dev/ttySx autoconfig' then port.fifosize and tx_loadsz are initialized correctly in the autoconfig() function and the UART is working correctly then.

I checked the source codes and I can say that this bug is present in 2.6.x series of kernels for a couple of years. Namely I can confirm its presence in 2.6.16.57, 2.6.32.24 and 2.6.36.1 (tested all of them on our hardware).

I think it was not noticed before because not many people use manually configured non PNP UARTs on ISA/LPC bus these days. Also the data loss caused by buffer overruns occures only if IRQ latency is higher then time needed to receive one character on given communication speed. For example our hardware looses received characters only if the UARTs are connected throught LPC bus with SERIRQ (serial IRQ transport) and not if they are connected to ISA bus because LPC SERIRQ has higher interrupt latency then parallel ISA interupt lines.

Here is the patch to correct the bug created against 2.6.36.1:

---
 drivers/serial/8250.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/serial/8250.c +2 -0
index 9839199..8747215 100644
@@ -1981,6 +1981,8 @@ static int serial8250_startup(struct uart_port *port)
 	unsigned char lsr, iir;
 	int retval;
 
+	up->port.fifosize = uart_config[up->port.type].fifo_size;
+	up->tx_loadsz = uart_config[up->port.type].tx_loadsz;
 	up->capabilities = uart_config[up->port.type].flags;
 	up->mcr = 0;
 
Signature · 1 line
1.7.3.2
#33 lore raw

PATCH 27/36 specialix: fix compiler warning on specialix_pci_tbl

In reply to Greg KH

From: Namhyung Kim <[email protected]>

Annotate specialx_pci_tbl as '__used' to fix following warning:

CC drivers/char/specialix.o
drivers/char/specialix.c:2358: warning: ‘specialx_pci_tbl’ defined but not used

---
 drivers/char/specialix.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/specialix.c +1 -1
index 9f8495b..499bb0f 100644
@@ -2356,7 +2356,7 @@ static void __exit specialix_exit_module(void)
 	func_exit();
 }
 
-static struct pci_device_id specialx_pci_tbl[] __devinitdata = {
+static struct pci_device_id specialx_pci_tbl[] __devinitdata __used = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_IO8) },
 	{ }
 };
Signature · 1 line
1.7.3.2
#36 lore raw

PATCH 30/36 pch_uart : fix warnings for 64bit compile

In reply to Greg KH

From: Tomoya MORINAGA <[email protected]>

Fix the following warnings
drivers/serial/pch_uart.c: In function ‘dma_handle_rx’:
drivers/serial/pch_uart.c:685:24: warning: cast from pointer to integer of different size drivers/serial/pch_uart.c: In function ‘dma_handle_tx’:
drivers/serial/pch_uart.c:778:23: warning: cast from pointer to integer of different size drivers/serial/pch_uart.c: In function ‘pch_uart_init_port’:
drivers/serial/pch_uart.c:1289:20: warning: cast to pointer from integer of different size drivers/serial/pch_uart.c: In function ‘pch_uart_exit_port’:
drivers/serial/pch_uart.c:1328:2: warning: cast from pointer to integer of different size

---
 drivers/serial/pch_uart.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
drivers/serial/pch_uart.c +7 -6
index b94d1fa..70a6145 100644
@@ -682,7 +682,8 @@ static int dma_handle_rx(struct eg20t_port *priv)
 	sg_dma_len(sg) = priv->fifo_size;
 
 	sg_set_page(&priv->sg_rx, virt_to_page(priv->rx_buf_virt),
-		     sg_dma_len(sg), (int)priv->rx_buf_virt & ~PAGE_MASK);
+		     sg_dma_len(sg), (unsigned long)priv->rx_buf_virt &
+		     ~PAGE_MASK);
 
 	sg_dma_address(sg) = priv->rx_buf_dma;
 
@@ -1254,7 +1255,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	int ret;
 	unsigned int iobase;
 	unsigned int mapbase;
-	unsigned int rxbuf;
+	unsigned char *rxbuf;
 	int fifosize, base_baud;
 	static int num;
 
@@ -1262,7 +1263,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	if (priv == NULL)
 		goto init_port_alloc_err;
 
-	rxbuf = __get_free_page(GFP_KERNEL);
+	rxbuf = (unsigned char *)__get_free_page(GFP_KERNEL);
 	if (!rxbuf)
 		goto init_port_free_txbuf;
 
@@ -1286,7 +1287,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	priv->iobase = iobase;
 	priv->pdev = pdev;
 	priv->tx_empty = 1;
-	priv->rxbuf.buf = (unsigned char *)rxbuf;
+	priv->rxbuf.buf = rxbuf;
 	priv->rxbuf.size = PAGE_SIZE;
 
 	priv->fifo_size = fifosize;
@@ -1313,7 +1314,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	return priv;
 
 init_port_hal_free:
-	free_page(rxbuf);
+	free_page((unsigned long)rxbuf);
 init_port_free_txbuf:
 	kfree(priv);
 init_port_alloc_err:
@@ -1325,7 +1326,7 @@ static void pch_uart_exit_port(struct eg20t_port *priv)
 {
 	uart_remove_one_port(&pch_uart_driver, &priv->port);
 	pci_set_drvdata(priv->pdev, NULL);
-	free_page((unsigned int)priv->rxbuf.buf);
+	free_page((unsigned long)priv->rxbuf.buf);
 }
 
 static void pch_uart_pci_remove(struct pci_dev *pdev)
Signature · 1 line
1.7.3.2
#37 lore raw

PATCH 31/36 tty: fix typos/errors in tty_driver.h comments

In reply to Greg KH

From: Timur Tabi <[email protected]>

Fix various typos and other errors in comments of tty_driver.h. The most significant is the wrong name of a function for the description of TTY_DRIVER_DYNAMIC_DEV.

---
 include/linux/tty_driver.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
include/linux/tty_driver.h +4 -4
index 09678ed..c3d43eb 100644
@@ -102,7 +102,7 @@
  * 	    unsigned int cmd, unsigned long arg);
  *
  * 	This routine allows the tty driver to implement
- *	device-specific ioctl's.  If the ioctl number passed in cmd
+ *	device-specific ioctls.  If the ioctl number passed in cmd
  * 	is not recognized by the driver, it should return ENOIOCTLCMD.
  *
  *	Optional
@@ -167,12 +167,12 @@
  * 
  * void (*hangup)(struct tty_struct *tty);
  *
- * 	This routine notifies the tty driver that it should hangup the
+ * 	This routine notifies the tty driver that it should hang up the
  * 	tty device.
  *
  *	Optional:
  *
- * int (*break_ctl)(struct tty_stuct *tty, int state);
+ * int (*break_ctl)(struct tty_struct *tty, int state);
  *
  * 	This optional routine requests the tty driver to turn on or
  * 	off BREAK status on the RS-232 port.  If state is -1,
@@ -358,7 +358,7 @@ static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
  * 	overruns, either.)
  *
  * TTY_DRIVER_DYNAMIC_DEV --- if set, the individual tty devices need
- *	to be registered with a call to tty_register_driver() when the
+ *	to be registered with a call to tty_register_device() when the
  *	device is found in the system and unregistered with a call to
  *	tty_unregister_device() so the devices will be show up
  *	properly in sysfs.  If not set, driver->num entries will be
Signature · 1 line
1.7.3.2
#45 lore raw

PATCH 36/36 serial: apbuart: Fixup apbuart_console_init()

In reply to Greg KH

From: Thomas Gleixner <[email protected]>

commit 35c64e5d (drivers: serial: apbuart: Handle OF failures gracefully) missed that the modified grlib_apbuart_configure() function is called from apbuart_console_init() as well.

Fix the fallout.

---
 drivers/serial/apbuart.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/serial/apbuart.c +3 -2
index 2e84d9c..a30bb962 100644
@@ -520,11 +520,12 @@ static struct console grlib_apbuart_console = {
 };
 
 
-static void grlib_apbuart_configure(void);
+static int grlib_apbuart_configure(void);
 
 static int __init apbuart_console_init(void)
 {
-	grlib_apbuart_configure();
+	if (grlib_apbuart_configure())
+		return -ENODEV;
 	register_console(&grlib_apbuart_console);
 	return 0;
 }
Signature · 1 line
1.7.3.2
#44 lore raw

PATCH 35/36 TTY: Add tty ioctl to figure device node of the system console.

In reply to Greg KH

From: Werner Fink <[email protected]>

This has been in the SuSE kernels for a very long time.

---
 arch/alpha/include/asm/ioctls.h   |    1 +
 arch/mips/include/asm/ioctls.h    |    1 +
 arch/parisc/include/asm/ioctls.h  |    1 +
 arch/powerpc/include/asm/ioctls.h |    1 +
 arch/sh/include/asm/ioctls.h      |    1 +
 arch/sparc/include/asm/ioctls.h   |    1 +
 arch/xtensa/include/asm/ioctls.h  |    1 +
 drivers/tty/tty_io.c              |    5 +++++
 fs/compat_ioctl.c                 |    1 +
 include/asm-generic/ioctls.h      |    1 +
 10 files changed, 14 insertions(+), 0 deletions(-)
arch/alpha/include/asm/ioctls.h +1 -0
index 59617c3..034b6cf 100644
@@ -92,6 +92,7 @@
 #define TIOCGSID	0x5429  /* Return the session ID of FD */
 #define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define TIOCSERCONFIG	0x5453
arch/mips/include/asm/ioctls.h +1 -0
index d87cb04..d967b89 100644
@@ -83,6 +83,7 @@
 #define TCSETSF2	_IOW('T', 0x2D, struct termios2)
 #define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
 #define TIOCSIG		_IOW('T', 0x36, int)  /* Generate signal on Pty slave */
 
 /* I hope the range from 0x5480 on is free ... */
arch/parisc/include/asm/ioctls.h +1 -0
index 4e06144..6ba80d0 100644
@@ -52,6 +52,7 @@
 #define TCSETSF2	_IOW('T',0x2D, struct termios2)
 #define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T',0x32, int)  /* Get primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
arch/powerpc/include/asm/ioctls.h +1 -0
index 8519200..c7dc17c 100644
@@ -94,6 +94,7 @@
 #define TIOCSRS485	0x542f
 #define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define TIOCSERCONFIG	0x5453
arch/sh/include/asm/ioctls.h +1 -0
index eb6c4c6..84e85a7 100644
@@ -85,6 +85,7 @@
 #define TCSETSF2	_IOW('T', 45, struct termios2)
 #define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define TIOCSERCONFIG	_IO('T', 83) /* 0x5453 */
arch/sparc/include/asm/ioctls.h +1 -0
index 53f4ee0..ed3807b 100644
@@ -19,6 +19,7 @@
 #define TCSETS2		_IOW('T', 13, struct termios2)
 #define TCSETSW2	_IOW('T', 14, struct termios2)
 #define TCSETSF2	_IOW('T', 15, struct termios2)
+#define TIOCGDEV	_IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
 
 /* Note that all the ioctls that are not available in Linux have a 
  * double underscore on the front to: a) avoid some programs to
arch/xtensa/include/asm/ioctls.h +1 -0
index ab18000..ccf1800 100644
@@ -98,6 +98,7 @@
 #define TCSETSF2	_IOW('T', 45, struct termios2)
 #define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define TIOCSERCONFIG	_IO('T', 83)
drivers/tty/tty_io.c +5 -0
index be5ab4a..d2333ab 100644
@@ -2618,6 +2618,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		return put_user(tty->ldisc->ops->num, (int __user *)p);
 	case TIOCSETD:
 		return tiocsetd(tty, p);
+	case TIOCGDEV:
+	{
+		unsigned int ret = new_encode_dev(tty_devnum(real_tty));
+		return put_user(ret, (unsigned int __user *)p);
+	}
 	/*
 	 * Break handling
 	 */
fs/compat_ioctl.c +1 -0
index 410ed18..a1a8f0c 100644
@@ -837,6 +837,7 @@ COMPATIBLE_IOCTL(TCSETSW)
 COMPATIBLE_IOCTL(TCSETSF)
 COMPATIBLE_IOCTL(TIOCLINUX)
 COMPATIBLE_IOCTL(TIOCSBRK)
+COMPATIBLE_IOCTL(TIOCGDEV)
 COMPATIBLE_IOCTL(TIOCCBRK)
 COMPATIBLE_IOCTL(TIOCGSID)
 COMPATIBLE_IOCTL(TIOCGICOUNT)
include/asm-generic/ioctls.h +1 -0
index a321665..3f3f2d1 100644
@@ -67,6 +67,7 @@
 #endif
 #define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
 #define TCGETX		0x5432 /* SYS5 TCGETX compatibility */
 #define TCSETX		0x5433
 #define TCSETXF		0x5434
Signature · 1 line
1.7.3.2
author
#2 lore raw
In reply to Alan Cox
Quoted 6 lines · Alan Cox
Quoted 5 lines

There was some arguing about the tty console detection patches, but as the existing ioctl does not work properly, Kay's patch was accepted to resolve this issue and allow systemd to correctly detect consoles. I know Alan doesn't like this, but I feel it's the best way to solve the issue (combined with the fact that there is no proposed other solution.)

Quoted 8 lines

I'm a bit confused about this one Greg - all the distributions used the ioctl you refer to below for this purpose and have for years

Quoted 3 lines

This series also includes the long-out-of-tree ioctl that SUSE and Debian have been dragging around in their kernels for the past 10+ years. Thanks to Werner for finally submitting it in a mergable form.

Which I believe means we don't need the sysfs patch as well - Kay ?

I didn't think that the ioctl was sufficient for what systemd required, it was only needed for "old-style" initrd programs like what used to be used in SUSE and other distros, but are now being phased out.

Kay?

thanks,

greg k-h

#40 lore raw

PATCH 34/36 tty: add 'active' sysfs attribute to tty0 and console device

In reply to Greg KH

From: Kay Sievers <[email protected]>

tty: add 'active' sysfs attribute to tty0 and console device

Userspace can query the actual virtual console, and the configured console devices behind /dev/tt0 and /dev/console.

The last entry in the list of devices is the active device, analog to the console= kernel command line option.

The attribute supports poll(), which is raised when the virtual console is changed or /dev/console is reconfigured.

index 0000000..b138b66

---
 Documentation/ABI/testing/sysfs-tty |   19 ++++++++++++++
 drivers/tty/tty_io.c                |   47 ++++++++++++++++++++++++++++++++---
 drivers/tty/vt/vt.c                 |   23 ++++++++++++++++-
 include/linux/console.h             |    2 +-
 kernel/printk.c                     |    2 +
 5 files changed, 87 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-tty
Documentation/ABI/testing/sysfs-tty new file +19 -0
new file mode 100644
index 0000000..b138b66
@@ -0,0 +1,19 @@
+What:		/sys/class/tty/console/active
+Date:		Nov 2010
+Contact:	Kay Sievers <[email protected]>
+Description:
+		 Shows the list of currently configured
+		 console devices, like 'tty1 ttyS0'.
+		 The last entry in the file is the active
+		 device connected to /dev/console.
+		 The file supports poll() to detect virtual
+		 console switches.
+
+What:		/sys/class/tty/tty0/active
+Date:		Nov 2010
+Contact:	Kay Sievers <[email protected]>
+Description:
+		 Shows the currently active virtual console
+		 device, like 'tty1'.
+		 The file supports poll() to detect virtual
+		 console switches.
drivers/tty/tty_io.c +43 -4

67 lines not on this page · raw message

drivers/tty/vt/vt.c +22 -1
index a8ec48e..76407ec 100644
@@ -236,6 +236,14 @@ enum {
 };
 
 /*
+ * /sys/class/tty/tty0/
+ *
+ * the attribute 'active' contains the name of the current vc
+ * console and it supports poll() to detect vc switches
+ */
+static struct device *tty0dev;
+
+/*
  * Notifier list for console events.
  */
 static ATOMIC_NOTIFIER_HEAD(vt_notifier_list);
@@ -688,6 +696,8 @@ void redraw_screen(struct vc_data *vc, int is_switch)
 			save_screen(old_vc);
 			set_origin(old_vc);
 		}
+		if (tty0dev)
+			sysfs_notify(&tty0dev->kobj, NULL, "active");
 	} else {
 		hide_cursor(vc);
 		redraw = 1;
@@ -2967,13 +2977,24 @@ static const struct tty_operations con_ops = {
 
 static struct cdev vc0_cdev;
 
+static ssize_t show_tty_active(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "tty%d\n", fg_console + 1);
+}
+static DEVICE_ATTR(active, S_IRUGO, show_tty_active, NULL);
+
 int __init vty_init(const struct file_operations *console_fops)
 {
 	cdev_init(&vc0_cdev, console_fops);
 	if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
 		panic("Couldn't register /dev/tty0 driver\n");
-	device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+	tty0dev = device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+	if (IS_ERR(tty0dev))
+		tty0dev = NULL;
+	else
+		device_create_file(tty0dev, &dev_attr_active);
 
 	vcs_init();
 
include/linux/console.h +1 -1
index 875cfb1..9774fe6 100644
@@ -151,7 +151,7 @@ extern int is_console_locked(void);
 extern int braille_register_console(struct console *, int index,
 		char *console_options, char *braille_options);
 extern int braille_unregister_console(struct console *);
-
+extern void console_sysfs_notify(void);
 extern int console_suspend_enabled;
 
 /* Suspend and resume console messages over PM events */
kernel/printk.c +2 -0
index bf0420a..5417784 100644
@@ -1332,6 +1332,7 @@ void register_console(struct console *newcon)
 		spin_unlock_irqrestore(&logbuf_lock, flags);
 	}
 	release_console_sem();
+	console_sysfs_notify();
 
 	/*
 	 * By unregistering the bootconsoles after we enable the real console
@@ -1390,6 +1391,7 @@ int unregister_console(struct console *console)
 		console_drivers->flags |= CON_CONSDEV;
 
 	release_console_sem();
+	console_sysfs_notify();
 	return res;
 }
 EXPORT_SYMBOL(unregister_console);
Signature · 1 line
1.7.3.2
#39 lore raw

PATCH 33/36 drivers: serial: apbuart: Handle OF failures gracefully

In reply to Greg KH

From: Thomas Gleixner <[email protected]>

The apbuart driver depends on OF and relies on everything being available. So if it's probed on a platform which has OF support, but no device tree is available it crashes. Triggered by the upcoming x86 OF support in randconfig testing.

Further it's inconsistent vs. the probing and exiting from the of_match loop.

Make it robust and consistent:

- check the availablility of OF nodes before dereferencing
- return -ENODEV when the device tree lookup fails
- return -ENODEV when no uart port configuration is found
- return -ENODEV when invalid uart port configuration is found

Remove the enum_done check while at it. Driver init functions are only called once. Remove the pointless vendor and device queries as well.

Reported-by Ingo Molnar <mingo.elte.hu>
Cc Grant Likely <[email protected]>
Cc Kristoffer Glembo <[email protected]>
---
 drivers/serial/apbuart.c |   48 ++++++++++++++++++---------------------------
 1 files changed, 19 insertions(+), 29 deletions(-)
drivers/serial/apbuart.c +19 -29
index cc01c65..2e84d9c 100644
@@ -593,54 +593,44 @@ static struct of_platform_driver grlib_apbuart_of_driver = {
 };
 
 
-static void grlib_apbuart_configure(void)
+static int grlib_apbuart_configure(void)
 {
-	static int enum_done;
 	struct device_node *np, *rp;
-	struct uart_port *port = NULL;
 	const u32 *prop;
-	int freq_khz;
-	int v = 0, d = 0;
-	unsigned int addr;
-	int irq, line;
-	struct amba_prom_registers *regs;
-
-	if (enum_done)
-		return;
+	int freq_khz, line = 0;
 
 	/* Get bus frequency */
 	rp = of_find_node_by_path("/");
+	if (!rp)
+		return -ENODEV;
 	rp = of_get_next_child(rp, NULL);
+	if (!rp)
+		return -ENODEV;
 	prop = of_get_property(rp, "clock-frequency", NULL);
+	if (!prop)
+		return -ENODEV;
 	freq_khz = *prop;
 
-	line = 0;
 	for_each_matching_node(np, apbuart_match) {
+		const int *irqs = of_get_property(np, "interrupts", NULL);
+		const struct amba_prom_registers *regs;
+		struct uart_port *port;
+		unsigned long addr;
 
-		int *vendor = (int *) of_get_property(np, "vendor", NULL);
-		int *device = (int *) of_get_property(np, "device", NULL);
-		int *irqs = (int *) of_get_property(np, "interrupts", NULL);
-		regs = (struct amba_prom_registers *)
-		    of_get_property(np, "reg", NULL);
-
-		if (vendor)
-			v = *vendor;
-		if (device)
-			d = *device;
+		regs = of_get_property(np, "reg", NULL);
 
 		if (!irqs || !regs)
-			return;
+			return -ENODEV;
 
 		grlib_apbuart_nodes[line] = np;
 
 		addr = regs->phys_addr;
-		irq = *irqs;
 
 		port = &grlib_apbuart_ports[line];
 
 		port->mapbase = addr;
 		port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
-		port->irq = irq;
+		port->irq = *irqs;
 		port->iotype = UPIO_MEM;
 		port->ops = &grlib_apbuart_ops;
 		port->flags = UPF_BOOT_AUTOCONF;
@@ -652,12 +642,10 @@ static void grlib_apbuart_configure(void)
 		/* We support maximum UART_NR uarts ... */
 		if (line == UART_NR)
 			break;
-
 	}
 
-	enum_done = 1;
-
 	grlib_apbuart_driver.nr = grlib_apbuart_port_nr = line;
+	return line ? 0 : -ENODEV;
 }
 
 static int __init grlib_apbuart_init(void)
@@ -665,7 +653,9 @@ static int __init grlib_apbuart_init(void)
 	int ret;
 
 	/* Find all APBUARTS in device the tree and initialize their ports */
-	grlib_apbuart_configure();
+	ret = grlib_apbuart_configure();
+	if (ret)
+		return ret;
 
 	printk(KERN_INFO "Serial: GRLIB APBUART driver\n");
 
Signature · 1 line
1.7.3.2
#38 lore raw

PATCH 32/36 Serial: Avoid unbalanced IRQ wake disable during resume

In reply to Greg KH

From: Govindraj.R <[email protected]>

To avoid unbalanced IRQ wake disable, ensure that wakeups are disabled only when wakeups have been successfully enabled.
Tested on OMAP3630SDP/ZOOM3.

---
 drivers/serial/serial_core.c |    8 ++++++--
 include/linux/serial_core.h  |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/serial/serial_core.c +6 -2
index 2835e29..76418c1 100644
@@ -1986,7 +1986,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
 
 	tty_dev = device_find_child(uport->dev, &match, serial_match_port);
 	if (device_may_wakeup(tty_dev)) {
-		enable_irq_wake(uport->irq);
+		if (!enable_irq_wake(uport->irq))
+			uport->irq_wake = 1;
 		put_device(tty_dev);
 		mutex_unlock(&port->mutex);
 		return 0;
@@ -2052,7 +2053,10 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
 
 	tty_dev = device_find_child(uport->dev, &match, serial_match_port);
 	if (!uport->suspended && device_may_wakeup(tty_dev)) {
-		disable_irq_wake(uport->irq);
+		if (uport->irq_wake) {
+			disable_irq_wake(uport->irq);
+			uport->irq_wake = 0;
+		}
 		mutex_unlock(&port->mutex);
 		return 0;
 	}
include/linux/serial_core.h +1 -0
index 7a6daf1..a23fa29 100644
@@ -365,6 +365,7 @@ struct uart_port {
 	struct device		*dev;			/* parent device */
 	unsigned char		hub6;			/* this should be in the 8250 driver */
 	unsigned char		suspended;
+	unsigned char		irq_wake;
 	unsigned char		unused[2];
 	void			*private_data;		/* generic platform data pointer */
 };
Signature · 1 line
1.7.3.2
#32 lore raw

PATCH 26/36 rocket: fix compiler warning on rocket_pci_ids

In reply to Greg KH

From: Namhyung Kim <[email protected]>

Annotate rocket_pci_ids as '__used' to fix following warning:

CC drivers/char/rocket.o
drivers/char/rocket.c:1767: warning: ‘rocket_pci_ids’ defined but not used

---
 drivers/char/rocket.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/rocket.c +1 -1
index 86308830..3e4e73a 100644
@@ -1764,7 +1764,7 @@ static void rp_flush_buffer(struct tty_struct *tty)
 
 #ifdef CONFIG_PCI
 
-static struct pci_device_id __devinitdata rocket_pci_ids[] = {
+static struct pci_device_id __devinitdata __used rocket_pci_ids[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_ANY_ID) },
 	{ }
 };
Signature · 1 line
1.7.3.2
#30 lore raw

PATCH 24/36 8250: use container_of() instead of casting

In reply to Greg KH

From: Jamie Iles <[email protected]>

The 8250 driver structure uart_8250_port took advantage of the fact that the struct uart_port was the first member of its structure and used an explicit cast to convert to the derived class. Replace the explicit casts with container_of() for safety and clarity.

---
 drivers/serial/8250.c |   60 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 20 deletions(-)
drivers/serial/8250.c +40 -20
index 4d8e14b..0b4ce47 100644
@@ -461,7 +461,8 @@ static void dwapb_serial_out(struct uart_port *p, int offset, int value)
 	/* Save the LCR value so it can be re-written when a
 	 * Busy Detect interrupt occurs. */
 	if (save_offset == UART_LCR) {
-		struct uart_8250_port *up = (struct uart_8250_port *)p;
+		struct uart_8250_port *up =
+			container_of(p, struct uart_8250_port, port);
 		up->lcr = value;
 	}
 	writeb(value, p->membase + offset);
@@ -485,7 +486,8 @@ static void io_serial_out(struct uart_port *p, int offset, int value)
 
 static void set_io_from_upio(struct uart_port *p)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)p;
+	struct uart_8250_port *up =
+		container_of(p, struct uart_8250_port, port);
 	switch (p->iotype) {
 	case UPIO_HUB6:
 		p->serial_in = hub6_serial_in;
@@ -1319,7 +1321,8 @@ static inline void __stop_tx(struct uart_8250_port *p)
 
 static void serial8250_stop_tx(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 
 	__stop_tx(up);
 
@@ -1336,7 +1339,8 @@ static void transmit_chars(struct uart_8250_port *up);
 
 static void serial8250_start_tx(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 
 	if (!(up->ier & UART_IER_THRI)) {
 		up->ier |= UART_IER_THRI;
@@ -1364,7 +1368,8 @@ static void serial8250_start_tx(struct uart_port *port)
 
 static void serial8250_stop_rx(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 
 	up->ier &= ~UART_IER_RLSI;
 	up->port.read_status_mask &= ~UART_LSR_DR;
@@ -1373,7 +1378,8 @@ static void serial8250_stop_rx(struct uart_port *port)
 
 static void serial8250_enable_ms(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 
 	/* no MSR capabilities */
 	if (up->bugs & UART_BUG_NOMSR)
@@ -1781,7 +1787,8 @@ static void serial8250_backup_timeout(unsigned long data)
 
 static unsigned int serial8250_tx_empty(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	unsigned long flags;
 	unsigned int lsr;
 
@@ -1795,7 +1802,8 @@ static unsigned int serial8250_tx_empty(struct uart_port *port)
 
 static unsigned int serial8250_get_mctrl(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	unsigned int status;
 	unsigned int ret;
 
@@ -1815,7 +1823,8 @@ static unsigned int serial8250_get_mctrl(struct uart_port *port)
 
 static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	unsigned char mcr = 0;
 
 	if (mctrl & TIOCM_RTS)
@@ -1836,7 +1845,8 @@ static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl)
 
 static void serial8250_break_ctl(struct uart_port *port, int break_state)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	unsigned long flags;
 
 	spin_lock_irqsave(&up->port.lock, flags);
@@ -1890,7 +1900,8 @@ static void wait_for_xmitr(struct uart_8250_port *up, int bits)
 
 static int serial8250_get_poll_char(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	unsigned char lsr = serial_inp(up, UART_LSR);
 
 	if (!(lsr & UART_LSR_DR))
@@ -1904,7 +1915,8 @@ static void serial8250_put_poll_char(struct uart_port *port,
 			 unsigned char c)
 {
 	unsigned int ier;
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 
 	/*
 	 *	First save the IER then disable the interrupts
@@ -1938,7 +1950,8 @@ static void serial8250_put_poll_char(struct uart_port *port,
 
 static int serial8250_startup(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	unsigned long flags;
 	unsigned char lsr, iir;
 	int retval;
@@ -2166,7 +2179,8 @@ dont_test_tx_en:
 
 static void serial8250_shutdown(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	unsigned long flags;
 
 	/*
@@ -2235,7 +2249,8 @@ void
 serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
 		          struct ktermios *old)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	unsigned char cval, fcr = 0;
 	unsigned long flags;
 	unsigned int baud, quot;
@@ -2435,7 +2450,8 @@ serial8250_set_ldisc(struct uart_port *port, int new)
 void serial8250_do_pm(struct uart_port *port, unsigned int state,
 		      unsigned int oldstate)
 {
-	struct uart_8250_port *p = (struct uart_8250_port *)port;
+	struct uart_8250_port *p =
+		container_of(port, struct uart_8250_port, port);
 
 	serial8250_set_sleep(p, state != 0);
 }
@@ -2566,7 +2582,8 @@ static void serial8250_release_rsa_resource(struct uart_8250_port *up)
 
 static void serial8250_release_port(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 
 	serial8250_release_std_resource(up);
 	if (up->port.type == PORT_RSA)
@@ -2575,7 +2592,8 @@ static void serial8250_release_port(struct uart_port *port)
 
 static int serial8250_request_port(struct uart_port *port)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	int ret = 0;
 
 	ret = serial8250_request_std_resource(up);
@@ -2590,7 +2608,8 @@ static int serial8250_request_port(struct uart_port *port)
 
 static void serial8250_config_port(struct uart_port *port, int flags)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 	int probeflags = PROBE_ANY;
 	int ret;
 
@@ -2771,7 +2790,8 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
 
 static void serial8250_console_putchar(struct uart_port *port, int ch)
 {
-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+	struct uart_8250_port *up =
+		container_of(port, struct uart_8250_port, port);
 
 	wait_for_xmitr(up, UART_LSR_THRE);
 	serial_out(up, UART_TX, ch);
Signature · 1 line
1.7.3.2
#29 lore raw

PATCH 23/36 serial: omap-serial: Add support for kernel debugger

In reply to Greg KH

From: Cosmin Cojocar <[email protected]>

The kgdb invokes the poll_put_char and poll_get_char when communicating with the host. This patch also changes the initialization order because the kgdb will check at the very beginning, if there is a valid serial driver.

---
 drivers/serial/Makefile      |    2 +-
 drivers/serial/omap-serial.c |   38 ++++++++++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 7 deletions(-)
drivers/serial/Makefile +1 -1
index f9b26df..8ea92e9 100644
@@ -80,6 +80,7 @@ obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
 obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
 obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
 obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
+obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
 obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
 obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
 obj-$(CONFIG_SERIAL_TIMBERDALE)	+= timbuart.o
@@ -89,6 +90,5 @@ obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
 obj-$(CONFIG_SERIAL_VT8500) += vt8500_serial.o
 obj-$(CONFIG_SERIAL_MRST_MAX3110)	+= mrst_max3110.o
 obj-$(CONFIG_SERIAL_MFD_HSU)	+= mfd.o
-obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
 obj-$(CONFIG_SERIAL_IFX6X60)  	+= ifx6x60.o
 obj-$(CONFIG_SERIAL_PCH_UART)	+= pch_uart.o
drivers/serial/omap-serial.c +32 -6
index 14365f7..54239f5 100644
@@ -866,12 +866,6 @@ serial_omap_type(struct uart_port *port)
 	return up->name;
 }
 
-#ifdef CONFIG_SERIAL_OMAP_CONSOLE
-
-static struct uart_omap_port *serial_omap_console_ports[4];
-
-static struct uart_driver serial_omap_reg;
-
 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
 
 static inline void wait_for_xmitr(struct uart_omap_port *up)
@@ -905,6 +899,34 @@ static inline void wait_for_xmitr(struct uart_omap_port *up)
 	}
 }
 
+#ifdef CONFIG_CONSOLE_POLL
+
+static void serial_omap_poll_put_char(struct uart_port *port, unsigned char ch)
+{
+	struct uart_omap_port *up = (struct uart_omap_port *)port;
+	wait_for_xmitr(up);
+	serial_out(up, UART_TX, ch);
+}
+
+static int serial_omap_poll_get_char(struct uart_port *port)
+{
+	struct uart_omap_port *up = (struct uart_omap_port *)port;
+	unsigned int status = serial_in(up, UART_LSR);
+
+	if (!(status & UART_LSR_DR))
+		return NO_POLL_CHAR;
+
+	return serial_in(up, UART_RX);
+}
+
+#endif /* CONFIG_CONSOLE_POLL */
+
+#ifdef CONFIG_SERIAL_OMAP_CONSOLE
+
+static struct uart_omap_port *serial_omap_console_ports[4];
+
+static struct uart_driver serial_omap_reg;
+
 static void serial_omap_console_putchar(struct uart_port *port, int ch)
 {
 	struct uart_omap_port *up = (struct uart_omap_port *)port;
@@ -1022,6 +1044,10 @@ static struct uart_ops serial_omap_pops = {
 	.request_port	= serial_omap_request_port,
 	.config_port	= serial_omap_config_port,
 	.verify_port	= serial_omap_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+	.poll_put_char  = serial_omap_poll_put_char,
+	.poll_get_char  = serial_omap_poll_get_char,
+#endif
 };
 
 static struct uart_driver serial_omap_reg = {
Signature · 1 line
1.7.3.2
#25 lore raw

PATCH 21/36 drivers: char: hvc: add arm JTAG DCC console support

In reply to Greg KH

From: Daniel Walker <[email protected]>

This driver adds a basic console that uses the arm JTAG DCC to transfer data back and forth. It has support for ARMv6 and ARMv7.

This console is created under the HVC driver, and should be named /dev/hvcX (or /dev/hvc0 for example).

---
 drivers/char/Kconfig   |    9 +++
 drivers/char/Makefile  |    1 +
 drivers/char/hvc_dcc.c |  133 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 143 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/hvc_dcc.c
drivers/char/Kconfig +9 -0
index 43d3395..d4a7776 100644
@@ -682,6 +682,15 @@ config HVC_UDBG
        select HVC_DRIVER
        default n
 
+config HVC_DCC
+       bool "ARM JTAG DCC console"
+       depends on ARM
+       select HVC_DRIVER
+       help
+         This console uses the JTAG DCC on ARM to create a console under the HVC
+	 driver. This console is used through a JTAG only on ARM. If you don't have
+	 a JTAG then you probably don't want this option.
+
 config VIRTIO_CONSOLE
 	tristate "Virtio console"
 	depends on VIRTIO
drivers/char/Makefile +1 -0
index ba53ec9..fa0b824 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_HVC_CONSOLE)	+= hvc_vio.o hvsi.o
 obj-$(CONFIG_HVC_ISERIES)	+= hvc_iseries.o
 obj-$(CONFIG_HVC_RTAS)		+= hvc_rtas.o
 obj-$(CONFIG_HVC_TILE)		+= hvc_tile.o
+obj-$(CONFIG_HVC_DCC)		+= hvc_dcc.o
 obj-$(CONFIG_HVC_BEAT)		+= hvc_beat.o
 obj-$(CONFIG_HVC_DRIVER)	+= hvc_console.o
 obj-$(CONFIG_HVC_IRQ)		+= hvc_irq.o
drivers/char/hvc_dcc.c new file +133 -0

133 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#24 lore raw

PATCH 20/36 RS485 documentation: add 16C950 UART description

In reply to Greg KH

From: Yegor Yefremov <[email protected]>

Add a notion about 16C950 UART, that is using DTR signal for RS485 mode.

---
 Documentation/serial/serial-rs485.txt |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
Documentation/serial/serial-rs485.txt +5 -4
index a3b1af7..a493238 100644
@@ -11,10 +11,11 @@
 
 2. HARDWARE-RELATED CONSIDERATIONS
 
-   Some CPUs (e.g., Atmel AT91) contain a built-in half-duplex mode capable of
-   automatically controlling line direction by toggling RTS. That can used to
-   control external half-duplex hardware like an RS485 transceiver or any
-   RS232-connected half-duplex device like some modems.
+   Some CPUs/UARTs (e.g., Atmel AT91 or 16C950 UART) contain a built-in
+   half-duplex mode capable of automatically controlling line direction by
+   toggling RTS or DTR signals. That can be used to control external
+   half-duplex hardware like an RS485 transceiver or any RS232-connected
+   half-duplex devices like some modems.
 
    For these microcontrollers, the Linux driver should be made capable of
    working in both modes, and proper ioctls (see later) should be made
Signature · 1 line
1.7.3.2
#23 lore raw

PATCH 19/36 serial: ifx6x60: fix memory leak

In reply to Greg KH

From: Vasiliy Kulikov <[email protected]>

If tty_register_driver() failed then tty_driver is still alive. Free it with put_tty_driver().

---
 drivers/serial/ifx6x60.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/serial/ifx6x60.c +1 -0
index 3f8d5ee..ab93763 100644
@@ -1384,6 +1384,7 @@ static int __init ifx_spi_init(void)
 	if (result) {
 		pr_err("%s: tty_register_driver failed(%d)",
 			DRVNAME, result);
+		put_tty_driver(tty_drv);
 		return result;
 	}
 
Signature · 1 line
1.7.3.2
#22 lore raw

PATCH 18/36 serial: ifx6x60: free IRQ on error

In reply to Greg KH

From: Vasiliy Kulikov <[email protected]>

If second request_irq() failed then the first IRQ must be freed in error handling code.

---
 drivers/serial/ifx6x60.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/serial/ifx6x60.c +3 -1
index 803264a..3f8d5ee 100644
@@ -1133,7 +1133,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
 	if (ret) {
 		dev_err(&spi->dev, "Unable to get irq %x",
 			gpio_to_irq(ifx_dev->gpio.srdy));
-		goto error_ret6;
+		goto error_ret7;
 	}
 
 	/* set pm runtime power state and register with power system */
@@ -1153,6 +1153,8 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
 		mrdy_set_low(ifx_dev);
 	return 0;
 
+error_ret7:
+	free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), (void *)ifx_dev);
 error_ret6:
 	gpio_free(ifx_dev->gpio.srdy);
 error_ret5:
Signature · 1 line
1.7.3.2
#21 lore raw

PATCH 17/36 Serial: EG20T: add PCH_UART driver

In reply to Greg KH

From: Tomoya MORINAGA <[email protected]>

UART driver of Intel EG20T(Topcliff) PCH

Intel EG20T PCH is the platform controller hub that is going to be used in Intel's general embedded platform. All IO peripherals in
Intel EG20T PCH are actually devices sitting on AMBA bus. Intel EG20T PCH has UART I/F. Using this I/F, it is able to access system devices connected to UART.

---
 drivers/serial/Kconfig    |    8 +
 drivers/serial/Makefile   |    1 +
 drivers/serial/pch_uart.c | 1450 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1459 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/pch_uart.c
drivers/serial/Kconfig +8 -0
index 9f6daae..fa02904 100644
@@ -1648,4 +1648,12 @@ config SERIAL_IFX6X60
 	help
 	  Support for the IFX6x60 modem devices on Intel MID platforms.
 
+config SERIAL_PCH_UART
+	tristate "Intel EG20T PCH UART"
+	select SERIAL_CORE
+	depends on PCI
+	help
+	  This driver is for PCH(Platform controller Hub) UART of Intel EG20T
+	  which is an IOH(Input/Output Hub) for x86 embedded processor.
+	  Enabling PCH_DMA, this PCH UART works as DMA mode.
 endmenu
drivers/serial/Makefile +1 -0
index a5e2264..f9b26df 100644
@@ -91,3 +91,4 @@ obj-$(CONFIG_SERIAL_MRST_MAX3110)	+= mrst_max3110.o
 obj-$(CONFIG_SERIAL_MFD_HSU)	+= mfd.o
 obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
 obj-$(CONFIG_SERIAL_IFX6X60)  	+= ifx6x60.o
+obj-$(CONFIG_SERIAL_PCH_UART)	+= pch_uart.o
drivers/serial/pch_uart.c new file +1450 -0

1,450 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#17 lore raw

PATCH 13/36 serial: mpc52xx: make printout for type more generic

In reply to Greg KH

From: Wolfram Sang <[email protected]>

The printout for the type should be just "5xxx", so 512x users won't wonder why they have a mpc52xx-type UART.

---
 drivers/serial/mpc52xx_uart.c |    6 +++++-
 include/linux/serial_core.h   |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/serial/mpc52xx_uart.c +5 -1
index c4399e2..126ec7f 100644
@@ -838,7 +838,11 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct ktermios *new,
 static const char *
 mpc52xx_uart_type(struct uart_port *port)
 {
-	return port->type == PORT_MPC52xx ? "MPC52xx PSC" : NULL;
+	/*
+	 * We keep using PORT_MPC52xx for historic reasons although it applies
+	 * for MPC512x, too, but print "MPC5xxx" to not irritate users
+	 */
+	return port->type == PORT_MPC52xx ? "MPC5xxx PSC" : NULL;
 }
 
 static void
include/linux/serial_core.h +1 -1
index 41603d6..9ff9b7d 100644
@@ -95,7 +95,7 @@
 /* PPC CPM type number */
 #define PORT_CPM        58
 
-/* MPC52xx type numbers */
+/* MPC52xx (and MPC512x) type numbers */
 #define PORT_MPC52xx	59
 
 /* IBM icom */
Signature · 1 line
1.7.3.2
#13 lore raw

PATCH 9/36 TTY: include termios.h in tty_driver.h

In reply to Greg KH

From: Jiri Slaby <[email protected]>

We reference termios and termiox in tty_driver.h, but we do not include linux/termios.h where these are defined. Add the #include properly.

Otherwise when we include tty_driver.h, we get compile errors.

---
 include/linux/tty_driver.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/tty_driver.h +1 -0
index db2d227..09678ed 100644
@@ -235,6 +235,7 @@
 #include <linux/fs.h>
 #include <linux/list.h>
 #include <linux/cdev.h>
+#include <linux/termios.h>
 
 struct tty_struct;
 struct tty_driver;
Signature · 1 line
1.7.3.2
#10 lore raw

PATCH 6/36 serial: cpm_uat: reducing CPM serial latency

In reply to Greg KH

From: Baurzhan Ismagulov <[email protected]>

Setting Rx FIFO size to 1 reduces reader process wakeup latency up to 20x for baud rates <= 9600. This patch sets the Rx FIFO size to 1 for baud rates <= 9600 or if low latency has been requested for the tty.

---
 drivers/serial/cpm_uart/cpm_uart_core.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
drivers/serial/cpm_uart/cpm_uart_core.c +19 -0
index f2b8adc..8692ff9 100644
@@ -72,6 +72,8 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo);
 
 /**************************************************************/
 
+#define HW_BUF_SPD_THRESHOLD    9600
+
 /*
  * Check, if transmit buffers are processed
 */
@@ -503,6 +505,11 @@ static void cpm_uart_set_termios(struct uart_port *port,
 	pr_debug("CPM uart[%d]:set_termios\n", port->line);
 
 	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
+	if (baud <= HW_BUF_SPD_THRESHOLD ||
+	    (pinfo->port.state && pinfo->port.state->port.tty->low_latency))
+		pinfo->rx_fifosize = 1;
+	else
+		pinfo->rx_fifosize = RX_BUF_SIZE;
 
 	/* Character length programmed into the mode register is the
 	 * sum of: 1 start bit, number of data bits, 0 or 1 parity bit,
@@ -594,6 +601,17 @@ static void cpm_uart_set_termios(struct uart_port *port,
 	 */
 	bits++;
 	if (IS_SMC(pinfo)) {
+		/*
+		 * MRBLR can be changed while an SMC/SCC is operating only
+		 * if it is done in a single bus cycle with one 16-bit move
+		 * (not two 8-bit bus cycles back-to-back). This occurs when
+		 * the cp shifts control to the next RxBD, so the change does
+		 * not take effect immediately. To guarantee the exact RxBD
+		 * on which the change occurs, change MRBLR only while the
+		 * SMC/SCC receiver is disabled.
+		 */
+		out_be16(&pinfo->smcup->smc_mrblr, pinfo->rx_fifosize);
+
 		/* Set the mode register.  We want to keep a copy of the
 		 * enables, because we want to put them back if they were
 		 * present.
@@ -604,6 +622,7 @@ static void cpm_uart_set_termios(struct uart_port *port,
 		out_be16(&smcp->smc_smcmr, smcr_mk_clen(bits) | cval |
 		    SMCMR_SM_UART | prev_mode);
 	} else {
+		out_be16(&pinfo->sccup->scc_genscc.scc_mrblr, pinfo->rx_fifosize);
 		out_be16(&sccp->scc_psmr, (sbits << 12) | scval);
 	}
 
Signature · 1 line
1.7.3.2
#9 lore raw

PATCH 5/36 serial: add Documentation about RS485 serial communications

In reply to Greg KH

From: Claudio Scordino <[email protected]>

Documentation about RS485 serial communications

---
 Documentation/serial/00-INDEX         |    2 +
 Documentation/serial/serial-rs485.txt |  119 +++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/serial/serial-rs485.txt
Documentation/serial/00-INDEX +2 -0
index 07dcdb0..e09468a 100644
@@ -14,6 +14,8 @@ riscom8.txt
 	- notes on using the RISCom/8 multi-port serial driver.
 rocket.txt
 	- info on the Comtrol RocketPort multiport serial driver.
+serial-rs485.txt
+	- info about RS485 structures and support in the kernel.
 specialix.txt
 	- info on hardware/driver for specialix IO8+ multiport serial card.
 stallion.txt
Documentation/serial/serial-rs485.txt new file +119 -0

119 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#7 lore raw

PATCH 3/36 n_gsm: Fix support for legacy encoding

In reply to Greg KH

From: Alan Cox <[email protected]>

The mux supports several encoding schemes. Encoding 0 is a "not recommended" mode still sometimes used. This has now been tested with hardware that supports this mode, and found wanting.

Fix the FCS handling in this mode and correct the state machine.

---
 drivers/tty/n_gsm.c |   59 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 46 insertions(+), 13 deletions(-)
drivers/tty/n_gsm.c +46 -13
index 04ef3ef..5256087 100644
@@ -184,6 +184,9 @@ struct gsm_mux {
 #define GSM_DATA		5
 #define GSM_FCS			6
 #define GSM_OVERRUN		7
+#define GSM_LEN0		8
+#define GSM_LEN1		9
+#define GSM_SSOF		10
 	unsigned int len;
 	unsigned int address;
 	unsigned int count;
@@ -191,6 +194,7 @@ struct gsm_mux {
 	int encoding;
 	u8 control;
 	u8 fcs;
+	u8 received_fcs;
 	u8 *txframe;			/* TX framing buffer */
 
 	/* Methods for the receiver side */
@@ -1623,7 +1627,6 @@ static void gsm_dlci_free(struct gsm_dlci *dlci)
 	kfree(dlci);
 }
 
-
 /*
  *	LAPBish link layer logic
  */
@@ -1648,6 +1651,8 @@ static void gsm_queue(struct gsm_mux *gsm)
 
 	if ((gsm->control & ~PF) == UI)
 		gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len);
+	/* generate final CRC with received FCS */
+	gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);
 	if (gsm->fcs != GOOD_FCS) {
 		gsm->bad_fcs++;
 		if (debug & 4)
@@ -1746,6 +1751,8 @@ invalid:
 
 static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
 {
+	unsigned int len;
+
 	switch (gsm->state) {
 	case GSM_SEARCH:	/* SOF marker */
 		if (c == GSM0_SOF) {
@@ -1754,8 +1761,8 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
 			gsm->len = 0;
 			gsm->fcs = INIT_FCS;
 		}
-		break;		/* Address EA */
-	case GSM_ADDRESS:
+		break;
+	case GSM_ADDRESS:	/* Address EA */
 		gsm->fcs = gsm_fcs_add(gsm->fcs, c);
 		if (gsm_read_ea(&gsm->address, c))
 			gsm->state = GSM_CONTROL;
@@ -1763,9 +1770,9 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
 	case GSM_CONTROL:	/* Control Byte */
 		gsm->fcs = gsm_fcs_add(gsm->fcs, c);
 		gsm->control = c;
-		gsm->state = GSM_LEN;
+		gsm->state = GSM_LEN0;
 		break;
-	case GSM_LEN:		/* Length EA */
+	case GSM_LEN0:		/* Length EA */
 		gsm->fcs = gsm_fcs_add(gsm->fcs, c);
 		if (gsm_read_ea(&gsm->len, c)) {
 			if (gsm->len > gsm->mru) {
@@ -1774,8 +1781,28 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
 				break;
 			}
 			gsm->count = 0;
-			gsm->state = GSM_DATA;
+			if (!gsm->len)
+				gsm->state = GSM_FCS;
+			else
+				gsm->state = GSM_DATA;
+			break;
 		}
+		gsm->state = GSM_LEN1;
+		break;
+	case GSM_LEN1:
+		gsm->fcs = gsm_fcs_add(gsm->fcs, c);
+		len = c;
+		gsm->len |= len << 7;
+		if (gsm->len > gsm->mru) {
+			gsm->bad_size++;
+			gsm->state = GSM_SEARCH;
+			break;
+		}
+		gsm->count = 0;
+		if (!gsm->len)
+			gsm->state = GSM_FCS;
+		else
+			gsm->state = GSM_DATA;
 		break;
 	case GSM_DATA:		/* Data */
 		gsm->buf[gsm->count++] = c;
@@ -1783,16 +1810,25 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c)
 			gsm->state = GSM_FCS;
 		break;
 	case GSM_FCS:		/* FCS follows the packet */
-		gsm->fcs = c;
+		gsm->received_fcs = c;
+		if (c == GSM0_SOF) {
+			gsm->state = GSM_SEARCH;
+			break;
+		}
 		gsm_queue(gsm);
-		/* And then back for the next frame */
-		gsm->state = GSM_SEARCH;
+		gsm->state = GSM_SSOF;
+		break;
+	case GSM_SSOF:
+		if (c == GSM0_SOF) {
+			gsm->state = GSM_SEARCH;
+			break;
+		}
 		break;
 	}
 }
 
 /**
- *	gsm0_receive	-	perform processing for non-transparency
+ *	gsm1_receive	-	perform processing for non-transparency
  *	@gsm: gsm data for this ldisc instance
  *	@c: character
  *
@@ -2032,9 +2068,6 @@ struct gsm_mux *gsm_alloc_mux(void)
 }
 EXPORT_SYMBOL_GPL(gsm_alloc_mux);
 
-
-
-
 /**
  *	gsmld_output		-	write to link
  *	@gsm: our mux
Signature · 1 line
1.7.3.2
#3 lore raw
In reply to Greg KH
Quoted 14 lines · Greg KH
Quoted 13 lines · Alan Cox
Quoted 5 lines

There was some arguing about the tty console detection patches, but as the existing ioctl does not work properly, Kay's patch was accepted to resolve this issue and allow systemd to correctly detect consoles.  I know Alan doesn't like this, but I feel it's the best way to solve the issue (combined with the fact that there is no proposed other solution.)

I'm a bit confused about this one Greg - all the distributions used the ioctl you refer to below for this purpose and have for years

Quoted 3 lines

This series also includes the long-out-of-tree ioctl that SUSE and Debian have been dragging around in their kernels for the past 10+ years.  Thanks to Werner for finally submitting it in a mergable form.

Quoted 5 lines
Quoted 1 line

Which I believe means we don't need the sysfs patch as well - Kay ?

I didn't think that the ioctl was sufficient for what systemd required, it was only needed for "old-style" initrd programs like what used to be used in SUSE and other distros, but are now being phased out.

We want all involved ttys below /dev/console not only the primary one. Also we like to get notified about re-configs, hence the poll() support. Both is not covered at the moment, or by the old, now to be merged, ioctl.

Kay

#27 lore raw

RE: [PATCH 22/36] serial: fix pch_uart kconfig & build

In reply to Greg Kroah-Hartman

Hi Greg,

Quoted 2 lines · Greg Kroah-Hartman

Also, the help text says that the
driver enables & uses PCH_DMA, which is not enabled, so select that.

I think PCH_DMA is not always used when a user uses PCH_UART. Since overhead of DMA is not small, in case of low frequent communication, without DMA is better.
Thus, I think "select PCH_DMA" is unnecessary

(Of course, the PCH_UART works both with/without PCH_DMA.)

-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

author
#28 lore raw

Re: [PATCH 22/36] serial: fix pch_uart kconfig & build

Quoted 6 lines · Tomoya MORINAGA

Hi Greg,

Quoted 2 lines · Greg Kroah-Hartman

Also, the help text says that the
driver enables & uses PCH_DMA, which is not enabled, so select that.

Quoted 6 lines

I think PCH_DMA is not always used when a user uses PCH_UART. Since overhead of DMA is not small, in case of low frequent communication, without DMA is better.
Thus, I think "select PCH_DMA" is unnecessary

(Of course, the PCH_UART works both with/without PCH_DMA.)

Patches are always welcome to fix things up :)

thanks,

greg k-h

author
#4 lore raw
In reply to Kay Sievers
Quoted 17 lines · Kay Sievers
Quoted 16 lines · Greg KH
Quoted 14 lines · Alan Cox
Quoted 5 lines

There was some arguing about the tty console detection patches, but as the existing ioctl does not work properly, Kay's patch was accepted to resolve this issue and allow systemd to correctly detect consoles.  I know Alan doesn't like this, but I feel it's the best way to solve the issue (combined with the fact that there is no proposed other solution.)

I'm a bit confused about this one Greg - all the distributions used the ioctl you refer to below for this purpose and have for years

Quoted 3 lines

This series also includes the long-out-of-tree ioctl that SUSE and Debian have been dragging around in their kernels for the past 10+ years.  Thanks to Werner for finally submitting it in a mergable form.

Which I believe means we don't need the sysfs patch as well - Kay ?

Quoted 8 lines
Quoted 3 lines

I didn't think that the ioctl was sufficient for what systemd required, it was only needed for "old-style" initrd programs like what used to be used in SUSE and other distros, but are now being phased out.

We want all involved ttys below /dev/console not only the primary one. Also we like to get notified about re-configs, hence the poll() support. Both is not covered at the moment, or by the old, now to be merged, ioctl.

Ah, ok, that makes sense, and is why I merged both, they are both needed by different users (well, the ioctl users could use the sysfs file, but as it has been used for 10+ years, it's only fair to include it as well to provide backward compatiblity to those users).

thanks,

greg k-h

#41 lore raw

Re: [PATCH 34/36] tty: add 'active' sysfs attribute to tty0 and console device

In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman
drivers/tty/tty_io.c +0 -1
@@ -3232,9 +3232,45 @@ static int __init tty_class_init(void)
 postcore_initcall(tty_class_init);
 
 /* 3/2004 jmc: why do these devices exist? */
-
 static struct cdev tty_cdev, console_cdev;
 

drivers/tty/tty_io.c static int __init tty_class_init(void) · line 3246

Quoted 10 lines
drivers/tty/tty_io.c +10 -0
+static ssize_t show_cons_active(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	struct console *cs[16];
+	int i = 0;
+	struct console *c;
+	ssize_t count = 0;
+
+	acquire_console_sem();
+	for (c = console_drivers; c; c = c->next) {

This should be:
for_each_console(c)
like somebody already suggested.

drivers/tty/tty_io.c static int __init tty_class_init(void) · line 3248

Quoted 2 lines
drivers/tty/tty_io.c +2 -0
+		if (!c->device)
+			continue;

Why are consoles without devices ignored here?

Other than that there are 2 build warnings, see below.

Quoted 37 lines
drivers/tty/tty_io.c +26 -2
+		if (!c->write)
+			continue;
+		if ((c->flags & CON_ENABLED) == 0)
+			continue;
+		cs[i++] = c;
+		if (i >= ARRAY_SIZE(cs))
+			break;
+	}
+	while (i--)
+		count += sprintf(buf + count, "%s%d%c",
+				 cs[i]->name, cs[i]->index, i ? ' ':'\n');
+	release_console_sem();
+
+	return count;
+}
+static DEVICE_ATTR(active, S_IRUGO, show_cons_active, NULL);
+
+static struct device *consdev;
+
+void console_sysfs_notify(void)
+{
+	if (consdev)
+		sysfs_notify(&consdev->kobj, NULL, "active");
+}
+
 /*
  * Ok, now we can initialize the rest of the tty devices and can count
  * on memory allocations, interrupts etc..
@@ -3245,15 +3281,18 @@ int __init tty_init(void)
 	if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
 		panic("Couldn't register /dev/tty driver\n");
-	device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL,
-			      "tty");
+	device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty");
 
 	cdev_init(&console_cdev, &console_fops);

drivers/tty/tty_io.c int __init tty_init(void) · line 3295

Quoted 10 lines
drivers/tty/tty_io.c +5 -1
 	if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) ||
 	    register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0)
 		panic("Couldn't register /dev/console driver\n");
-	device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL,
+	consdev = device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL,
 			      "console");
+	if (IS_ERR(consdev))
+		consdev = NULL;
+	else
+		device_create_file(consdev, &dev_attr_active);

drivers/tty/tty_io.c: In function ‘tty_init’:
drivers/tty/tty_io.c:3309:21: warning: ignoring return value of ‘device_create_file’, declared with attribute warn_unused_result

Quoted 13 lines
drivers/tty/tty_io.c +7 -0
@@ -2967,13 +2977,24 @@ static const struct tty_operations con_ops = {
 
 static struct cdev vc0_cdev;
 
+static ssize_t show_tty_active(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "tty%d\n", fg_console + 1);
+}
+static DEVICE_ATTR(active, S_IRUGO, show_tty_active, NULL);
+
 int __init vty_init(const struct file_operations *console_fops)
 {

drivers/tty/tty_io.c static const struct tty_operations con_ops = { · line 2997

Quoted 10 lines
drivers/tty/tty_io.c +5 -1
 	cdev_init(&vc0_cdev, console_fops);
 	if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
 	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
 		panic("Couldn't register /dev/tty0 driver\n");
-	device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+	tty0dev = device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+	if (IS_ERR(tty0dev))
+		tty0dev = NULL;
+	else
+		device_create_file(tty0dev, &dev_attr_active);

drivers/tty/vt/vt.c: In function ‘vty_init’:
drivers/tty/vt/vt.c:2997:21: warning: ignoring return value of ‘device_create_file’, declared with attribute warn_unused_result

drivers/tty/tty_io.c static const struct tty_operations con_ops = { · line 2999

Quoted 3 lines
drivers/tty/tty_io.c +0 -0
 	vcs_init();
 

regards,

Signature · 2 lines
js
suse labs
#42 lore raw

Re: [PATCH 34/36] tty: add 'active' sysfs attribute to tty0 and console device

Quoted 10 lines · Jiri Slaby
Quoted 9 lines · Greg Kroah-Hartman
drivers/tty/tty_io.c +0 -1
@@ -3232,9 +3232,45 @@ static int __init tty_class_init(void)
  postcore_initcall(tty_class_init);
 
  /* 3/2004 jmc: why do these devices exist? */
-
  static struct cdev tty_cdev, console_cdev;
 
Quoted 14 lines

drivers/tty/tty_io.c static int __init tty_class_init(void) · line 3246

Quoted 10 lines
drivers/tty/tty_io.c +10 -0
+static ssize_t show_cons_active(struct device *dev,
+                             struct device_attribute *attr, char *buf)
+{
+     struct console *cs[16];
+     int i = 0;
+     struct console *c;
+     ssize_t count = 0;
+
+     acquire_console_sem();
+     for (c = console_drivers; c; c = c->next) {

This should be:
for_each_console(c)
like somebody already suggested.

That's exported now? It was local to printk.c at least that time.

Anyway, the only sensible change here is to convert that home-grown ->next thing to a proper kernel linked list, and use the common iterators instead of doing it on our own, or export new custom ones.

Quoted 4 lines

drivers/tty/tty_io.c static int __init tty_class_init(void) · line 3248

Quoted 2 lines
drivers/tty/tty_io.c +2 -0
+             if (!c->device)
+                     continue;

Why are consoles without devices ignored here?

It's a common pattern all over the place. What is a "console without a device" that would be interesting here?

Quoted 9 lines

Other than that there are 2 build warnings, see below.

drivers/tty/tty_io.c static int __init tty_class_init(void) · line 3253

Quoted 6 lines
drivers/tty/tty_io.c +5 -1
-     device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+     tty0dev = device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+     if (IS_ERR(tty0dev))
+             tty0dev = NULL;
+     else
+             device_create_file(tty0dev, &dev_attr_active);
Quoted 3 lines

drivers/tty/vt/vt.c: In function ‘vty_init’:
drivers/tty/vt/vt.c:2997:21: warning: ignoring return value of ‘device_create_file’, declared with attribute warn_unused_result

The code doesn't even check device_create(). :)

Anyway we actually don't want to check the return value of file_create(), it's a non-fatal error, if it ever happens.

What's the preferred way to do that:
int ignore = device_create_file()
?

Kay

#43 lore raw

Re: [PATCH 34/36] tty: add 'active' sysfs attribute to tty0 and console device

Quoted 26 lines · Kay Sievers
Quoted 10 lines · Jiri Slaby
Quoted 9 lines · Greg Kroah-Hartman
drivers/tty/tty_io.c +0 -1
@@ -3232,9 +3232,45 @@ static int __init tty_class_init(void)
 postcore_initcall(tty_class_init);
 
 /* 3/2004 jmc: why do these devices exist? */
-
 static struct cdev tty_cdev, console_cdev;
 
Quoted 14 lines

drivers/tty/tty_io.c static int __init tty_class_init(void) · line 3246

Quoted 10 lines
drivers/tty/tty_io.c +10 -0
+static ssize_t show_cons_active(struct device *dev,
+                             struct device_attribute *attr, char *buf)
+{
+     struct console *cs[16];
+     int i = 0;
+     struct console *c;
+     ssize_t count = 0;
+
+     acquire_console_sem();
+     for (c = console_drivers; c; c = c->next) {

This should be:
for_each_console(c)
like somebody already suggested.

Quoted 5 lines

That's exported now? It was local to printk.c at least that time.

Anyway, the only sensible change here is to convert that home-grown ->next thing to a proper kernel linked list, and use the common iterators instead of doing it on our own, or export new custom ones.

Perhaps -- I didn't look into the code if there is something which blocked this to be done years ago. I doubt there is...

Quoted 7 lines
Quoted 4 lines

drivers/tty/tty_io.c static int __init tty_class_init(void) · line 3248

Quoted 2 lines
drivers/tty/tty_io.c +2 -0
+             if (!c->device)
+                     continue;

Why are consoles without devices ignored here?

It's a common pattern all over the place. What is a "console without a device" that would be interesting here?

For example parport console. The question is whether you are interested in consoles without ttys in systemd and other potential users.

Quoted 9 lines
Quoted 9 lines

Other than that there are 2 build warnings, see below.

Quoted 6 lines
drivers/tty/tty_io.c +5 -1
-     device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+     tty0dev = device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+     if (IS_ERR(tty0dev))
+             tty0dev = NULL;
+     else
+             device_create_file(tty0dev, &dev_attr_active);
Quoted 8 lines
Quoted 3 lines

drivers/tty/vt/vt.c: In function ‘vty_init’:
drivers/tty/vt/vt.c:2997:21: warning: ignoring return value of ‘device_create_file’, declared with attribute warn_unused_result

The code doesn't even check device_create(). :)

Anyway we actually don't want to check the return value of file_create(), it's a non-fatal error, if it ever happens.

Ok, but we don't want to introduce new warnings.

Quoted 2 lines

What's the preferred way to do that:
int ignore = device_create_file()

I think the usual workaround in C is casting to void.

regards,

Signature · 2 lines
js
suse labs
#46 lore raw
In reply to Greg KH
Quoted 4 lines · Greg KH

Here is the big tty and serial merge for .38.  I'll be sending another smaller one that just moves drivers around after .38-rc1 is out, as is the norm for file moves to handle issues with other trees syncing up properly.

Merged. However, the drivers/serial/apbuart.c file conflicted, and both sides of the merge had some insanity in them.

So I did an "evil merge" - a merge that actually changed the code to match neither side - and it looks better to me. But maybe that's just the drugs I'm taking talking.

So people should check it out. In particular, look at the interaction of "drivers: serial: apbuart: Handle OF failures gracefully" and the "Added support for ampopts in APBUART driver. Used in AMP systems" commit.

Linus

author
#47 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Greg KH

Here is the big tty and serial merge for .38.  I'll be sending another smaller one that just moves drivers around after .38-rc1 is out, as is the norm for file moves to handle issues with other trees syncing up properly.

Merged. However, the drivers/serial/apbuart.c file conflicted, and both sides of the merge had some insanity in them.

Quoted 8 lines

So I did an "evil merge" - a merge that actually changed the code to match neither side - and it looks better to me. But maybe that's just the drugs I'm taking talking.

So people should check it out. In particular, look at the interaction of "drivers: serial: apbuart: Handle OF failures gracefully" and the "Added support for ampopts in APBUART driver. Used in AMP systems" commit.

The merge looks ok to me, but I don't have this hardware, so I can't test it. Thomas, can you verify this is ok?

thanks,

greg k-h

#49 lore raw
In reply to Daniel Hellstrom
Quoted 14 lines · Daniel Hellstrom
Quoted 12 lines · Greg KH
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Greg KH

Here is the big tty and serial merge for .38. I'll be sending another smaller one that just moves drivers around after .38-rc1 is out, as is the norm for file moves to handle issues with other trees syncing up properly.

Merged. However, the drivers/serial/apbuart.c file conflicted, and both sides of the merge had some insanity in them.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

So I did an "evil merge" - a merge that actually changed the code to match neither side - and it looks better to me. But maybe that's just the drugs I'm taking talking.

So people should check it out. In particular, look at the interaction of "drivers: serial: apbuart: Handle OF failures gracefully" and the "Added support for ampopts in APBUART driver. Used in AMP systems" commit.

Looks good.

Thanks,

tglx

author
#50 lore raw
Quoted 20 lines · Thomas Gleixner
Quoted 18 lines · Daniel Hellstrom
Quoted 16 lines · Greg KH
Quoted 14 lines · Linus Torvalds
Quoted 5 lines · Greg KH

Here is the big tty and serial merge for .38. I'll be sending another smaller one that just moves drivers around after .38-rc1 is out, as is the norm for file moves to handle issues with other trees syncing up properly.

Merged. However, the drivers/serial/apbuart.c file conflicted, and both sides of the merge had some insanity in them.

So I did an "evil merge" - a merge that actually changed the code to match neither side - and it looks better to me. But maybe that's just the drugs I'm taking talking.

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

So people should check it out. In particular, look at the interaction of "drivers: serial: apbuart: Handle OF failures gracefully" and the "Added support for ampopts in APBUART driver. Used in AMP systems" commit.

Looks good.

Great, thanks for testing.

greg k-h

#48 lore raw
In reply to Greg KH
Quoted 26 lines · Greg KH
Quoted 12 lines · Linus Torvalds
Quoted 6 lines · Greg KH

Here is the big tty and serial merge for .38. I'll be sending another smaller one that just moves drivers around after .38-rc1 is out, as is the norm for file moves to handle issues with other trees syncing up properly.

Merged. However, the drivers/serial/apbuart.c file conflicted, and both sides of the merge had some insanity in them.

Quoted 10 lines

So I did an "evil merge" - a merge that actually changed the code to match neither side - and it looks better to me. But maybe that's just the drugs I'm taking talking.

So people should check it out. In particular, look at the interaction of "drivers: serial: apbuart: Handle OF failures gracefully" and the "Added support for ampopts in APBUART driver. Used in AMP systems" commit.

Quoted 4 lines

The merge looks ok to me, but I don't have this hardware, so I can't test it. Thomas, can you verify this is ok?

The code looks good and I have tested on the APBUART hardware - it works.

Thanks,
Daniel Hellstrom