All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Re: Oops on 2.6.1-rc1 serial access
@ 2004-01-04  6:38 David Dillow
  2004-01-05 19:04 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Dillow @ 2004-01-04  6:38 UTC (permalink / raw)
  To: sparclinux

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

On Sat, 2004-01-03 at 22:07, David Dillow wrote:
> The oops occurs when running the command without arguments, which causes
> it to scan for available ports. According to the attached strace output,
> it dies opening ttyS2 -- both ttyS0 & ttyS1 are ok.

Sunzilog was telling the serial core that we were going to register 4
ports, but then only registered 2. Serial core was calling uart_close()
on ports that had never been set up (ttyS2 & ttyS3), therefore the
illegal access.

The attached patch teaches Sunzilog to not count ports attached to a
keyboard or mouse when registering with serial_core. With this patch, I
no longer get an oops when opening the problem ports.

There's probably a simpler way (like, oh, subtracting 2 from
NUM_CHANNELS), but this way doesn't care how many keyboard/mice ports
are there, as long as they are marked.

Dave

[-- Attachment #2: sunzilog.patch --]
[-- Type: text/plain, Size: 1249 bytes --]

--- linux-2.6.1-rc1/drivers/serial/sunzilog.c.orig	2004-01-04 01:31:36.000000000 -0500
+++ linux-2.6.1-rc1/drivers/serial/sunzilog.c	2004-01-04 01:32:19.000000000 -0500
@@ -1631,6 +1631,8 @@
 {
 	struct zs_probe_scan scan;
 	int ret;
+	int uart_count;
+	int i;
 
 	printk(KERN_DEBUG "SunZilog: %d chips.\n", NUM_SUNZILOG);
 
@@ -1650,18 +1652,27 @@
 	sunzilog_init_hw();
 
 	/* We can only init this once we have probed the Zilogs
-	 * in the system.
+	 * in the system. Do not count channels assigned to keyboards
+	 * or mice when we are deciding how many ports to register.
 	 */
-	sunzilog_reg.nr = NUM_CHANNELS;
+	uart_count = 0;
+	for (i = 0; i < NUM_CHANNELS; i++) {
+		struct uart_sunzilog_port *up = &sunzilog_port_table[i];
+
+		if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up))
+			continue;
+
+		uart_count++;
+	}
+		
+	sunzilog_reg.nr = uart_count;
 	sunzilog_reg.cons = SUNZILOG_CONSOLE;
 
 	sunzilog_reg.minor = sunserial_current_minor;
-	sunserial_current_minor += NUM_CHANNELS;
+	sunserial_current_minor += uart_count;
 
 	ret = uart_register_driver(&sunzilog_reg);
 	if (ret == 0) {
-		int i;
-
 		for (i = 0; i < NUM_CHANNELS; i++) {
 			struct uart_sunzilog_port *up = &sunzilog_port_table[i];
 

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

* Re: [PATCH] Re: Oops on 2.6.1-rc1 serial access
  2004-01-04  6:38 [PATCH] Re: Oops on 2.6.1-rc1 serial access David Dillow
@ 2004-01-05 19:04 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-01-05 19:04 UTC (permalink / raw)
  To: sparclinux

On 04 Jan 2004 01:38:07 -0500
David Dillow <dave@thedillows.org> wrote:

> Sunzilog was telling the serial core that we were going to register 4
> ports, but then only registered 2. Serial core was calling uart_close()
> on ports that had never been set up (ttyS2 & ttyS3), therefore the
> illegal access.
> 
> The attached patch teaches Sunzilog to not count ports attached to a
> keyboard or mouse when registering with serial_core. With this patch, I
> no longer get an oops when opening the problem ports.

Looks great, patch applied.

Thanks David.

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

end of thread, other threads:[~2004-01-05 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-04  6:38 [PATCH] Re: Oops on 2.6.1-rc1 serial access David Dillow
2004-01-05 19:04 ` David S. Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.