Patchwork [4/4] hvc_console: comment mb and make it an smp_ one

login
register
mail settings
Submitter Milton Miller
Date Jan. 8, 2009, 12:14 p.m.
Message ID <hvc-console-29-3-4@bga.com>
Download mbox | patch
Permalink /patch/17341/
State Accepted, archived
Commit 9fef3d2d15ae8ca24e4a145f2e189eea145d18c2
Headers show

Comments

Milton Miller - Jan. 8, 2009, 12:14 p.m.
I remember some history on this barrier.  There was a race between
open via /dev/console and the tty being fully setup.  Its also why
there is a temporary variable and the global is assigned at the end
of the function.

Signed-off-by: Milton Miller <miltonm@bga.com>

Patch

Index: work.git/drivers/char/hvc_console.c
===================================================================
--- work.git.orig/drivers/char/hvc_console.c	2009-01-08 04:33:39.000000000 -0600
+++ work.git/drivers/char/hvc_console.c	2009-01-08 04:35:09.000000000 -0600
@@ -875,8 +875,11 @@  static int hvc_init(void)
 		goto stop_thread;
 	}
 
-	/* FIXME: This mb() seems completely random.  Remove it. */
-	mb();
+	/*
+	 * Make sure tty is fully registered before allowing it to be
+	 * found by hvc_console_device.
+	 */
+	smp_mb();
 	hvc_driver = drv;
 	return 0;