WSL2-Linux-Kernel/drivers/char
Dave Young f278a2f7bb tty: Fix regressions caused by commit b50989dc
The following commit made console open fails while booting:

	commit b50989dc44
	Author: Alan Cox <alan@linux.intel.com>
	Date:   Sat Sep 19 13:13:22 2009 -0700

	tty: make the kref destructor occur asynchronously

Due to tty release routines run in a workqueue now, error like the
following will be reported while booting:

INIT open /dev/console Input/output error

It also causes hibernation regression to appear as reported at
http://bugzilla.kernel.org/show_bug.cgi?id=14229

The reason is that now there's latency issue with closing, but when
we open a "closing not finished" tty, -EIO will be returned.

Fix it as per the following Alan's suggestion:

  Fun but it's actually not a bug and the fix is wrong in itself as
  the port may be closing but not yet being destructed, in which case
  it seems to do the wrong thing.  Opening a tty that is closing (and
  could be closing for long periods) is supposed to return -EIO.

  I suspect a better way to deal with this and keep the old console
  timing is to split tty->shutdown into two functions.

  tty->shutdown() - called synchronously just before we dump the tty
  onto the waitqueue for destruction

  tty->cleanup() - called when the destructor runs.

  We would then do the shutdown part which can occur in IRQ context
  fine, before queueing the rest of the release (from tty->magic = 0
  ...  the end) to occur asynchronously

  The USB update in -next would then need a call like

       if (tty->cleanup)
               tty->cleanup(tty);

  at the top of the async function and the USB shutdown to be split
  between shutdown and cleanup as the USB resource cleanup and final
  tidy cannot occur synchronously as it needs to sleep.

  In other words the logic becomes

       final kref put
               make object unfindable

       async
               clean it up

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
[ rjw: Rebased on top of 2.6.31-git, reworked the changelog. ]
Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl>
[ Changed serial naming to match new rules, dropped tty_shutdown as per
  comments from Alan Stern  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-27 13:35:16 -07:00
..
agp const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
hw_random virtio: add virtio IDs file 2009-09-23 22:26:32 +09:30
ip2 tty: rewrite the ldisc locking 2009-06-11 08:51:01 -07:00
ipmi trivial: add __init macro/ fix of __exit macro location in ipmi_poweroff.c 2009-09-21 15:14:58 +02:00
mwave mwave: fix read buffer overflow 2009-09-24 07:21:03 -07:00
pcmcia pcmcia: fix read buffer overflow 2009-09-22 07:17:42 -07:00
rio drivers/char/rio/rioctrl.c: off by one error in rioctrl.c 2009-09-24 07:21:03 -07:00
tpm Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6 2009-09-23 15:18:57 -07:00
xilinx_hwicap xilinx_hwicap: remove improper wording in license statement 2008-12-17 11:23:07 -08:00
.gitignore
ChangeLog
Kconfig drivers/char/uv_mmtimer.c: add memory mapped RTC driver for UV 2009-09-24 07:21:03 -07:00
Makefile drivers/char/uv_mmtimer.c: add memory mapped RTC driver for UV 2009-09-24 07:21:03 -07:00
amiserial.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
apm-emulation.c APM emulation: Notify about all suspend events, not just APM invoked ones (v2) 2008-07-16 23:27:02 +02:00
applicom.c applicom: Auto-load applicom module when device opened. 2009-04-06 14:36:30 -07:00
applicom.h
bfin-otp.c bfin-otp: add writing support 2009-09-24 07:21:03 -07:00
bfin_jtag_comm.c bfin_jtag_comm: clean up printk usage 2009-06-22 11:32:23 -07:00
briq_panel.c briq_panel: BKL pushdown 2008-06-20 14:05:55 -06:00
bsr.c powerpc/BSR: Fix BSR to allow mmap of small BSR on 64k kernel 2009-06-26 14:37:26 +10:00
cd1865.h
consolemap.c consolemap: indentation & braces disagree - reindent 2009-01-06 15:59:30 -08:00
cp437.uni unicode table for cp437 2008-12-13 11:25:49 -08:00
cs5535_gpio.c Add a bunch of cycle_kernel_lock() calls 2008-06-20 14:05:53 -06:00
cyclades.c serial: move delta_msr_wait into the tty_port 2009-09-19 13:13:31 -07:00
defkeymap.c_shipped Fix default compose table initialization 2008-03-03 14:53:16 -08:00
defkeymap.map
digi1.h
digiFep1.h
digiPCI.h
ds1302.c rtc: use bcd2bin/bin2bcd 2008-10-20 08:52:41 -07:00
ds1620.c [ARM] netwinder: clean up GPIO naming 2008-12-13 09:12:07 +00:00
dsp56k.c device create: char: convert device_create_drvdata to device_create 2008-10-16 09:24:42 -07:00
dtlk.c dtlk: off by one in {read,write}_tts() 2009-06-19 16:46:06 -07:00
efirtc.c drivers/char/efirtc.c: removed duplicated #include 2008-08-04 16:59:56 -07:00
epca.c trivial: remove unnecessary semicolons 2009-09-21 15:14:58 +02:00
epca.h epca: use tty_port 2008-07-20 17:12:36 -07:00
epcaconfig.h
esp.c serial: move delta_msr_wait into the tty_port 2009-09-19 13:13:31 -07:00
generic_nvram.c powerpc/nvram: Enable use Generic NVRAM driver for different size chips 2009-09-11 16:02:11 +10:00
generic_serial.c tty: Remove some pointless casts 2009-01-02 10:19:40 -08:00
genrtc.c genrtc: BKL pushdown 2008-06-20 14:05:57 -06:00
hangcheck-timer.c
hpet.c hpet: hpet driver periodic timer setup bug fixes 2009-09-24 07:21:03 -07:00
hvc_beat.c powerpc/cell: Use correct types in beat files 2009-01-08 16:25:16 +11:00
hvc_console.c hvc_console: Provide (un)locked version for hvc_resize() 2009-09-24 15:12:47 +10:00
hvc_console.h hvc_console: Provide (un)locked version for hvc_resize() 2009-09-24 15:12:47 +10:00
hvc_irq.c hvc_console: Call free_irq() only if request_irq() was successful 2009-01-13 14:48:01 +11:00
hvc_iseries.c drivers/hvc: Add missing __devexit_p() 2009-06-16 14:15:44 +10:00
hvc_iucv.c hvc_console: Provide (un)locked version for hvc_resize() 2009-09-24 15:12:47 +10:00
hvc_rtas.c [POWERPC] hvc_rtas_init() must be __init 2008-02-14 22:11:02 +11:00
hvc_udbg.c powerpc: udbg-based backend for hvc_console 2008-11-19 16:04:25 +11:00
hvc_vio.c hvc_console: Add __init and __exit to hvc_vio 2009-08-28 14:24:11 +10:00
hvc_xen.c hvc_console: Add a hangup notifier for backends 2008-10-22 10:59:54 +11:00
hvcs.c Merge commit 'origin/master' into next 2009-06-18 11:16:55 +10:00
hvsi.c powerpc/hvsi: Avoid calculating possibly-invalid address 2009-08-20 10:29:28 +10:00
i8k.c i8k: Add Dell Vostro systems 2009-01-02 10:28:32 -08:00
isicom.c isicom: split the open method for the isicom device 2009-09-19 13:13:27 -07:00
istallion.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
keyboard.c Input: keyboard - remove warning about raw mode not supported 2009-04-20 21:21:24 -07:00
lp.c device create: char: convert device_create_drvdata to device_create 2008-10-16 09:24:42 -07:00
mbcs.c [IA64] mbcs: fix printk format warnings 2009-09-15 08:42:00 -07:00
mbcs.h
mem.c const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
misc.c seq_file: constify seq_operations 2009-09-23 07:39:29 -07:00
mmtimer.c mmtimer: Push BKL down into the ioctl handler 2008-07-17 11:34:49 -07:00
moxa.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
moxa.h Char: moxa, cleanup rx/tx 2008-04-30 08:29:43 -07:00
mspec.c const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
mxser.c tty: Char: mxser, use THRE for ASPP_OQUEUE ioctl 2009-09-19 13:13:38 -07:00
mxser.h mxser: convert large macros to functions 2008-04-30 08:29:49 -07:00
n_hdlc.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
n_r3964.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
n_tty.c n_tty: move echoctl check and clean up logic 2009-09-19 13:13:34 -07:00
nozomi.c tty: fix chars_in_buffers 2009-07-20 16:38:43 -07:00
nsc_gpio.c
nvram.c [PATCH] nvram - convert PRINT_PROC to seq_file 2008-11-11 09:56:00 +00:00
nwbutton.c
nwbutton.h
nwflash.c [ARM] netwinder: clean up GPIO naming 2008-12-13 09:12:07 +00:00
pc8736x_gpio.c pc8736x_gpio: add support for PC87365 chips 2008-10-20 08:52:40 -07:00
ppdev.c ppdev: reduce kernel log spam 2009-06-18 13:03:54 -07:00
ps3flash.c ps3flash: Always read chunks of 256 KiB, and cache them 2009-06-15 16:47:27 +10:00
pty.c pty_write: don't do a tty_wakeup() when the buffers are full 2009-09-18 07:05:58 -07:00
random.c sysctl: remove "struct file *" argument of ->proc_handler 2009-09-24 07:21:04 -07:00
raw.c Driver-Core: extend devnode callbacks to provide permissions 2009-09-19 12:50:38 -07:00
riscom8.c tty: riscom8, fix tty refcnt 2009-09-19 13:13:37 -07:00
riscom8.h tty: add more tty_port fields 2008-07-20 17:12:38 -07:00
riscom8_reg.h
rocket.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
rocket.h tty: rocketport uses different port flags to everyone else 2009-01-02 10:19:39 -08:00
rocket_int.h tty: rocketport uses different port flags to everyone else 2009-01-02 10:19:39 -08:00
rtc.c RTC: Remove the BKL. 2009-01-08 16:44:03 -07:00
scc.h m68k: atari - Rename "mfp" to "st_mfp" 2009-02-22 09:23:02 -08:00
scx200_gpio.c Add a bunch of cycle_kernel_lock() calls 2008-06-20 14:05:53 -06:00
selection.c tty: rewrite the ldisc locking 2009-06-11 08:51:01 -07:00
ser_a2232.c m68k: ser_a2232 - Kill warn_unused_result warnings 2009-01-12 20:56:39 +01:00
ser_a2232.h
ser_a2232fw.ax
ser_a2232fw.h
serial167.c cleanup console_print() 2009-09-14 17:41:42 -07:00
snsc.c device create: char: convert device_create_drvdata to device_create 2008-10-16 09:24:42 -07:00
snsc.h Convert asm/semaphore.h users to linux/semaphore.h 2008-04-18 22:22:54 -04:00
snsc_event.c byteorder: don't directly include linux/byteorder/generic.h 2008-05-16 12:01:45 -07:00
sonypi.c Rationalize fasync return values 2009-03-16 08:34:35 -06:00
specialix.c specialix.c: convert nested spin_lock_irqsave to spin_lock 2009-07-20 16:38:43 -07:00
specialix_io8.h tty: add more tty_port fields 2008-07-20 17:12:38 -07:00
stallion.c tty: Add carrier processing on close to the tty_port core 2009-06-11 08:50:56 -07:00
sx.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
sx.h Char: char/serial, remove SERIAL_TYPE_NORMAL redefines 2008-02-07 08:42:33 -08:00
sxboards.h
sxwindow.h
synclink.c hdlc: convert to netdev_tx_t 2009-09-01 01:13:31 -07:00
synclink_gt.c hdlc: convert to netdev_tx_t 2009-09-01 01:13:31 -07:00
synclinkmp.c hdlc: convert to netdev_tx_t 2009-09-01 01:13:31 -07:00
sysrq.c perf: Do the big rename: Performance Counters -> Performance Events 2009-09-21 14:28:04 +02:00
tb0219.c Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
tlclk.c tlckl: BKL pushdown 2008-06-20 14:05:51 -06:00
toshiba.c toshiba: use ioremap_cached 2008-04-30 23:15:34 +02:00
tty_audit.c tty: remove buffer special casing 2009-06-11 08:51:02 -07:00
tty_buffer.c pty: avoid forcing 'low_latency' tty flag 2009-07-29 12:15:56 -07:00
tty_io.c tty: Fix regressions caused by commit b50989dc 2009-09-27 13:35:16 -07:00
tty_ioctl.c tty: vt: use printk_once 2009-09-19 13:13:35 -07:00
tty_ldisc.c tty-ldisc: get rid of tty_ldisc_try_get() helper function 2009-09-19 13:13:10 -07:00
tty_port.c TTY: fix typos 2009-09-19 13:13:36 -07:00
uv_mmtimer.c drivers/char/uv_mmtimer.c: add memory mapped RTC driver for UV 2009-09-24 07:21:03 -07:00
vc_screen.c vc: create vcs(a) devices for consoles 2009-07-20 16:38:43 -07:00
viotape.c tape: beyond ARRAY_SIZE of viocd_diskinfo 2009-06-02 10:32:34 +10:00
virtio_console.c virtio: add virtio IDs file 2009-09-23 22:26:32 +09:30
vme_scc.c m68k: vme_scc - Kill warn_unused_result warnings 2009-01-12 20:56:38 +01:00
vt.c tty: vt: use printk_once 2009-09-19 13:13:35 -07:00
vt_ioctl.c tty: Power: fix suspend vt regression 2009-09-19 13:13:35 -07:00