summaryrefslogtreecommitdiffstats
path: root/drivers
Commit message (Collapse)AuthorAgeFilesLines
* tty: Remove lots of NULL checksAlan Cox2008-10-136-79/+1
| | | | | | | | | | Many tty drivers contain 'can't happen' checks against NULL pointers passed in by the tty layer. These have never been possible to occur. Even more importantly if they ever do occur we want to know as it would be a serious bug. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: fix up gigaset a bitAlan Cox2008-10-131-15/+12
| | | | | | | | Stephen's fixes reminded me that gigaset is still rather broken so fix it up a bit Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Fallout from tty-move-canon-specialsStephen Rothwell2008-10-132-3/+3
| | | | | | | | | | | | | | | | | Today's linux-next build (x86_64 allmodconfig) failed like this: /drivers/char/tty_ioctl.c: In function 'change_termios': drivers/isdn/capi/capi.c:1234: error: implicit declaration of function 'n_tty_ioctl' drivers/isdn/gigaset/ser-gigaset.c: In function 'gigaset_tty_ioctl': drivers/isdn/gigaset/ser-gigaset.c:648: error: implicit declaration of function 'n_tty_ioctl' Introduced by commit 686b5e4aea05a80e370dc931b7f4a8d03c80da54 ("tty-move-canon-specials"). I added the following patch (which may not be correct). Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: some ICANON magic is in the wrong placesAlan Cox2008-10-134-44/+55
| | | | | | | | | Move the set up on ldisc change into the ldisc Move the INQ/OUTQ cases into the driver not in shared ioctl code where it gives bogus answers for other ldisc values Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: simplify ktermios allocationAlan Cox2008-10-132-42/+7
| | | | | | | | | | Copy the simplification from the pty unix98 special case to the generic one. This allows us to kill off driver->termios_locked entirely which is nice. We have to whack bits of the cris driver as it meddles in places it shouldn't providing its own arrays that were never used anyway. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* pty: simplify unix98 allocationAlan Cox2008-10-131-11/+7
| | | | | | | We need both termios and termios_locked so allocate them as one Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* pty: Fix allocation failure double freeAlan Cox2008-10-131-2/+0
| | | | | | | | | The updating and moving around of the pty code added a bug where both the helper and caller free the main tty struct (the pty driver must free the o_tty pair itself however). Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* pty: Coding style and polishAlan Cox2008-10-131-42/+44
| | | | | | | We've done the heavy lifting now its time to mop up a bit Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Add an instance parameter devpts interfacesSukadev Bhattiprolu2008-10-132-14/+18
| | | | | | | | | | | | | | | | | Pass-in 'inode' or 'tty' parameter to devpts interfaces. With multiple devpts instances, these parameters will be used in subsequent patches to identify the instance of devpts mounted. The parameters also help simplify devpts implementation. Changelog[v3]: - minor changes due to merge with ttydev updates - rename parameters to emphasize they are ptmx or pts inodes - pass-in tty_struct * to devpts_pty_kill() (this will help cleanup the get_node() call in a subsequent patch) Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Move tty lookup/reopen to callerSukadev Bhattiprolu2008-10-131-15/+16
| | | | | | | | | | | | | | | Move tty_driver_lookup_tty() and tty_reopen() from tty_init_dev() into tty_open() (one of the two callers of tty_init_dev()). These calls are not really required in ptmx_open(), the other caller, since ptmx_open() would be setting up a new tty. Changelog[v2]: - remove the lookup and reopen calls from ptmx_open - merge with recent changes to ttydev tree Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: extract the pty init time special casesAlan Cox2008-10-132-142/+182
| | | | | | | | The majority of the remaining init_dev code is pty special cases. We refactor this code into the driver->install method. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Finish fixing up the init_dev interface to use ERR_PTRAlan Cox2008-10-132-33/+25
| | | | | | | Original suggestion and proposal from Sukadev Bhattiprolu. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: More driver operationsAlan Cox2008-10-132-10/+63
| | | | | | | | | | We have the lookup operation abstracted which is nice for pty cleanup but we really want to abstract the add/remove entries as well so that we can pull the pty code out of the tty core and create a clear defined interface for the tty driver table. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: kref the tty driver objectAlan Cox2008-10-134-54/+69
| | | | | Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Clean up the tty_init_dev changes furtherAlan Cox2008-10-132-41/+72
| | | | | | | | Fix up the naming, style and extract some bits of code into the driver specific code Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Move parts of tty_init_dev into new functionsSukadev Bhattiprolu2008-10-131-52/+87
| | | | | | | | | Move the 'find-tty' and 'fast-track-open' parts of init_dev() to separate functions. Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Remove more special casing and out of place codeAlan Cox2008-10-134-155/+188
| | | | | | | | | Carry on pushing code out of tty_io when it belongs to other drivers. I'm not 100% happy with some of this and it will be worth revisiting some of the exports later when the restructuring work is done. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: shutdown methodAlan Cox2008-10-133-41/+57
| | | | | | | | | | | | | | | | | | | Right now there are various drivers that try to use tty->count to know when they get the final close. Aristeau Rozanski showed while debugging the vt sysfs race that this isn't entirely safe. Instead of driver side tricks to work around this introduce a shutdown which is called when the tty is being destructed. This also means that the shutdown method is tied into the refcounting. Use this to rework the console close/sysfs logic. Remove lots of special case code from the tty core code. The pty code can now have a shutdown() method that replaces the special case hackery in the tree free up paths. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* vt: remove bogus lock droppingAlan Cox2008-10-131-18/+0
| | | | | | | | | For hysterical raisins the vt layer drops and retakes locks in the write method. This is a left over from the days when user/kernel data was passed directly to the tty not pre-buffered. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* pty: If the administrator creates a device for a ptmx slave we should not errorAlan Cox2008-10-131-6/+12
| | | | | | | | | The open path for ptmx slaves is via the ptmx device. Opening them any other way is not allowed. Vegard Nossum found that previously this was not the case and mknod foo c 128 42; cat foo would produce nasty diagnostics Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Redo current tty lockingAlan Cox2008-10-132-14/+5
| | | | | | | | | Currently it is sometimes locked by the tty mutex and sometimes by the sighand lock. The latter is in fact correct and now we can hand back referenced objects we can fix this up without problems around sleeping functions. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: the vhangup syscall is racyAlan Cox2008-10-131-0/+19
| | | | | | | | We now have the infrastructure to sort this out but rather than teaching the syscall tty lock rules we move the hard work into a tty helper Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* mxser: Switch to kref ttyAlan Cox2008-10-131-89/+103
| | | | | Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* stallion: Use krefsAlan Cox2008-10-133-93/+123
| | | | | | | | | Use tty_port_init and krefs in the stallion drivers to protect us from devices going away underneath us. As with the other drives some rearranging is done to pass the tty structure down properly on the user side. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: kref usage for isicom and moxaAlan Cox2008-10-132-53/+69
| | | | | | | | | | Rather than blindly keep taking krefs we reorder the code in a few places to pass the tty down to the right place (which is important as from the user side it is not the case that tty == port->tty in all situations). For the irq and related paths use the krefs to stop the tty being freed under us. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: usb-serial krefsAlan Cox2008-10-1336-208/+310
| | | | | | | | | | | | | Use kref in the USB serial drivers so that we don't free tty structures from under the URB receive handlers as has historically been the case if you were unlucky. This also gives us a framework for general tty drivers to use tty_port objects and refcount. Contains two err->dev_err changes merged together to fix clashes in the -next tree. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Move tty_write_message out of kernel/printkAlan Cox2008-10-131-0/+25
| | | | | | | | This is pure tty code so put it in the tty layer where it can be with the locking relevant material it uses Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Make get_current_tty use a krefAlan Cox2008-10-132-5/+8
| | | | | | | | | | | | | We now return a kref covered tty reference. That ensures the tty structure doesn't go away when you have a return from get_current_tty. This is not enough to protect you from most of the resources being freed behind your back - yet. [Updated to include fixes for SELinux problems found by Andrew Morton and an s390 leak found while debugging the former] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: compare the tty winsizeAlan Cox2008-10-131-1/+1
| | | | | | | | | We always use the real tty one for stuff so the pty one should not be compared. As we propagate window changes to both it doesn't currently matter but will when we tidy up the pty termios logic a bit more Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Termios locking - sort out real_tty confusions and lock readsAlan Cox2008-10-132-21/+39
| | | | | | | | This moves us towards sanity and should mean our termios locking is now complete and comprehensive. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Add termioxAlan Cox2008-10-131-0/+58
| | | | | | | | | | | | | | We need a way to describe the various additional modes and flow control features that random weird hardware shows up and software such as wine wants to emulate as Windows supports them. TCGETX/TCSETX and the termiox ioctl are a SYS5 extension that we might as well adopt. This patches adds the structures and the basic ioctl interfaces when the TCGETX etc defines are added for an architecture. Drivers wishing to use this stuff need to add new methods. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: ipw need reworkingAlan Cox2008-10-131-9/+10
| | | | | | | | | | | | | This came in via another tree and unfortunately is rather broken on the tty side. Comment the apparent locking problems for someone who knows the driver to look at. Fix the termios and other ioctl handling. The driver was calling the wrong methods for what it wanted to do but the right ones existed so its a simple fix up. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: use krefs to protect driver module countsAlan Cox2008-10-131-6/+11
| | | | | | | | | | | | The tty layer keeps driver module counts that are used so the driver knows when it can be unloaded. For obvious reasons we want to tie that to the refcounting properly. At this point the driver side itself isn't refcounted nicely but we can do that later and kref the drivers. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Add a kref countAlan Cox2008-10-131-6/+48
| | | | | | | | Introduce a kref to the tty structure and use it to protect the tty->signal tty references. For now we don't introduce it for anything else. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Split tty_port into its own fileAlan Cox2008-10-133-37/+56
| | | | | | | Not much in it yet but this will grow a lot Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: split the buffering from tty_ioAlan Cox2008-10-133-503/+512
| | | | | | | | The two are basically independent chunks of code so lets split them up for readability and sanity. It also makes the API boundaries much clearer. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: move tioclinux from a special caseAlan Cox2008-10-133-6/+2
| | | | | | | | | Right now we have ifdefs and hooks in the core ioctl handler for TIOCLINUX and then test if its a console. This is brain dead. Instead call the tioclinux helper from the relevant driver ioctl methods. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* serial: allow 8250 to be used on sparcDavid Miller2008-10-133-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | This requires three changes: 1) Remove !SPARC restriction in Kconfig. 2) Move Sparc specific serial drivers before 8250, so that serial console devices don't change names on us, even if 8250 finds devices. 3) Since the Sparc specific serial drivers try to use the same major/minor device namespace as 8250, some coordination is necessary. Use the sunserial_*() layer routines to allocate minor number space within TTY_MAJOR when CONFIG_SPARC. This has no effect on other platforms. Thanks to Josip Rodin for bringing up this issue and testing plus debugging various revisions of this patch. 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>
* 8250: remove a few inlines of dubious valueWill Newton2008-10-131-5/+4
| | | | | | | | | | | Remove some inlines from various functions that are called once, are too big to inline, or are called only from slow path code. This saves around 300 bytes of code for me. Signed-off-by: Will Newton <will.newton@gmail.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>
* serial_8250: pci_enable_device fail is not fully handledAlan Cox2008-10-131-2/+2
| | | | | | | | | | <rmk> talking about leaks - I noticed that the 'check return of pci_enable_dev()' in the 8250 pci resume function finally made it in despite my objections against it (causing stuff in higher levels to leak). Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* ftdi: A few errors are err() that should be debug which causes much spewageAlan Cox2008-10-131-3/+3
| | | | | | | Fixes #10783 Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* usb: fix pl2303 initializationJason Wessel2008-10-131-11/+0
| | | | | | | | | | | | | | | | | This patch removes the private check for the termios_initialized for the pl2303 usb driver. It forced the baud to 9600 on the first call to pl2303_set_termios() Based on the tty changes in the 2.6.27 kernel, the termios passed to the *_set_termios functions is always populated the first time. This means there is no need to privately initialize the settings the first time, and doing so will not allow the use of the kernel parameter "console=ttyUSB0,115200" as an example. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> 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>
* nozomi: Fix close on errorAlan Cox2008-10-131-1/+4
| | | | | | | | | Nozomi assumes the close method isn't called if open errors. The tty layer is different to other drives in this respect however. Pointed out by Denis J Barrow. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* audit: Handle embedded NUL in TTY input auditingMiloslav Trmac2008-10-131-1/+1
| | | | | | | | | | | | | | | Data read from a TTY can contain an embedded NUL byte (e.g. after pressing Ctrl-2, or sent to a PTY). After the previous patch, the data would be logged only up to the first NUL. This patch modifies the AUDIT_TTY record to always use the hexadecimal format, which does not terminate at the first NUL byte. The vast majority of recorded TTY input data will contain either ' ' or '\n', so the hexadecimal format would have been used anyway. Signed-off-by: Miloslav Trmac <mitr@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* ip2: avoid add_timer with pending timerAkinobu Mita2008-10-131-15/+4
| | | | | | | | | | | | | | | add_timer() is not supposed to be called when the timer is pending. ip2 driver attempts to avoid that condition by setting and resetting a flag (TimerOn) in timer function. But there is some gap between add_timer() and setting TimerOn. This patch fix this problem by using mod_timer() and remove TimerOn which has been unnecessary by this change. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* ip2: init/deinit cleanupJiri Slaby2008-10-133-251/+198
| | | | | | | | | | | | | | | | | Cleanup of module_init/exit: - mostly whitespace - remove empty functions - replace c++ comments - remove useless prints (module loaded, unloaded) - mark the calls as __exit and __init - use break; and return; to save some indent levels after it - note resource leakage It's still mess, but now it's readable. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* ip2: fix sparse warningsJiri Slaby2008-10-131-9/+5
| | | | | | Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* ip2: cleanup globalsJiri Slaby2008-10-131-11/+7
| | | | | | | | | | - do not init .bss zeroed data to zero again (by memset or explicit assignment) - use char [] instead of char * for string constants Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Char: merge ip2main and ip2baseJiri Slaby2008-10-133-125/+77
| | | | | | | | | | | | It's pretty useless to have one setup() function separated along with module_init() which only calls a function from ip2main anyway. Get rid of ip2base. Remove also checks of always-true now. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
OpenPOWER on IntegriCloud