14 Oct, 2008

40 commits

  • Merges oprofile, timers/hpet, x86/traps, x86/time, and x86/core misc items.

    * 'x86-core-v4-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (132 commits)
    x86: change early_ioremap to use slots instead of nesting
    x86: adjust dependencies for CONFIG_X86_CMOV
    dumpstack: x86: various small unification steps, fix
    x86: remove additional_cpus
    x86: remove additional_cpus configurability
    x86: improve UP kernel when CPU-hotplug and SMP is enabled
    dumpstack: x86: various small unification steps
    dumpstack: i386: make kstack= an early boot-param and add oops=panic
    dumpstack: x86: use log_lvl and unify trace formatting
    dumptrace: x86: consistently include loglevel, print stack switch
    dumpstack: x86: add "end" parameter to valid_stack_ptr and print_context_stack
    dumpstack: x86: make printk_address equal
    dumpstack: x86: move die_nmi to dumpstack_32.c
    traps: x86: finalize unification of traps.c
    traps: x86: make traps_32.c and traps_64.c equal
    traps: x86: various noop-changes preparing for unification of traps_xx.c
    traps: x86_64: use task_pid_nr(tsk) instead of tsk->pid in do_general_protection
    traps: i386: expand clear_mem_error and remove from mach_traps.h
    traps: x86_64: make io_check_error equal to the one on i386
    traps: i386: use preempt_conditional_sti/cli in do_int3
    ...

    Linus Torvalds
     
  • Original idea for this from a patch by Rodolfo Giometti which merges various
    bits of PPS support

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Drop the kernel lock further and also correct cases where we set rc to an
    error code, and then return 0

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • get_current_tty now does internal locking and returns a referenced object,
    thus our use of tty_mutex here can go away.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • drivers/char/tty_io.c:1413:17: warning: symbol 'buf' shadows an earlier one
    drivers/char/tty_io.c:1379:20: originally declared here

    Signed-off-by: Jason Wessel
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Jason Wessel
     
  • 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
    Signed-off-by: Andrew Morton
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    David S. Miller
     
  • Closes bug #11408 by checking the card index range for command 0
    Fixes the ioctl to return ENOTTY which is correct for unknown ioctls

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Remove/fix some bogus NULL checks, comment some locking etc

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Stephen's fixes reminded me that gigaset is still rather broken so fix it up
    a bit

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Stephen Rothwell
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • We need both termios and termios_locked so allocate them as one

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • We've done the heavy lifting now its time to mop up a bit

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Original suggestion and proposal from Sukadev Bhattiprolu.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Fix up the naming, style and extract some bits of code into the driver
    specific code

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Move the 'find-tty' and 'fast-track-open' parts of init_dev() to
    separate functions.

    Signed-off-by: Sukadev Bhattiprolu
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Sukadev Bhattiprolu
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • This moves us towards sanity and should mean our termios locking is now
    complete and comprehensive.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox
     
  • 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
    Signed-off-by: Linus Torvalds

    Alan Cox