summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_core.c
Commit message (Collapse)AuthorAgeFilesLines
* tty: Make tiocgicount a handlerAlan Cox2010-10-221-19/+16
| | | | | | | | | | | | | Dan Rosenberg noted that various drivers return the struct with uncleared fields. Instead of spending forever trying to stomp all the drivers that get it wrong (and every new driver) do the job in one place. This first patch adds the needed operations and hooks them up, including the needed USB midlayer and serial core plumbing. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial-core: restore termios settings when resume console portsJason Wang2010-10-221-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* serial-core: skip call set_termios/console_start when no_console_suspendJason Wang2010-10-221-1/+1
| | | | | | | | | | | | | | | | | | 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>
* tty: untangle locking of wait_until_sentArnd Bergmann2010-08-101-9/+22
| | | | | | | | | | | | | | | | | | Some wait_until_sent versions require the big tty mutex, others don't and some callers of wait_until_sent already hold it while other don't. That leads to recursive use of the BTM in these functions, which we're trying to get rid of. This turns all cleans up the locking there so that the driver's wait_until_sent function never takes the BTM itself if it is already called with that lock held. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty: replace BKL with a new tty_lockArnd Bergmann2010-08-101-5/+5
| | | | | | | | | | | As a preparation for replacing the big kernel lock in the TTY layer, wrap all the callers in new macros tty_lock, tty_lock_nested and tty_unlock. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: fix termios settings in openArnd Bergmann2010-08-101-10/+9
| | | | | | | | | | | | | | | | | | | | | | | Move termios initialization in open into uart_dtr_rts to make sure it always gets called when necessary. Based on a suggestion from Alan Cox. Alan writes: Ok this sort of makes sense. Something isn't getting initialised and both getty and minicom will do a termios set which is sorting it out. This is occurring because the generic block_til_ready sets ASYNCB_NORMAL_ACTIVE so the termios updating gets skipped. This patch should cure it and then we can think about doing it more elegantly by getting the serial layer to use tty_port_open, kfifo and the like and removing the tons of repeated crap in all the drivers. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reported-by: Tony Luck <tony.luck@intel.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: Use block_til_ready helperAlan Cox2010-08-101-86/+1
| | | | | | | | | Our code now rather closely resembles the helper, so switch to it. Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: trim locking on the helpersAlan Cox2010-08-101-4/+1
| | | | | | | | | | | | | The port mutex protects port->tty, but these paths never need to walk from port->tty. They do need the low level lock as the API expects that but they already also take it. Thus we can drop the extra mutex lock calls here. Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: add port helpersAlan Cox2010-08-101-14/+37
| | | | | | | | | | | We can make this the same as the ones that will be needed by the tty_port helper logic that we want to move to but still call them from the existing code base. Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: Change the wait for carrier lockingAlan Cox2010-08-101-9/+35
| | | | | | | | | | | | We want to push the lock/unlock into the helper functions so that we can prepare to move to using the tty_port helper. The expansion initially comes out a bit ugly but its worth the temporary expansion IMHO just so we can produce a nice testable series of changes. Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty: serial - fix tty referencing in set_ldiscAlan Cox2010-08-101-1/+1
| | | | | | | | | | Pass down the ldisc number so that the drivers don't have to peek into the tty object themselves. This lets us get rid of another case of back referencing port to tty which we don't want (because of races versus hangup/close). Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty: serial - fix various misuses/mishandlings of port->ttyAlan Cox2010-08-101-49/+60
| | | | | | | | | | Make it robust against hang up events. In most cases we can do this simply by passing the right things in the first place. Signed-off-by: Alan Cox <alan@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: Fix crash if the minimum rate of the device is > 9600 baudAlan Cox2010-01-201-5/+12
| | | | | | | | | | | In that situation if the old rate is invalid and the new rate is invalid and the chip cannot do 9600 baud we report zero, which makes all the drivers explode. Instead force the rate based on min/max Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial-core: resume serial hardware with no_console_suspendStanislav Brabec2010-01-201-55/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Perform a tricky suspend/resume even with no_console_suspend. With no_console_suspend, kernel skips serial port suspend/resume and the serial hardware may remain in undefined state after resume. It actually happens on devices that don't have BIOS that handle serial initialization. It makes impossible to use serial console after resume. Devices affected by this problem include: Sharp Zaurus devices Several PXA based ARM embedded boards The patch does: - Save the hardware state - Perform buffer flush in time of its suspend call - Tell the driver that port is suspended - But still accept new data - And keep console hardware in state that allows to send them It allows to capture late console messages without breaking console after resume. This is just a resend of a patch discussed in these threads, as the patch was not yet applied. "Possible suspend/resume regression in .32-rc?" (Nov 1-5, 2009, ARM list, later LKML) "serial-core: resume serial hardware with no_console_suspend" (Sep 15-Oct 18, 2009, LKML & ARM lists) Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Tested-by: Haojian Zhuang <haojian.zhuang@gmail.com> Tested-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: cascade needless conditionalsAndré Goddard Rosa2009-12-111-7/+5
| | | | | | Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: fix NULL pointer dereferenceAndré Goddard Rosa2009-12-111-10/+11
| | | | | | | | | | | | If kzalloc() or alloc_tty_driver() fails, we call: put_tty_driver(normal = NULL). Then: put_tty_driver -> tty_driver_kref_put -> kref_put(&NULL->kref, ...) Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty, serial: Fix race and NULL check in uart_close()Linus Torvalds2009-10-121-2/+5
| | | | | | | | | | | | | | | Commit 46d57a449aa1 ("serial: use tty_port pointers in the core code") contained two bugs that causes (rare) crashes: - the rename typoed one site - a NULL check was missed Reported-and-tested-by: Ingo Molnar <mingo@elte.hu> Cc: Greg KH <gregkh@suse.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial core: fix new kernel-doc warningsRandy Dunlap2009-09-231-2/+2
| | | | | | | | | | | | | | | | Fix new kernel-doc warnings in serial_core.[hc] files. Warning(include/linux/serial_core.h:485): No description found for parameter 'uport' Warning(include/linux/serial_core.h:485): Excess function parameter 'port' description in 'uart_handle_dcd_change' Warning(include/linux/serial_core.h:511): No description found for parameter 'uport' Warning(include/linux/serial_core.h:511): Excess function parameter 'port' description in 'uart_handle_cts_change' Warning(drivers/serial/serial_core.c:2437): No description found for parameter 'uport' Warning(drivers/serial/serial_core.c:2437): Excess function parameter 'port' description in 'uart_add_one_port' Warning(drivers/serial/serial_core.c:2509): No description found for parameter 'uport' Warning(drivers/serial/serial_core.c:2509): Excess function parameter 'port' description in 'uart_remove_one_port' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Set proper console speed on resume if console suspend is disabledDeepak Saxena2009-09-191-14/+18
| | | | | | | | | | | | | | | | | | | Commit b5b82df6, from May 2007, breaks no_console_suspend on the OLPC XO laptop. Basically what happens is that upon returning from resume, serial8250_resume_port() will reconfigure the port for high speed mode and all console output will be garbled, making debug of the resume path painful. This patch modifies uart_resume_port() to reset the port to the state it was in before we suspended. Original patch by Marcelo Tosatti Second patch by Deepak then reworked by Alan to fit with the tty changes before it got submitted. Also fixed the console path to set c_i/ospeed as some drivers require the termios fields are valid Signed-off-by: Deepak Saxena <dsaxena@laptop.org> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: introduce tty krefsAlan Cox2009-09-191-3/+3
| | | | | | | Initially just use the helper and thus krefs when we set and clear the port values. Signed-off-by: Alan Cox <alan@linux.intel.com>
* serial: kill USF_CLOSING_* definitionsAlan Cox2009-09-191-3/+3
| | | | | | | | | | | The serial layer for some reason uses different defines for the special case close delays and then conditionally switches to/from the normal ones in the ioctls. Remove this rather pointless abstraction Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: move port users helperAlan Cox2009-09-191-4/+2
| | | | | | | This little helper is now tty_port specific and useful generally so move it Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: move delta_msr_wait into the tty_portAlan Cox2009-09-191-7/+11
| | | | | | | This is used by various drivers not just serial and can be extracted as commonality Signed-off-by: Alan Cox <alan@linux.intel.com>
* serial: replace the state mutex with the tty port mutexAlan Cox2009-09-191-108/+119
| | | | | | | | They cover essentially the same stuff and we can therefore fold it into the tty_port one. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: move the flags into the tty_port fieldAlan Cox2009-09-191-76/+77
| | | | | | | | | Fortunately the serial layer was designed to use the same flag values but with different names. It has its own SUSPENDED flag which is a free slot in the ASYNC flags so we allocate it in the ASYNC flags instead. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: move count into the tty_port versionAlan Cox2009-09-191-18/+20
| | | | | | | Remove more stuff from the serial special case code Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: use tty_port pointers in the core codeAlan Cox2009-09-191-142/+146
| | | | | | | | Extract out a lot of the x.port. uses and also show up where there are things left to be isolated that prevent use using the port helpers in the serial layer at this point Signed-off-by: Alan Cox <alan@linux.intel.com>
* serial: Fold closing_* fields into the tty_port onesAlan Cox2009-09-191-13/+13
| | | | | | | Remove some more serial specific use Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: kill off uart_infoAlan Cox2009-09-191-146/+140
| | | | | | | | We moved this into uart_state, now move the fields out of the separate structure and kill it off. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* serial: fixup /proc/tty/driver/serial after proc_fops conversionAlexey Dobriyan2009-04-011-1/+1
| | | | | | | | | | | | | | "struct tty_driver *" lies in m->private not in v which is SEQ_TOKEN_START which is 1 which is enough to trigger NULL dereference next line: BUG: unable to handle kernel NULL pointer dereference at 000000ad IP: [<c040d689>] uart_proc_show+0xe/0x2b0 Noticed by Linus. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* proc tty: switch serial_core to ->proc_fopsAlexey Dobriyan2009-04-011-40/+36
| | | | | | | Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial: struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers2009-01-061-2/+2
| | | | | Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Serial: Allow port type to be specified when calling serial8250_register_port.David Daney2009-01-021-2/+5
| | | | | | | | | | | | | | | | | | | Add flag value UPF_FIXED_TYPE which specifies that the UART type is known and should not be probed. For this case the UARTs properties are just copied out of the uart_config entry. This allows us to keep SOC specific 8250 probe code out of 8250.c. In this case we know the serial hardware will not be changing as it is on the same silicon as the CPU, and we can specify it with certainty in the board/cpu setup code. The alternative is to load up 8250.c with a bunch of OCTEON specific special cases in the probing code. Signed-off-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* fix for tty-serial-move-portAlexander Beregalov2009-01-021-3/+1
| | | | | | | | | | | | | | | | Hi Alan next-20081204 crashes with the following message: BUG: unable to handle kernel paging request at ffff88007d320248 IP: [<ffffffff803de934>] uart_remove_one_port+0xef/0x111 kfree(info); 393: 49 8d 7d 10 lea 0x10(%r13),%rdi 397: e8 00 00 00 00 callq 39c <uart_remove_one_port+0xef> Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: We want the port object to be persistentAlan Cox2009-01-021-83/+61
| | | | | | | | | | | | | Move the tty_port and uart_info bits around a little. By embedding the uart_info into the uart_port we get rid of lots of corner case testing and also get the ability to go port<->state<->info which is a bit more elegant than the current data structures. Downsides - we allocate a tiny bit more memory for unused ports, upside we've removed as much code as it saved for most users.. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drivers/serial: use nr_irqsYinghai Lu2008-10-161-1/+1
| | | | | Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* serial: fix device name reporting when minor space is shared between driversDavid S. Miller2008-10-131-2/+5
| | | | | | | | | | | | | | | | The multiple drivers share the minor space occupied by a particular major number, the actual index within the device name's space is indicated by the tty_driver->name_base + uart_port->line Another usable formula is (uart_driver->minor - MINOR_BASE) + port->line Use those to print the device names properly in such situations in serial_core.c and 8250.c Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial-make-uart_ports-ioport-unsigned-long-fixAndrew Morton2008-10-131-3/+2
| | | | | | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: rework break handlingAlan Cox2008-07-221-1/+2
| | | | | | | | | Some hardware needs to do break handling itself and may have partial support only. Make break_ctl return an error code. Add a tty driver flag so you can indicate driver hardware side break support. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial: use tty_portAlan Cox2008-07-201-38/+42
| | | | | | | | | Switch the serial_core based drivers to use the new tty_port structure. We can't quite use all of it yet because of the dynamically allocated extras in the serial_core layer. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Subject: [PATCH 1/2] serial: Add flush_buffer() operation to uart_opsHaavard Skinnemoen2008-07-201-0/+2
| | | | | | | | | | | | | | | | | Serial drivers using DMA (like the atmel_serial driver) tend to get very confused when the xmit buffer is flushed and nobody told them. They also tend to spew a lot of garbage since the DMA engine keeps running after the buffer is flushed and possibly refilled with unrelated data. This patch adds a new flush_buffer operation to the uart_ops struct, along with a call to it from uart_flush_buffer() right after the xmit buffer has been cleared. The driver can implement this in order to syncronize its internal DMA state with the xmit buffer when the buffer is flushed. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial: fix serial_match_port() for dynamic major tty-device numbersGuennadi Liakhovetski2008-07-041-1/+3
| | | | | | | | | | | | | | | | As reported by Vipul Gandhi, the current serial_match_port() doesn't work for tty-devices using dynamic major number allocation. Fix it. It oopses if you suspend a serial port with _dynamic_ major number. ATM, I think, there's only the drivers/serial/jsm/jsm_driver.c driver, that does it in-tree. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Tested-by: Vipul Gandhi <vcgandhi1@aol.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Fix uart_set_ldisc() function typeLinus Torvalds2008-06-041-1/+1
| | | | | | | | | | | | | | | Commit 64e9159f5d2c4edf5fa6425031e556f8fddaf7e6 ("serial_core: uart_set_ldisc infrastructure") introduced the ability for low-level serial drivers to be informed when the tty ldisc changes. However, the actual tty-layer function that does this callback for serial devices was declared with the wrong type, having a spurious and unused 'ldisc' argument. This fixed the resulting compiler warning by just removing it. Acked-by: Blithering Idiot <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial_core: uart_set_ldisc infrastructureAlan Cox2008-06-031-0/+10
| | | | | | | | | | | | | | | | | The tty layer provides a callback that is used when the line discipline is changed. Some hardware uses this to configure hardware specific features such as IrDA mode on serial ports. Unfortunately the serial layer does not provide this feature or pass it down to drivers. Blackfin used to hack around this by rewriting the tty ops, but those are now properly shared and const so the hack fails. Instead provide the proper operations. This change plus a follow up from the Blackfin guys is needed to avoid blackfin losing features in this release. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial: fix enable_irq_wake/disable_irq_wake imbalance in serial_core.cArjan van de Ven2008-05-241-1/+4
| | | | | | | | | | | | | | | | | enable_irq_wake() and disable_irq_wake() need to be balanced. However, serial_core.c calls these for different conditions during the suspend and resume functions... This is causing a regular WARN_ON() as found at http://www.kerneloops.org/search.php?search=set_irq_wake This patch makes the conditions for triggering the _wake enable/disable sequence identical. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial: access after NULL check in uart_flush_buffer()Tetsuo Handa2008-05-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | I noticed that static void uart_flush_buffer(struct tty_struct *tty) { struct uart_state *state = tty->driver_data; struct uart_port *port = state->port; unsigned long flags; /* * This means you called this function _after_ the port was * closed. No cookie for you. */ if (!state || !state->info) { WARN_ON(1); return; } is too late for checking state != NULL. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: The big operations reworkAlan Cox2008-04-301-12/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Operations are now a shared const function block as with most other Linux objects - Introduce wrappers for some optional functions to get consistent behaviour - Wrap put_char which used to be patched by the tty layer - Document which functions are needed/optional - Make put_char report success/fail - Cache the driver->ops pointer in the tty as tty->ops - Remove various surplus lock calls we no longer need - Remove proc_write method as noted by Alexey Dobriyan - Introduce some missing sanity checks where certain driver/ldisc combinations would oops as they didn't check needed methods were present [akpm@linux-foundation.org: fix fs/compat_ioctl.c build] [akpm@linux-foundation.org: fix isicom] [akpm@linux-foundation.org: fix arch/ia64/hp/sim/simserial.c build] [akpm@linux-foundation.org: fix kgdb] Signed-off-by: Alan Cox <alan@redhat.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Cc: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial: switch the serial core to int put_char methodsAlan Cox2008-04-301-4/+8
| | | | | | | Signed-off-by: Alan Cox <alan@redhat.com> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial_core: Prepare for BKL push downAlan Cox2008-04-301-7/+9
| | | | | | | | | | | Instead of checking for the BKL in these methods, take it ourselves. That avoids propogating it into the serial drivers and we can then fix them later on. Signed-off-by: Alan Cox <alan@redhat.com> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* uart_get_baud_rate: stop mangling termiosAlan Cox2008-04-281-4/+11
| | | | | | | | | | | | Russell King noticed this one: We have to avoid replacing B0 when we pick a baud rate for a "hung up" port. Ugly but the proper fix is in the tty layer and means changing the tty<->serial interfaces so we will defer that for now. [akpm@linux-foundation.org: fix uninitialised var] Signed-off-by: Alan Cox <alan@redhat.com> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
OpenPOWER on IntegriCloud