12 Dec, 2009

40 commits

  • At first this looks a fairly trivial conversion but we can't quite push
    everything into the right format yet. The open side is easy but care is needed
    over the setserial methods. Fix up the locking now that we've adopted the
    port->mutex locking rule for the initialization.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Split this into two flags - INIT meaning the board is set up and ACTIVE
    meaning the board has ports open. Remove the broken HUPCL casing and push
    the counts somewhere sensible.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Trivial conversion in this case so might as well do it while testing the
    port_open design is right

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Users of tty port need a way to refcount ports when hotplugging is
    involved.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Slice/dice/repeat as with the stallion driver this is just code shuffling
    and removal

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • The driver is already structured this way so just slice and dice

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Some devices want to set IO_ERROR in their activate methods so that you can
    be handed a 'dead' port for operations like setserial. Thus we need to
    clear the flag before activate so that activate can choose to set the flag
    and still return 0.

    This is fine as the file handle/tty are not accessible to the user yet.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • To propogate tty_port_open/close to a few other devices we need to start
    handling the IO_ERROR flag on the tty. We can do this pretty trivially.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • We want to be able to do this without regard for the activate/own open
    method being used which causes a problem using port->mutex. Add another
    mutex for now. Once everything uses port_open to do buffer allocs we can
    kill it back off

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • The new dtr_rts function didn't take the port->func lock as it should
    so add use of the lock there.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Add the POSIX block for carrier

    Linux TIOCMIWAIT functionality is still lacking from the driver.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Running the current code through checkpatch shows a few bits of noise
    mostly but not entirely from before the changes.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Switching between two non standard baud rates fails because of the cflag
    test. Do as we did elsewhere and just kill the "optimisation".

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Gets us proper tty semantics, removes some code and fixes up a few corner
    case races (hangup during open etc)

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • When we move to the tty_port logic the port mutex will protect open v close
    v hangup. Move to this first in the existing open code so we have a bisection
    point.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • The tty can go away underneath us, so we must refcount it. Do the naïve
    implementation initially. We will worry about startup shortly.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Now... testing reveals that the very first patch "sdio_uart: use
    tty_port" causes a segmentation fault in sdio_uart_open():

    Unable to handle kernel NULL pointer dereference at virtual address 00000084
    pgd = dfb44000 [00000084] *pgd=1fb99031, *pte=00000000, *ppte=00000000
    Internal error: Oops: 17 [#1] PREEMPT
    last sysfs file:
    /sys/devices/platform/mvsdio/mmc_host/mmc0/mmc0:f111/uevent
    Modules linked in:
    CPU: 0 Not tainted (2.6.32-rc5-next-20091102-00001-gb36eae9 #10)
    PC is at sdio_uart_open+0x204/0x2cc
    [...]

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Nicolas Pitre
     
  • Add a tty_port object to the sdio uart. For the moment just begin using the
    tty field of the port, as this is the critical one to clean up.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Move the HUCPL handling from the end of close_port_start to the beginning
    of close_port_end. What this actually does is change the ordering from

    port shutdown
    port->dtr_rts

    to

    port->dtr_rts
    port shutdown

    Some hardware drops the physical connection on shutdown so we must perform
    the port operations before the shutdown.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • devpts_get_tty() assumes that the inode passed in is associated with a valid
    pty. But if the only reference to the pty is via a bind-mount, the inode
    passed to devpts_get_tty() while valid, would refer to a pty that no longer
    exists.

    With a lot of debug effort, Grzegorz Nosek developed a small program (see
    below) to reproduce a crash on recent kernels. This crash is a regression
    introduced by the commit:

    commit 527b3e4773628b30d03323a2cb5fb0d84441990f
    Author: Sukadev Bhattiprolu
    Date: Mon Oct 13 10:43:08 2008 +0100

    To fix, ensure that the dentry associated with the inode has not yet been
    deleted/unhashed by devpts_pty_kill().

    See also:
    https://lists.linux-foundation.org/pipermail/containers/2009-July/019273.html

    tty-bug.c:

    #define _GNU_SOURCE
    #include
    #include
    #include
    #include
    #include
    #include
    #include

    #include

    void dummy(int sig)
    {
    }

    static int child(void *unused)
    {
    int fd;

    signal(SIGINT, dummy); signal(SIGHUP, dummy);
    pause(); /* cheesy synchronisation to wait for /dev/pts/0 to appear */

    mount("/dev/pts/0", "/dev/console", NULL, MS_BIND, NULL);
    sleep(2);

    fd = open("/dev/console", O_RDWR);
    dup(0); dup(0);
    write(1, "Hello world!\n", sizeof("Hello world!\n")-1);
    return 0;
    }

    int main(void)
    {
    pid_t pid;
    char *stack;

    stack = malloc(16384);
    pid = clone(child, stack+16384, CLONE_NEWNS|SIGCHLD, NULL);

    open("/dev/ptmx", O_RDWR|O_NOCTTY|O_NONBLOCK);

    unlockpt(fd); grantpt(fd);

    sleep(2);
    kill(pid, SIGHUP);
    sleep(1);
    return 0; /* exit before child opens /dev/console */
    }

    Reported-by: Grzegorz Nosek
    Signed-off-by: Sukadev Bhattiprolu
    Tested-by: Serge Hallyn
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Sukadev Bhattiprolu
     
  • Do not read IIR in serial8250_start_tx when UART_BUG_TXEN

    Reading the IIR clears some oustanding interrupts so it is not safe.
    Instead, simply transmit immediately if the buffer is empty without
    regard to IIR.

    Signed-off-by: Ian Jackson
    Reviewed-by: Markus Armbruster
    Reviewed-by: Jiri Kosina
    Cc: Alan Cox
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Ian Jackson
     
  • A small addition to the ldisc method descriptions.

    Signed-off-by: Tilman Schmidt
    Signed-off-by: Randy Dunlap
    Acked-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Tilman Schmidt
     
  • Intel(R) PXA27x Processor Family Specification Update (Nov 2005)
    says:

    E75. UART: Baud rate may not be programmed correctly on
    back-to-back writes.

    Problem:
    When programming the Divisor Latch registers, Low and High (DLL and
    DLH), with back-to-back writes, the second register write may not
    take effect. The result is an incorrect baud rate.

    Workaround:
    After programming the first Divisor Latch register, read and verify
    it before programming the second Divisor Latch register.

    This was hit when changing the baud rate from 115200 to 9600 while
    receiving characters at 9600 Bd.

    And fixed indention of some comments nearby.

    Signed-off-by: Uwe Kleine-König
    Acked-by: Wolfram Sang
    Acked-by: Marc Kleine-Budde
    Cc: Eric Miao
    Cc: Alan Cox
    Cc: Mike Rapoport
    Signed-off-by: Greg Kroah-Hartman

    Uwe Kleine-König
     
  • Signed-off-by: André Goddard Rosa
    Signed-off-by: Greg Kroah-Hartman

    André Goddard Rosa
     
  • Signed-off-by: André Goddard Rosa
    Signed-off-by: Greg Kroah-Hartman

    André Goddard Rosa
     
  • 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
    Signed-off-by: Greg Kroah-Hartman

    André Goddard Rosa
     
  • Opticon now takes the right mutex to check the port status but the status
    check is done wrongly for the modern serial code, so fix it.

    Signed-off-by: Alan Cox
    Cc: Alan Stern
    Cc: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • The tty port has a port mutex used for all the port related locking so we
    don't need the one in the USB serial layer any more.

    Signed-off-by: Alan Cox
    Cc: Alan Stern
    Cc: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • As Alan Stern pointed out - now we have tty_port_open the shutdown method
    and locking allow us to whack the other bits into the full helper methods
    and provide a shutdown op which the tty port code will synchronize with
    setup for us.

    Signed-off-by: Alan Cox
    Cc: Alan Stern
    Cc: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Mind the hoover wire...

    Signed-off-by: Alan Cox
    Cc: Alan Stern
    Cc: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • For the moment this just moves the USB logic over and fixes the 'what if
    we open and hangup at the same time' race noticed by Oliver Neukum.

    Signed-off-by: Alan Cox
    Cc: Alan Stern
    Cc: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Fairly trivial as the BKL push down into the methods has already been done.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • The ESP driver has been marked broken for years. It's an old ISA device
    that clearly nobody cares about any more. Remove it

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • Signed-off-by: Alexey Dobriyan
    Signed-off-by: Greg Kroah-Hartman

    Alexey Dobriyan
     
  • Adding EEH handlers for the serial jsm driver. This patch adds
    the PCI error handlers and also register them to be called when
    a error is detected.

    Signed-off-by: Breno Leitao
    Acked-by: Scott Kilau
    Signed-off-by: Greg Kroah-Hartman

    Breno Leitao
     
  • Currently there is a field in the jsm_board structure to cont
    the number of interrupt that the card recevived, but it's not
    working properly when the IRQ line is shared, and also nowhere
    else this field is used. So, This patch is removing it.

    Signed-off-by: Breno Leitão
    Cc: Scott Kilau
    Signed-off-by: Greg Kroah-Hartman

    Breno Leitão
     
  • Currently the jsm_channel->ch_wopen field is defined and never
    used. So, this patch removes it.

    Signed-off-by: Breno Leitão
    Cc: Scott Kilau
    Signed-off-by: Greg Kroah-Hartman

    Breno Leitão
     
  • Currently the field jsm_channel->ch_cpstime is defined but never
    used, so this patch removes it.

    Signed-off-by: Breno Leitão
    Cc: Scott Kilau
    Signed-off-by: Greg Kroah-Hartman

    Breno Leitão