13 Jan, 2012

1 commit


04 Jun, 2011

1 commit

  • This reverts commit b1c43f82c5aa265442f82dba31ce985ebb7aa71c.

    It was broken in so many ways, and results in random odd pty issues.

    It re-introduced the buggy schedule_work() in flush_to_ldisc() that can
    cause endless work-loops (see commit a5660b41af6a: "tty: fix endless
    work loop when the buffer fills up").

    It also used an "unsigned int" return value fo the ->receive_buf()
    function, but then made multiple functions return a negative error code,
    and didn't actually check for the error in the caller.

    And it didn't actually work at all. BenH bisected down odd tty behavior
    to it:
    "It looks like the patch is causing some major malfunctions of the X
    server for me, possibly related to PTYs. For example, cat'ing a
    large file in a gnome terminal hangs the kernel for -minutes- in a
    loop of what looks like flush_to_ldisc/workqueue code, (some ftrace
    data in the quoted bits further down).

    ...

    Some more data: It -looks- like what happens is that the
    flush_to_ldisc work queue entry constantly re-queues itself (because
    the PTY is full ?) and the workqueue thread will basically loop
    forver calling it without ever scheduling, thus starving the consumer
    process that could have emptied the PTY."

    which is pretty much exactly the problem we fixed in a5660b41af6a.

    Milton Miller pointed out the 'unsigned int' issue.

    Reported-by: Benjamin Herrenschmidt
    Reported-by: Milton Miller
    Cc: Stefan Bigler
    Cc: Toby Gray
    Cc: Felipe Balbi
    Cc: Greg Kroah-Hartman
    Cc: Alan Cox
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

24 May, 2011

1 commit

  • * 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (48 commits)
    serial: 8250_pci: add support for Cronyx Omega PCI multiserial board.
    tty/serial: Fix break handling for PORT_TEGRA
    tty/serial: Add explicit PORT_TEGRA type
    n_tracerouter and n_tracesink ldisc additions.
    Intel PTI implementaiton of MIPI 1149.7.
    Kernel documentation for the PTI feature.
    export kernel call get_task_comm().
    tty: Remove to support serial for S5P6442
    pch_phub: Support new device ML7223
    8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter
    ASoC: Update cx20442 for TTY API change
    pch_uart: Support new device ML7223 IOH
    parport: Use request_muxed_region for IT87 probe and lock
    tty/serial: add support for Xilinx PS UART
    n_gsm: Use print_hex_dump_bytes
    drivers/tty/moxa.c: Put correct tty value
    TTY: tty_io, annotate locking functions
    TTY: serial_core, remove superfluous set_task_state
    TTY: serial_core, remove invalid test
    Char: moxa, fix locking in moxa_write
    ...

    Fix up trivial conflicts in drivers/bluetooth/hci_ldisc.c and
    drivers/tty/serial/Makefile.

    I did the hci_ldisc thing as an evil merge, cleaning things up.

    Linus Torvalds
     

23 Apr, 2011

1 commit

  • it makes it simpler to keep track of the amount of
    bytes received and simplifies how flush_to_ldisc counts
    the remaining bytes. It also fixes a bug of lost bytes
    on n_tty when flushing too many bytes via the USB
    serial gadget driver.

    Tested-by: Stefan Bigler
    Tested-by: Toby Gray
    Signed-off-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Felipe Balbi
     

13 Apr, 2011

1 commit


17 Feb, 2011

1 commit


08 Dec, 2010

1 commit


24 Oct, 2010

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1699 commits)
    bnx2/bnx2x: Unsupported Ethtool operations should return -EINVAL.
    vlan: Calling vlan_hwaccel_do_receive() is always valid.
    tproxy: use the interface primary IP address as a default value for --on-ip
    tproxy: added IPv6 support to the socket match
    cxgb3: function namespace cleanup
    tproxy: added IPv6 support to the TPROXY target
    tproxy: added IPv6 socket lookup function to nf_tproxy_core
    be2net: Changes to use only priority codes allowed by f/w
    tproxy: allow non-local binds of IPv6 sockets if IP_TRANSPARENT is enabled
    tproxy: added tproxy sockopt interface in the IPV6 layer
    tproxy: added udp6_lib_lookup function
    tproxy: added const specifiers to udp lookup functions
    tproxy: split off ipv6 defragmentation to a separate module
    l2tp: small cleanup
    nf_nat: restrict ICMP translation for embedded header
    can: mcp251x: fix generation of error frames
    can: mcp251x: fix endless loop in interrupt handler if CANINTF_MERRF is set
    can-raw: add msg_flags to distinguish local traffic
    9p: client code cleanup
    rds: make local functions/variables static
    ...

    Fix up conflicts in net/core/dev.c, drivers/net/pcmcia/smc91c92_cs.c and
    drivers/net/wireless/ath/ath9k/debug.c as per David

    Linus Torvalds
     

22 Oct, 2010

1 commit

  • Fortunately this is only exploitable on very unusual hardware.

    [Reported a while ago but nothing happened so just fixing it]

    Signed-off-by: Alan Cox
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Alan Cox
     

12 Oct, 2010

1 commit


22 Jul, 2010

3 commits

  • Implements Atheros AR300x serial HCI protocol.

    This protocol extends H4 serial protocol to implement enhanced power
    management features supported by Atheros AR300x serial Bluetooth chipsets.

    Signed-off-by: Suraj Sumangala
    Signed-off-by: Marcel Holtmann

    Suraj Sumangala
     
  • This patch introduces two new ioctls: HCIUARTSETFLAGS and
    HCIUARTGETFLAGS. The only flag available for now is HCI_UART_RAW_DEVICE
    which allows to initialize a UART device into RAW mode from userspace.
    This is particularly useful for experimenting with Bluetooth controllers
    that don't yet have proper support in BlueZ.

    Signed-off-by: Johan Hedberg
    Signed-off-by: Marcel Holtmann

    Johan Hedberg
     
  • The patch below fixes a warning message when using gcc 4.6.0.

    CC [M] drivers/bluetooth/hci_ldisc.o
    drivers/bluetooth/hci_ldisc.c: In function 'hci_uart_send_frame':
    drivers/bluetooth/hci_ldisc.c:213:21: warning: variable 'tty' set but not used

    Signed-off-by: Justin P. Mattock
    Reviewed-By: Gustavo F. Padovan
    Signed-off-by: Marcel Holtmann

    Justin P. Mattock
     

27 Feb, 2010

1 commit


04 Dec, 2009

1 commit

  • That is "success", "unknown", "through", "performance", "[re|un]mapping"
    , "access", "default", "reasonable", "[con]currently", "temperature"
    , "channel", "[un]used", "application", "example","hierarchy", "therefore"
    , "[over|under]flow", "contiguous", "threshold", "enough" and others.

    Signed-off-by: André Goddard Rosa
    Signed-off-by: Jiri Kosina

    André Goddard Rosa
     

11 Jun, 2009

2 commits

  • Bluetooth shouldn't be doing this as most drivers don't support the flag,
    furthermore it shouldn't be needed with newer buffering. This becomes rather
    more visible as the locking fixes make the abuse of low_latency visible as
    spew on the users console/dmesg.

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

    Alan Cox
     
  • There are several pretty much unfixable races in the old ldisc code, especially
    with respect to pty behaviour and also to hangup. It's easier to rewrite the
    code than simply try and patch it up.

    This patch
    - splits the ldisc from the tty (so we will be able to refcount it more cleanly
    later)
    - introduces a mutex lock for ldisc changing on an active device
    - fixes the complete mess that hangup caused
    - implements hopefully correct setldisc/close/hangup locking

    There are still some problems around pty pairs that have always been there but
    at least it is now possible to understand the code and fix further problems.

    This fixes the following known bugs
    - hang up can leak ldisc references
    - hang up may not call open/close on ldisc in a matched way
    - pty/tty pairs can deadlock during an ldisc change
    - reading the ldisc proc files can cause every ldisc to be loaded

    and probably a few other of the mysterious ldisc race reports.

    I'm sure it also adds the odd new one.

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

    Alan Cox
     

30 Nov, 2008

2 commits

  • With the introduction of CONFIG_DYNAMIC_PRINTK_DEBUG it is possible to
    allow debugging without having to recompile the kernel. This patch turns
    all BT_DBG() calls into pr_debug() to support dynamic debug messages.

    As a side effect all CONFIG_BT_*_DEBUG statements are now removed and
    some broken debug entries have been fixed.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     
  • The Bluetooth subsystem was not using the HCI Reset command when doing
    device initialization. The Bluetooth 1.0b specification was ambiguous
    on how the device firmware was suppose to handle it. Almost every device
    was triggering a transport reset at the same time. In case of USB this
    ended up in disconnects from the bus.

    All modern Bluetooth dongles handle this perfectly fine and a lot of
    them actually require that HCI Reset is sent. If not then they are
    either stuck in their HID Proxy mode or their internal structures for
    inquiry and paging are not correctly setup.

    To handle old and new devices smoothly the Bluetooth subsystem contains
    a quirk to force the HCI Reset on initialization. However maintaining
    such a quirk becomes more and more complicated. This patch turns the
    logic around and lets the old devices disable the HCI Reset command.

    The only device where the HCI_QUIRK_NO_RESET is still needed are the
    original Digianswer devices and dongles with an early CSR firmware.

    CSR reported that they fixed this for version 12 firmware. The last
    official release of version 11 firmware is build ID 115. The first
    version 12 candidate was build ID 117.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

14 Oct, 2008

1 commit


18 Aug, 2008

1 commit

  • The Bluetooth entries for the MAINTAINERS file are a little bit too
    much. Consolidate them into two entries. One for Bluetooth drivers and
    another one for the Bluetooth subsystem.

    Also the MODULE_AUTHOR should indicate the current maintainer of the
    module and actually not the original author. Fix all Bluetooth modules
    to provide current maintainer information.

    Signed-off-by: Marcel Holtmann

    Marcel Holtmann
     

21 Jul, 2008

1 commit

  • Move the line disciplines towards a conventional ->ops arrangement. For
    the moment the actual 'tty_ldisc' struct in the tty is kept as part of
    the tty struct but this can then be changed if it turns out that when it
    all settles down we want to refcount ldiscs separately to the tty.

    Pull the ldisc code out of /proc and put it with our ldisc code.

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

    Alan Cox
     

30 Apr, 2008

2 commits

  • Something Arjan suggested which allows us to clean up the code nicely

    Signed-off-by: Alan Cox
    Cc: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

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

    Alan Cox
     

13 Feb, 2008

1 commit

  • Arjan:

    With the help of kerneloops.org I've spotted a nice little interaction
    between the TTY layer and the bluetooth code, however the tty layer is not
    something I'm all too familiar with so I rather ask than brute-force fix the
    code incorrectly.

    The raw details are at:
    http://www.kerneloops.org/search.php?search=uart_flush_buffer

    What happens is that, on closing the bluetooth tty, the tty layer goes
    into the release_dev() function, which first does a bunch of stuff, then
    sets the file->private_data to NULL, does some more stuff and then calls the
    ldisc close function. Which in this case, is hci_uart_tty_close().

    Now, hci_uart_tty_close() calls hci_uart_close() which clears some
    internal bit, and then calls hci_uart_flush()... which calls back to the
    tty layers' uart_flush_buffer() function. (in drivers/bluetooth/hci_tty.c
    around line 194) Which then WARN_ON()'s because that's not allowed/supposed
    to be called this late in the shutdown of the port....

    Should the bluetooth driver even call this flush function at all??

    David:

    This seems to be what happens: Hci_uart_close() flushes using
    hci_uart_flush(). Subsequently, in hci_dev_do_close(), (one step in
    hci_unregister_dev()), hci_uart_flush() is called again. The comment in
    uart_flush_buffer(), relating to the WARN_ON(), indicates you can't flush
    after the port is closed; which sounds reasonable. I think hci_uart_close()
    should set hdev->flush to NULL before returning. Hci_dev_do_close() does
    check for this. The code path is rather involved and I'm not entirely clear
    of all steps, but I think that's what should be done.

    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    David Newall
     

22 Oct, 2007

1 commit


11 May, 2007

3 commits


15 Feb, 2007

1 commit

  • After Al Viro (finally) succeeded in removing the sched.h #include in module.h
    recently, it makes sense again to remove other superfluous sched.h includes.
    There are quite a lot of files which include it but don't actually need
    anything defined in there. Presumably these includes were once needed for
    macros that used to live in sched.h, but moved to other header files in the
    course of cleaning it up.

    To ease the pain, this time I did not fiddle with any header files and only
    removed #includes from .c-files, which tend to cause less trouble.

    Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
    arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
    allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
    configs in arch/arm/configs on arm. I also checked that no new warnings were
    introduced by the patch (actually, some warnings are removed that were emitted
    by unnecessarily included header files).

    Signed-off-by: Tim Schmielau
    Acked-by: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tim Schmielau
     

29 Sep, 2006

1 commit


13 Jul, 2006

1 commit


01 Jul, 2006

1 commit


11 Jan, 2006

1 commit

  • The API and code have been through various bits of initial review by
    serial driver people but they definitely need to live somewhere for a
    while so the unconverted drivers can get knocked into shape, existing
    drivers that have been updated can be better tuned and bugs whacked out.

    This replaces the tty flip buffers with kmalloc objects in rings. In the
    normal situation for an IRQ driven serial port at typical speeds the
    behaviour is pretty much the same, two buffers end up allocated and the
    kernel cycles between them as before.

    When there are delays or at high speed we now behave far better as the
    buffer pool can grow a bit rather than lose characters. This also means
    that we can operate at higher speeds reliably.

    For drivers that receive characters in blocks (DMA based, USB and
    especially virtualisation) the layer allows a lot of driver specific
    code that works around the tty layer with private secondary queues to be
    removed. The IBM folks need this sort of layer, the smart serial port
    people do, the virtualisers do (because a virtualised tty typically
    operates at infinite speed rather than emulating 9600 baud).

    Finally many drivers had invalid and unsafe attempts to avoid buffer
    overflows by directly invoking tty methods extracted out of the innards
    of work queue structs. These are no longer needed and all go away. That
    fixes various random hangs with serial ports on overflow.

    The other change in here is to optimise the receive_room path that is
    used by some callers. It turns out that only one ldisc uses receive room
    except asa constant and it updates it far far less than the value is
    read. We thus make it a variable not a function call.

    I expect the code to contain bugs due to the size alone but I'll be
    watching and squashing them and feeding out new patches as it goes.

    Because the buffers now dynamically expand you should only run out of
    buffering when the kernel runs out of memory for real. That means a lot of
    the horrible hacks high performance drivers used to do just aren't needed any
    more.

    Description:

    tty_insert_flip_char is an old API and continues to work as before, as does
    tty_flip_buffer_push() [this is why many drivers dont need modification]. It
    does now also return the number of chars inserted

    There are also

    tty_buffer_request_room(tty, len)

    which asks for a buffer block of the length requested and returns the space
    found. This improves efficiency with hardware that knows how much to
    transfer.

    and tty_insert_flip_string_flags(tty, str, flags, len)

    to insert a string of characters and flags

    For a smart interface the usual code is

    len = tty_request_buffer_room(tty, amount_hardware_says);
    tty_insert_flip_string(tty, buffer_from_card, len);

    More description!

    At the moment tty buffers are attached directly to the tty. This is causing a
    lot of the problems related to tty layer locking, also problems at high speed
    and also with bursty data (such as occurs in virtualised environments)

    I'm working on ripping out the flip buffers and replacing them with a pool of
    dynamically allocated buffers. This allows both for old style "byte I/O"
    devices and also helps virtualisation and smart devices where large blocks of
    data suddenely materialise and need storing.

    So far so good. Lots of drivers reference tty->flip.*. Several of them also
    call directly and unsafely into function pointers it provides. This will all
    break. Most drivers can use tty_insert_flip_char which can be kept as an API
    but others need more.

    At the moment I've added the following interfaces, if people think more will
    be needed now is a good time to say

    int tty_buffer_request_room(tty, size)

    Try and ensure at least size bytes are available, returns actual room (may be
    zero). At the moment it just uses the flipbuf space but that will change.
    Repeated calls without characters being added are not cumulative. (ie if you
    call it with 1, 1, 1, and then 4 you'll have four characters of space. The
    other functions will also try and grow buffers in future but this will be a
    more efficient way when you know block sizes.

    int tty_insert_flip_char(tty, ch, flag)

    As before insert a character if there is room. Now returns 1 for success, 0
    for failure.

    int tty_insert_flip_string(tty, str, len)

    Insert a block of non error characters. Returns the number inserted.

    int tty_prepare_flip_string(tty, strptr, len)

    Adjust the buffer to allow len characters to be added. Returns a buffer
    pointer in strptr and the length available. This allows for hardware that
    needs to use functions like insl or mencpy_fromio.

    Signed-off-by: Alan Cox
    Cc: Paul Fulghum
    Signed-off-by: Hirokazu Takata
    Signed-off-by: Serge Hallyn
    Signed-off-by: Jeff Dike
    Signed-off-by: John Hawkes
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Cox
     

07 Nov, 2005

1 commit


29 Oct, 2005

2 commits


30 Aug, 2005

1 commit


06 Aug, 2005

1 commit


24 Jun, 2005

1 commit