aboutsummaryrefslogtreecommitdiffstats
path: root/tty
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2010-09-01 15:29:57 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2010-09-01 15:29:57 -0700
commita673f25b4013b7b6484ef935ce5a63dc5a248a7e (patch)
tree332efe03a21e9549032f20f3defae9211865f843 /tty
parent9c19ffe7b6129ad4babb0762c3b342d02679b9ce (diff)
downloadpatches-a673f25b4013b7b6484ef935ce5a63dc5a248a7e.tar.gz
more patches
Diffstat (limited to 'tty')
-rw-r--r--tty/serial-core-restore-termios-settings-when-resume-console-ports.patch61
-rw-r--r--tty/serial-core-skip-call-set_termios-console_start-when-no_console_suspend.patch39
-rw-r--r--tty/vt-use-pit_tick_rate-in-vt-beep-ioctl.patch78
3 files changed, 100 insertions, 78 deletions
diff --git a/tty/serial-core-restore-termios-settings-when-resume-console-ports.patch b/tty/serial-core-restore-termios-settings-when-resume-console-ports.patch
new file mode 100644
index 00000000000000..97651f1ee022f0
--- /dev/null
+++ b/tty/serial-core-restore-termios-settings-when-resume-console-ports.patch
@@ -0,0 +1,61 @@
+From jason77.wang@gmail.com Wed Sep 1 14:08:21 2010
+From: Jason Wang <jason77.wang@gmail.com>
+To: gregkh@suse.de, alan@linux.intel.com, arnd@arndb.de,
+ sbrabec@suse.cz
+Cc: linux-serial@vger.kernel.org
+Subject: serial-core: restore termios settings when resume console ports
+Date: Sat, 21 Aug 2010 15:14:42 +0800
+Message-Id: <1282374882-6651-3-git-send-email-jason77.wang@gmail.com>
+
+The commit 4547be7 rewrites suspend and resume functions. According
+to this rewrite, when a serial port is a printk console device and
+can suspend(without set no_console_suspend flag), it will definitely
+call set_termios function during its resume, but parameter termios
+isn't initialized, this will pass an unpredictable config to the
+serial port. If this serial port is not a userspace opened tty device
+, a suspend and resume action will make this serial port unusable.
+I.E. ttyS0 is a printk console device, ttyS1 or keyboard+display is
+userspace tty device, a suspend/resume action will make ttyS0
+unusable.
+
+If a serial port is both a printk console device and an opened tty
+device, this issue can be overcome because it will call set_termios
+again with the correct parameter in the uart_change_speed function.
+
+Refer to the deleted content of commit 4547be7, revert parts relate
+to restore settings into parameter termios. It is safe because if
+a serial port is a printk console only device, the only meaningful
+field in termios is c_cflag and its old config is saved in
+uport->cons->cflag, if this port is also an opened tty device,
+it will clear uport->cons->cflag in the uart_open and the old config
+is saved in tty->termios.
+
+Signed-off-by: Jason Wang <jason77.wang@gmail.com>
+Acked-by: Stanislav Brabec <sbrabec@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/serial_core.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+--- a/drivers/serial/serial_core.c
++++ b/drivers/serial/serial_core.c
+@@ -2066,6 +2066,18 @@ int uart_resume_port(struct uart_driver
+ * Re-enable the console device after suspending.
+ */
+ if (console_suspend_enabled && uart_console(uport)) {
++ /*
++ * First try to use the console cflag setting.
++ */
++ memset(&termios, 0, sizeof(struct ktermios));
++ termios.c_cflag = uport->cons->cflag;
++
++ /*
++ * If that's unset, use the tty termios setting.
++ */
++ if (port->tty && port->tty->termios && termios.c_cflag == 0)
++ termios = *(port->tty->termios);
++
+ uart_change_pm(state, 0);
+ uport->ops->set_termios(uport, &termios, NULL);
+ console_start(uport->cons);
diff --git a/tty/serial-core-skip-call-set_termios-console_start-when-no_console_suspend.patch b/tty/serial-core-skip-call-set_termios-console_start-when-no_console_suspend.patch
new file mode 100644
index 00000000000000..ea045ea027cb33
--- /dev/null
+++ b/tty/serial-core-skip-call-set_termios-console_start-when-no_console_suspend.patch
@@ -0,0 +1,39 @@
+From jason77.wang@gmail.com Wed Sep 1 14:08:06 2010
+From: Jason Wang <jason77.wang@gmail.com>
+To: gregkh@suse.de, alan@linux.intel.com, arnd@arndb.de,
+ sbrabec@suse.cz
+Cc: linux-serial@vger.kernel.org
+Subject: serial-core: skip call set_termios/console_start when no_console_suspend
+Date: Sat, 21 Aug 2010 15:14:41 +0800
+Message-Id: <1282374882-6651-2-git-send-email-jason77.wang@gmail.com>
+
+The commit 4547be7 rewrites suspend and resume functions, this
+introduces a problem on the OMAP3EVM platoform. when the kernel boots
+with no_console_suspend and we suspend the kernel, then resume it,
+the serial console will be not usable. This problem should be common
+for all platforms.
+The cause for this problem is that when enter suspend, if we choose
+no_console_suspend, the console_stop will be skiped. But in resume
+function, the console port will be set to uninitialized state by
+calling set_termios function and the console_start is called without
+checking whether the no_console_suspend is set, Now fix it.
+
+Signed-off-by: Jason Wang <jason77.wang@gmail.com>
+Acked-by: Stanislav Brabec <sbrabec@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/serial_core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/serial/serial_core.c
++++ b/drivers/serial/serial_core.c
+@@ -2065,7 +2065,7 @@ int uart_resume_port(struct uart_driver
+ /*
+ * Re-enable the console device after suspending.
+ */
+- if (uart_console(uport)) {
++ if (console_suspend_enabled && uart_console(uport)) {
+ uart_change_pm(state, 0);
+ uport->ops->set_termios(uport, &termios, NULL);
+ console_start(uport->cons);
diff --git a/tty/vt-use-pit_tick_rate-in-vt-beep-ioctl.patch b/tty/vt-use-pit_tick_rate-in-vt-beep-ioctl.patch
deleted file mode 100644
index 3aa34c8da9fd86..00000000000000
--- a/tty/vt-use-pit_tick_rate-in-vt-beep-ioctl.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From arnd@arndb.de Wed Sep 1 13:04:58 2010
-From: Arnd Bergmann <arnd@arndb.de>
-To: linux-kernel@vger.kernel.org,
- Greg KH <greg@kroah.com>,
- linux-input@vger.kernel.org,
- Alan Cox <alan@lxorguk.ukuu.org.uk>,
- Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Subject: vt: use PIT_TICK_RATE in vt beep ioctl
-Date: Tue, 24 Aug 2010 15:53:11 +0200
-Cc: linux-arm-kernel@lists.infradead.org,
- David Yang <david.yangshuai@gmail.com>,
- Eric Miao <eric.y.miao@gmail.com>,
- Emmanuel Colbus <emmanuel.colbus@ensimag.imag.fr>,
- Andrew Morton <akpm@osdl.org>
-Message-Id: <201008241553.11219.arnd@arndb.de>
-
-The KIOCSOUND and KDMKTONE ioctls are based on the
-CLOCK_TICK_RATE, which is architecture and sometimes
-configuration specific.
-
-In practice, most user applications assume that it
-is actually defined as the i8253 PIT base clock of
-1193182 Hz, which is true on some architectures
-but not on others.
-
-This patch makes the vt code use the PIT frequency
-on all architectures, which is much more well-defined.
-It will change the behavior of user applications
-sending the beep ioctl on all architectures that
-define CLOCK_TICK_RATE different from PIT_TICK_RATE.
-
-The original breakage was introduced in commit bcc8ca099
-"Adapt drivers/char/vt_ioctl.c to non-x86".
-Hopefully, reverting this change will make the frequency
-correct in more cases than it will make it incorrect.
-
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
-Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-
----
- drivers/char/vt_ioctl.c | 16 ++++++++--------
- 1 file changed, 8 insertions(+), 8 deletions(-)
-
---- a/drivers/char/vt_ioctl.c
-+++ b/drivers/char/vt_ioctl.c
-@@ -533,11 +533,14 @@ int vt_ioctl(struct tty_struct *tty, str
- case KIOCSOUND:
- if (!perm)
- goto eperm;
-- /* FIXME: This is an old broken API but we need to keep it
-- supported and somehow separate the historic advertised
-- tick rate from any real one */
-+ /*
-+ * The use of PIT_TICK_RATE is historic, it used to be
-+ * the platform-dependent CLOCK_TICK_RATE between 2.6.12
-+ * and 2.6.36, which was a minor but unfortunate ABI
-+ * change.
-+ */
- if (arg)
-- arg = CLOCK_TICK_RATE / arg;
-+ arg = PIT_TICK_RATE / arg;
- kd_mksound(arg, 0);
- break;
-
-@@ -553,11 +556,8 @@ int vt_ioctl(struct tty_struct *tty, str
- */
- ticks = HZ * ((arg >> 16) & 0xffff) / 1000;
- count = ticks ? (arg & 0xffff) : 0;
-- /* FIXME: This is an old broken API but we need to keep it
-- supported and somehow separate the historic advertised
-- tick rate from any real one */
- if (count)
-- count = CLOCK_TICK_RATE / count;
-+ count = PIT_TICK_RATE / count;
- kd_mksound(count, ticks);
- break;
- }