procfs: add num_to_str() to speed up /proc/stat

== stat_check.py
num = 0
with open("/proc/stat") as f:
        while num < 1000 :
                data = f.read()
                f.seek(0, 0)
                num = num + 1
==

perf shows

    20.39%  stat_check.py  [kernel.kallsyms]    [k] format_decode
    13.41%  stat_check.py  [kernel.kallsyms]    [k] number
    12.61%  stat_check.py  [kernel.kallsyms]    [k] vsnprintf
    10.85%  stat_check.py  [kernel.kallsyms]    [k] memcpy
     4.85%  stat_check.py  [kernel.kallsyms]    [k] radix_tree_lookup
     4.43%  stat_check.py  [kernel.kallsyms]    [k] seq_printf

This patch removes most of calls to vsnprintf() by adding num_to_str()
and seq_print_decimal_ull(), which prints decimal numbers without rich
functions provided by printf().

On my 8cpu box.
== Before patch ==
[root@bluextal test]# time ./stat_check.py

real    0m0.150s
user    0m0.026s
sys     0m0.121s

== After patch ==
[root@bluextal test]# time ./stat_check.py

real    0m0.055s
user    0m0.022s
sys     0m0.030s

[akpm@linux-foundation.org: remove incorrect comment, use less statck in num_to_str(), move comment from .h to .c, simplify seq_put_decimal_ull()]
[andrea@betterlinux.com: avoid breaking the ABI in /proc/stat]
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrea Righi <andrea@betterlinux.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Turner <pjt@google.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>
backported from Linux 3.4-rc4 to Linux 3.0.x by faux123
defconfig: Enable PVR Gov
arm: Allow CPU-supported unaligned accesses

This change reconfigures the CPU to allow CPU-supported unaligned
accesses, which are generally faster than software-only fixups,
resulting in fewer alignment exceptions.

Signed-off-by: Brent DeGraaf <bdegraaf@codeaurora.org>
modified by faux123 for omap
defconfig: Enable Allow CPU Alignment
defconfig: Enable uaccess with memcpy
ARM/mm: drop GFP_COMP for dma_alloc_coherent

From: Sumit Bhattacharya <sumitb@nvidia.com>

dma_alloc_coherent wants to split pages after allocation in order to
reduce the memory footprint. This does not work well with GFP_COMP
pages, so drop this flag before allocation.

This patch is ported from arch/avr32
(commit 3611553ef985ef7c5863c8a94641738addd04cff).

Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
proc: enhance time-average nr_running stats

Add time-average nr_running to loadavg printout

Bug 958978

Change-Id: I5c6904efb52a86f4964eb66c1576fc91f60f5b1d
Signed-off-by: Alex Frid <afrid@nvidia.com>
(cherry picked from commit 86f3642cc44a69d1e4798719bd9182cd6923f526)
Reviewed-on: http://git-master/r/111636
Reviewed-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Tested-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
vsprintf: optimize decimal conversion (again)

    This patch is based upon an original from Michal Nazarewicz.

    Previous code was using optimizations which were developed
    to work well even on narrow-word CPUs (by today's standards).
    But Linux runs only on 32-bit and wider CPUs. We can use that.

    First: using 32x32->64 multiply and trivial 32-bit shift,
    we can correctly divide by 10 much larger numbers, and thus
    we can print groups of 9 digits instead of groups of 5 digits.

    Next: there are two algorithms to print larger numbers.
    One is generic: divide by 1000000000 and repeatedly print
    groups of (up to) 9 digits. It's conceptually simple,
    but requires an (unsigned long long) / 1000000000 division.
    Second algorithm splits 64-bit unsigned long long into 16-bit chunks,
    manipulates them cleverly and generates groups of 4 decimal digits.
    It so happens that it does NOT require long long division.

    If long is > 32 bits, division of 64-bit values is relatively easy,
    and we will use the first algorithm.
    If long long is > 64 bits (strange architecture with VERY large long long),
    second algorithm can't be used, and we again use the first one.
    Else (if long is 32 bits and long long is 64 bits) we use second one.

    And third: there is a simple optimization which takes fast path
    not only for zero as was done before, but for all one-digit numbers.

    In all tested cases new code is faster than old one, in many cases by 30%,
    in few cases by more than 50% (for example, on x86-32, conversion of 12345678).
    Code growth is ~0 in 32-bit case and ~130 bytes in 64-bit case.

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
    Cc: Douglas W Jones <jones@cs.uiowa.edu>a
    backported from Linux 3.4+ to Linux 3.0 by faux123
sched: don't call task_group() many times in set_task_rq()

It improves perfomance, especially if autogroup enabled.

The size of set_task_rq() was 0x180 and now it is 0xa0.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
kernel/timer: Optimise apply_slack() for size and speed.

To apply proper slack, the original algorithm used to prepare a mask and
then apply the mask to obtain the appropriately rounded-off absolute
time the timer expires.

This patch modifies the masking logic to a bit-shift logic, therby
reducing the complexity and number of operations. Thus obtaining a minor
speed-up.

Signed-off-by: Chinmay V S <chinmay.v.s@pathpartnertech.com>
ARM: smpboot: Enable interrupts after marking CPU online/active

With the note that we really should clean up the cpu hotplug code,
there's far too much code duplication in the arch/ implementations. The
below patch looks like it might actually work.

Thomas, others, please have a very close look because I might have
thought too hard and missed the obvious :-)

---
Subject: hotplug, sched: cpu_active vs __cpu_up
Stepan found:

CPU0		CPUn

_cpu_up()
  __cpu_up()

		boostrap()
		  notify_cpu_starting()
		  set_cpu_online()
		  while (!cpu_active())
		    cpu_relax()

<PREEMPT-out>

smp_call_function(.wait=1)
  /* we find cpu_online() is true */
  arch_send_call_function_ipi_mask()
  /* wait-forever-more */
<PREEMPT-in>
		  local_irq_enable()

  cpu_notify(CPU_ONLINE)
    sched_cpu_active()
      set_cpu_active()

Now the purpose of cpu_active is mostly with bringing down a cpu, where
we mark it !active to avoid the load-balancer from moving tasks to it
while we tear down the cpu. This is required because we only update the
sched_domain tree after we brought the cpu-down. And this is needed so
that some tasks can still run while we bring it down, we just don't want
new tasks to appear.

On cpu-up however the sched_domain tree doesn't yet include the new cpu,
so its invisible to the load-balancer, regardless of the active state.
So instead of setting the active state after we boot the new cpu (and
consequently having to wait for it before enabling interrupts) set the
cpu active before we set it online and avoid the whole mess.

Reported-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
backported to linux 3.0.x by faux123
Logger from 3.8
Punch of bluetooth fixes

Squashed commit of the following:

commit df3d1008856879ac6bb1bee2cb2e8454311d506f
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Oct 20 17:21:34 2011 -0200

    Bluetooth: Fix hidp_get_connection()

    This functions needs crtl_sock and intr_sock to be set first.

    Change-Id: I5b62a2b6cd469857ce12f3184a62bc72723664db
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    Signed-off-by: Sumit Bajpai <sbajpai@codeaurora.org>

commit 8c3f453d74a2c1fdada4369b593e4cdfd17dd052
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Sat Oct 15 18:03:15 2011 -0300

    Bluetooth: Fix missing cmd_status in mgmt

    set_service_cache() was missing a cmd_status for the error case.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit e5b82e58922749e79b84b85cfc6845cbfd1908ed)

commit 2a5069774fae5c224c186f0525d9ceb3917edc91
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Fri Oct 14 19:56:21 2011 -0300

    Bluetooth: Fix mgmt interaction with userspace

    Partially revert 34918cd7. struct mgmt_key_info needs to have the same
    size as its version exported to userspace.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit c636ef58865920c8ba9f877c1040bc73eb61e5cb)

commit 25088d3b10cd5b2ee0ef96fe7bcb0ea66fd87baf
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Fri Oct 14 19:32:56 2011 -0300

    Bluetooth: Use list_for_each_entry() in mgmt

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 12dc0743015fee37f4090f0937c898294cd2d133)

commit e8ab3367656ee5a52376c331c0faad35686482aa
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Fri Oct 14 19:23:27 2011 -0300

    Bluetooth: Add missing cmd_status() in mgmt

    Improve error handling in mgmt load_keys()

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit b7059136d765603f2cff05d5e2d4850a4e505ec8)

commit 18c838db746c7cb6633587cc3b78ae6daa41a0f5
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Fri Oct 14 19:20:01 2011 -0300

    Bluetooth: return proper error if sock_queue_rcv_skb() fails

    Improve error handling at cmd_status() and cmd_complete()

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 56b7d137855eb02cba8aecbb67d49c24b43644b0)

commit 9781a9d7d6566b211e57d39539f994f989813a5c
Author: David Herrmann <dh.herrmann@googlemail.com>
Date:   Sat Oct 8 14:58:47 2011 +0200

    Bluetooth: Fix hci core device initialization

    We must not call device_del() if we didn't use device_add(). See module.c
    for comments on that. Therefore, we need to call device_initialize() when
    allocating the hci device and later device_add() instead of
    device_register().

    This also fixes a bug when hci_register_dev() failed and we call
    hci_free_dev() without a valid core device. hci_free_dev() segfaults while
    calling put_device() on invalid memory.

    We already do this with hci_conn connections (hci_conn_init_sysfs()) so
    they do not need to be fixed.

    Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 0ac7e7002c4d0841197e9ccb8cfecc5b8c58b200)

commit 7707d96db11c177e694baaf7dd0adc9bf31b09e7
Author: Szymon Janc <szymon.janc@tieto.com>
Date:   Mon Sep 26 14:19:47 2011 +0200

    Bluetooth: rfcomm: Fix sleep in invalid context in rfcomm_security_cfm

    This was triggered by turning off encryption on ACL link when rfcomm
    was using high security. rfcomm_security_cfm (which is called from rx
    task) was closing DLC and this involves sending disconnect message
    (and locking socket).

    Move closing DLC to rfcomm_process_dlcs and only flag DLC for closure
    in rfcomm_security_cfm.

    BUG: sleeping function called from invalid context at net/core/sock.c:2032
    in_atomic(): 1, irqs_disabled(): 0, pid: 1788, name: kworker/0:3
    [<c0068a08>] (unwind_backtrace+0x0/0x108) from [<c05e25dc>] (dump_stack+0x20/0x24)
    [<c05e25dc>] (dump_stack+0x20/0x24) from [<c0087ba8>] (__might_sleep+0x110/0x12c)
    [<c0087ba8>] (__might_sleep+0x110/0x12c) from [<c04801d8>] (lock_sock_nested+0x2c/0x64)
    [<c04801d8>] (lock_sock_nested+0x2c/0x64) from [<c05670c8>] (l2cap_sock_sendmsg+0x58/0xcc)
    [<c05670c8>] (l2cap_sock_sendmsg+0x58/0xcc) from [<c047cf6c>] (sock_sendmsg+0xb0/0xd0)
    [<c047cf6c>] (sock_sendmsg+0xb0/0xd0) from [<c047cfc8>] (kernel_sendmsg+0x3c/0x44)
    [<c047cfc8>] (kernel_sendmsg+0x3c/0x44) from [<c056b0e8>] (rfcomm_send_frame+0x50/0x58)
    [<c056b0e8>] (rfcomm_send_frame+0x50/0x58) from [<c056b168>] (rfcomm_send_disc+0x78/0x80)
    [<c056b168>] (rfcomm_send_disc+0x78/0x80) from [<c056b9f4>] (__rfcomm_dlc_close+0x2d0/0x2fc)
    [<c056b9f4>] (__rfcomm_dlc_close+0x2d0/0x2fc) from [<c056bbac>] (rfcomm_security_cfm+0x140/0x1e0)
    [<c056bbac>] (rfcomm_security_cfm+0x140/0x1e0) from [<c0555ec0>] (hci_event_packet+0x1ce8/0x4d84)
    [<c0555ec0>] (hci_event_packet+0x1ce8/0x4d84) from [<c0550380>] (hci_rx_task+0x1d0/0x2d0)
    [<c0550380>] (hci_rx_task+0x1d0/0x2d0) from [<c009ee04>] (tasklet_action+0x138/0x1e4)
    [<c009ee04>] (tasklet_action+0x138/0x1e4) from [<c009f21c>] (__do_softirq+0xcc/0x274)
    [<c009f21c>] (__do_softirq+0xcc/0x274) from [<c009f6c0>] (do_softirq+0x60/0x6c)
    [<c009f6c0>] (do_softirq+0x60/0x6c) from [<c009f794>] (local_bh_enable_ip+0xc8/0xd4)
    [<c009f794>] (local_bh_enable_ip+0xc8/0xd4) from [<c05e5804>] (_raw_spin_unlock_bh+0x48/0x4c)
    [<c05e5804>] (_raw_spin_unlock_bh+0x48/0x4c) from [<c040d470>] (data_from_chip+0xf4/0xaec)
    [<c040d470>] (data_from_chip+0xf4/0xaec) from [<c04136c0>] (send_skb_to_core+0x40/0x178)
    [<c04136c0>] (send_skb_to_core+0x40/0x178) from [<c04139f4>] (cg2900_hu_receive+0x15c/0x2d0)
    [<c04139f4>] (cg2900_hu_receive+0x15c/0x2d0) from [<c0414cb8>] (hci_uart_tty_receive+0x74/0xa0)
    [<c0414cb8>] (hci_uart_tty_receive+0x74/0xa0) from [<c02cbd9c>] (flush_to_ldisc+0x188/0x198)
    [<c02cbd9c>] (flush_to_ldisc+0x188/0x198) from [<c00b2774>] (process_one_work+0x144/0x4b8)
    [<c00b2774>] (process_one_work+0x144/0x4b8) from [<c00b2e8c>] (worker_thread+0x198/0x468)
    [<c00b2e8c>] (worker_thread+0x198/0x468) from [<c00b9bc8>] (kthread+0x98/0xa0)
    [<c00b9bc8>] (kthread+0x98/0xa0) from [<c0061744>] (kernel_thread_exit+0x0/0x8)

    Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 88149db4948ef90cf6220d76e34955e46c2ff9f9)

commit d14e57779d049375b7148ccd3a75770336535830
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Tue Oct 11 15:57:01 2011 -0300

    Bluetooth: Fix permission of enable_le param

    With 0444 it is impossible to change the param, changing it to 0644.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 669bb3962bd7f781879222eeb7263d527551dd5e)

commit 7b377a7a7549b0a19ff0a28e7c2430ad129ce4a3
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date:   Tue Oct 11 14:04:34 2011 +0300

    Bluetooth: convert role_switch variable to flag in l2cap chan

    role_switch variable inside l2cap_chan is a logical one and can
    be easily converted to flag

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 43bd0f32d5cf6593e420b26e2c1c41dc371a47d7)

commit e1f8f93a188d224be3489695fd3849048b65de99
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date:   Tue Oct 11 14:04:33 2011 +0300

    Bluetooth: convert force_active variable to flag in l2cap chan

    force_active variable inside l2cap_chan is a logical one and can
    be easily converted to flag

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 15770b1ab9747de47604da3494e187056b120aff)

commit fd5db3833fd54997829c2f62cc202c6beb487bde
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date:   Tue Oct 11 14:04:32 2011 +0300

    Bluetooth: convert force_reliable variable to flag in l2cap chan

    force_reliable variable inside l2cap_chan is a logical one and can
    be easily converted to flag

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit ecf61bdba845b5e77cf1d5e8620ef54abcfa50ef)

commit 551aa8d06f9fa3add8f5952d9a81ed70f7972d89
Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Date:   Tue Oct 11 14:04:31 2011 +0300

    Bluetooth: convert flushable variable to flag in l2cap chan

    flushable variable inside l2cap_chan is a logical one and can
    be easily converted to flag. Added flags in l2cap_chan structure.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit d57b0e8b8990419b7b7ae0dda5cc4452720b3c7c)

commit 19af0ad74942a2ffff75c875f403439dd7140fa0
Author: Paul Bolle <pebolle@tiscali.nl>
Date:   Sun Oct 9 12:12:22 2011 +0200

    Bluetooth: btusb: hide more usb_submit_urb errors

    There are still three calls of usb_submit_urb() that will print errors
    if those calls return -EPERM or -ENODEV. I have never triggered these,
    so I'm not sure when these return values might be seen. It still makes
    sense to be silent if these occur (since "urb is being killed" and
    "device got disconnected" aren't things to worry about).

    Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit d4b8d1c9c1564f4cbce86cbbee099fadf735b226)

commit d14278e671963737329b6fccc3041ca896b1a35d
Author: Paul Bolle <pebolle@tiscali.nl>
Date:   Sun Oct 9 12:12:16 2011 +0200

    Bluetooth: btusb: also be quiet when suspending

    usb_submit_urb() returns -ENODEV when a usb device is disconnected. In
    commit 4935f1c164ac528dff3538f97953b385ba500710 ("Bluetooth: btusb: be
    quiet on device disconnect") I stopped treating that return as an error
    in the three btusb_*_complete() functions.

    It turns out btusb_send_frame() generates a similar error if the system
    is suspended while the bluetooth usb device is enabled. The sensible
    thing to do here seems to be to treat -ENODEV (and -EPERM) just like the
    btusb_*_complete() functions now do.

    Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 5a9b80e2cd993f77d6d068470a4fd77fdfae44ab)

commit 90e41fb3693a7aa63b3e3b9eaeab2f8b8d7e9d19
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Fri Oct 7 01:29:51 2011 -0300

    Bluetooth: Rename hidp_find_connection()

    hidp_get_connection() makes more sense because we hold a reference to the
    connection inside this function.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 3e90dc86f4b840297bd1fafdb9ba1bf58f2e0e49)

commit da978630089d42dce8fba3fa55ec22101171051f
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Oct 6 23:32:29 2011 -0300

    Bluetooth: Delay session allocation in hidp

    It gets allocated only when it is really needed.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 81b25cd04387fbceb76fe893db4863a380941413)

commit acf61940f62a2d8ade681a779ae4dfe4e958d583
Author: Peter Hurley <peter@hurleysoftware.com>
Date:   Tue Aug 30 11:53:35 2011 -0400

    Bluetooth: hidp: safely acquire hci connection

    Claim device lock to safely enumerate hci connection list and bump
    hci connection proxy device ref count simultaneously.

    This patch incorporates David Herrmann's fix to prevent adding an
    HID device when the hci connection no longer exists.

    Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
    Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 1785dbf9e30be62ab45e34900e574b8307bc98b5)

commit c277abee0ec8a7511605a71ae7ad6da758a1d953
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Oct 6 22:05:37 2011 -0300

    Bluetooth: Uses test_and_clear_bit() when possible

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit ab88f7149e0e3284623adcaa60460a9a69d9f131)

commit f71c4ef581d593f7e5112be539a9d310e841e53a
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Oct 6 21:27:56 2011 -0300

    Bluetooth: Remove wrong error check

    d458a9dfc add this check, but now it proves to be wrong.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 192893c72197b3f49f76a315024bdcd5aa26fff3)

commit 6837eccdae4e6ebbd20a980e2b314c04559977d3
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Oct 6 21:17:32 2011 -0300

    Bluetooth: Fix input device registration

    This is a regression fix. It made impossible use input device when hid
    fails.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 3415a5fdde715062aa18bd6361f8e75cfbb31208)

commit b39f53c62ba409594b4b233c96b309a6ad9c2ae8
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Oct 6 20:51:37 2011 -0300

    Bluetooth: Trasmit interrupt channel messages first

    interrupt channel is low latency.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 679344e44e09c74848535a28948df7c3b3c1a071)

commit a5115e2bc1cb3fcf938f519ac08b0e3a6322f6cc
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Oct 6 18:02:13 2011 -0300

    Bluetooth: prioritize the interrupt channel in hidp

    Interrupt channel has low latency requiments, should be processed first.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit dc0da5cdac44aea6a04b18acc5526931430e0c35)

commit ab260e41afa9b8ea0f6e96d876cabdd5e50aabf2
Author: Gustavo F. Padovan <padovan@profusion.mobi>
Date:   Thu Oct 6 17:35:31 2011 -0300

    Bluetooth: use list_for_each_entry() in hidp

    list_for_each_entry is much more meaningful.

    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit cd11cdd28468d6222ce6489b2212fa7b0efaefdf)

commit 441ad15b628d12c514f13f14628904da2cb82193
Author: David Herrmann <dh.herrmann@googlemail.com>
Date:   Fri Aug 26 14:06:02 2011 +0200

    Bluetooth: hidp: Stop I/O on shutdown

    Current hidp driver purges the in/out queue on HID shutdown, but does
    not prevent further I/O. If a driver uses hidp_output_raw_report or
    hidp_get_raw_report during shutdown, the driver hangs for 5 or 10
    seconds per call until it gets a timeout.
    That is, if the output queue of an HID driver has 10 messages pending,
    it will take 50s until hid_destroy_device() will return. The
    hidp_session_sem semaphore is held during shutdown so no other HID
    device may be added/removed during this time.

    This patch makes hidp_output_raw_report and hidp_get_raw_report fail if
    session->terminate is true. Also hidp_session will wakeup all current
    calls to these functions to cancel the current operations.

    We already purge the current I/O queues on hidp_stop(), so this data loss
    does not change the behaviour of the HID drivers.

    Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 794d175698f0e78be7f2e3f4bdbe0e7cd3f2d6ae)

commit a9f558a00f6e2fa2fe25a9ae5613c9833542c292
Author: Andre Guedes <andre.guedes@openbossa.org>
Date:   Mon Sep 26 20:48:35 2011 -0300

    Bluetooth: hci_le_adv_report_evt code refactoring

    There is no reason to treat the first advertising entry differently
    from the potential other ones. Besides, the current implementation
    can easily leads to typos.

    Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit e95beb414168f8fcae195b5a77be29b3362d6904)

commit 8519616b888d87a07b640d40eab630a5da966c73
Author: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Date:   Fri Sep 23 10:01:30 2011 +0200

    Bluetooth: Fix possible NULL pointer dereference

    Checking conn->pending_sec_level if there is no connection leads to potential
    null pointer dereference. Don't process pin_code_request_event at all if no
    connection exists.

    Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
    Acked-by: Marcel Holtmann <marcel@holtmann.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit b6f98044a6cbeba8234a3d433d715e9ef36880c4)

commit ddae390e0259a5236c30de28fd2a21d02c7b7abd
Author: Szymon Janc <szymon.janc@tieto.com>
Date:   Thu Jul 28 16:24:33 2011 +0200

    Bluetooth: Mark not declared l2cap_core functions as static

    Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 67c9e840a098fa62c0b464387160ff8f52a7ef4a)

commit 02906685c82aff888fdbfa0841ed608c27a1e2ff
Author: Anderson Lizardo <anderson.lizardo@openbossa.org>
Date:   Wed Jul 27 18:40:09 2011 -0300

    Bluetooth: use recommended LE connection parameters

    The new connection parameters now match the recommended values for
    Proximity and Health Thermometer profiles. The previous values were
    ramdomly chosen, and are either too low or too high for most cases.

    New values:

    Scan Interval: 60 ms
    Scan Window: 30 ms
    Minimum Connection Interval: 50 ms
    Maximum Connection Interval: 70 ms
    Supervision Timeout: 420 ms

    See "Table 5.2: Recommended Scan Interval and Scan Window Values" and
    "Table 5.3: Recommended Connection Interval Values" for both profiles
    for details. Note that the "fast connection" parameters were chosen,
    because we do not support yet dynamically changing these parameters from
    initiator side.

    Additionally, the Proximity profile recommends (section "4.4 Alert on
    Link Loss"):

    "It is recommended that the Link Supervision Timeout (LSTO) is set to 6x
    the connection interval."

    Minimum_CE_Length and Maximum_CE_Length were also changed from 0x0001 to
    0x0000 because they are informational and optional, and old value was
    not reflecting reality.

    Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 0e8339151fa85cb9b088abfb13e2dd5214a25429)

commit f7c1312beff0eac87ea6b6703295fa14c2baeb15
Author: Mat Martineau <mathewm@codeaurora.org>
Date:   Fri Jul 22 14:54:00 2011 -0700

    Bluetooth: Perform L2CAP SDU reassembly without copying data

    Use sk_buff fragment capabilities to link together incoming skbs
    instead of allocating a new skb for reassembly and copying.

    The new reassembly code works equally well for ERTM and streaming
    mode, so there is now one reassembly function instead of two.

    Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 84084a3197a9fdec10fa542c0df11928a784e7fc)

commit 81ba8e2ae3098fee9a4db520ff221ac56cd73181
Author: Mat Martineau <mathewm@codeaurora.org>
Date:   Fri Jul 22 14:53:59 2011 -0700

    Bluetooth: Handle fragmented skbs in bt_sock_stream_recvmsg()

    ERTM reassembly will be more efficient when skbs are linked together
    rather than copying every incoming data byte. The existing stream recv
    function assumes skbs are linear, so it needs to know how to handle
    fragments before reassembly is changed.

    bt_sock_recvmsg() already handles fragmented skbs.

    Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 5b668eb3270f3f9c13ddf6e4fb57bf20c83dccff)

commit 62bd43fa3568d4de29903d758a83c49334feb836
Author: Mat Martineau <mathewm@codeaurora.org>
Date:   Fri Jul 22 14:53:58 2011 -0700

    Bluetooth: Linearize skbs for use in BNEP, CMTP, HIDP, and RFCOMM

    Fragmented skbs are only encountered when receiving ERTM or streaming
    mode L2CAP data.  BNEP, CMTP, HIDP, and RFCOMM generally use basic
    mode, but they need to handle fragments without crashing.

    Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 449357200c5d73d80a9c42dee5dafed684b3cd17)

commit 9212f56832c5a74e185922e831696c58ae16d371
Author: Peter Hurley <peter@hurleysoftware.com>
Date:   Thu Jul 14 08:48:32 2011 -0400

    Bluetooth: Allow ACL packets over USB in HCI_RAW mode

    Removed tests which prevent transmission of ACL packets
    when the device is in HCI_RAW mode. These tests verified that
    there are ACL or LE links currently tracked by the HCI
    connection manager. However, a HCI_RAW mode device does not
    use the connection manager. In these circumstances, the connection
    counts will be zero, and thus, transmitted ACL packets dropped.

    The acl_num test is actually a vestige of a previous bulk URB
    scheme that is no longer used by this driver (bulk URBs were not
    started until at least one ACL connection was created). This was
    incompatible with some endpoint implementations and was dropped -
    see commit 43c2e57f94.

    The utility of these tests is marginal - currently, the hci tx
    scheduler cannot send an ACL or LE packet for an untracked connection
    (except if the device is in HCI_RAW mode).

    Lastly, no other transport layer driver enforces these same tests.

    Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
    Acked-by: Acked-by: Marcel Holtmann <marcel@holtmann.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 9fd481e03c1e9c76c814b88b9ea1cbda9afb0812)

commit 4b7bd4840972a0015f3a842a1eeeb6edd1d69f93
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Mon Sep 12 20:00:50 2011 +0300

    Bluetooth: mark l2cap_create_iframe_pdu as static

    l2cap_create_iframe_pdu is only used in l2cap_core.c

    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit ab0ff76d1bda3b3b3e65caaa0cc5e4b01a81b2ee)

commit f351da1a5f2508c80edbda188621bb1add27fcbb
Author: Andre Guedes <andre.guedes@openbossa.org>
Date:   Fri Sep 9 18:56:26 2011 -0300

    Bluetooth: Check 'dev_class' in mgmt_device_found()

    The mgmt_device_found event will be used to report LE devices found
    during discovery procedure. Since LE advertising reports events
    doesn't have class of device information, we need to check if
    'dev_class' is not NULL before copying it.

    Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit f8523598ee608a8c4d1f3bbd3639785be3321111)

commit c8e4293b062b537144c96f12e72e07e2f5d0d5c3
Author: Andre Guedes <andre.guedes@openbossa.org>
Date:   Fri Sep 9 18:56:24 2011 -0300

    Bluetooth: Reduce critical region.

    This patch reduces the critial region (protected by hdev->lock) in
    hci_cc_le_set_scan_enable(). This way, only really required code is
    synchronized.

    Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit a8f13c8cd2c732828e5da735c204447a55cdab03)

commit c245874b2d2944f1343f625b127b2359f359c3d3
Author: Anderson Briglia <anderson.briglia@openbossa.org>
Date:   Mon Sep 19 14:41:09 2011 -0400

    Bluetooth: Fix wrong memcpy size on LE start encryption

    This patch fixes wrong memcpy size when copying rand value to
    HCI_OP_LE_START_ENC command.
    The compiler pretends that the array parameter was declared as a pointer
    and sizeof reports the size of the pointer. [1]

    [1] http://www.c-faq.com/aryptr/aryparmsize.html

    Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
    Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 51beabdf624df14d0805b001d3f939629b70d9db)

commit a051774bf1cf51b43ab44554627c61466afa6953
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Thu Aug 25 20:02:37 2011 -0300

    Bluetooth: Remove support for other SMP keys than the LTK

    For now, only the LTK is properly supported. We are able to receive
    and generate the other types of keys, but we are not able to use
    them. So it's better not request them to be distributed.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit ca10b5ee0cb298f094db00dba7e397a8bc4e8398)

commit 12e592dd7897e434feb1791f7731144eed766047
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Thu Aug 25 20:02:35 2011 -0300

    Bluetooth: Fix not setting a pending security level

    For slave initiated security, we should set a default security level,
    for now BT_SECURITY_MEDIUM.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit feb45eb5961b1c8c4f5e9559f48e513d2714b223)

commit fabe71228820a4b7f1f3c4e3c1a301b717d517c0
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Thu Aug 25 20:02:29 2011 -0300

    Revert "Bluetooth: Add support for communicating keys with userspace"

    This reverts commit 5a0a8b49746771fba79866fb9185ffa051a6a183.

    If we use separate messages and list for SMP specific keys we can
    simplify the code.

    Conflicts:

    	net/bluetooth/mgmt.c

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit a492cd52b530cbcf42eb7349e6b435804a7a9271)

commit 1b93327d460a5a94600d52cdaf7655e8125aaa3b
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Thu Aug 25 20:02:28 2011 -0300

    Bluetooth: Use the LTK after receiving a LE Security Request

    When receiving a security request from the remote device we should find
    if there is already a LTK associated with the remote device, if found
    we should use it to encrypt the link.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 988c5997d32052a58bd0127710bc8e2c8c5665b1)

commit 3278930afbc384ba6ece98af4e6e4578d79c37f9
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Thu Aug 25 20:02:27 2011 -0300

    Bluetooth: Fix sending wrong authentication requirements

    Until we support any pairing method (Passkey Entry, OOB) that gives
    MITM protection we shouldn't send that we have MITM protection.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 0fb4eb6f630a22bf4c2f358ef2db91f28a3d18d4)

commit fbd96ebf618c8f882ac9a0645eaabb05c14691e2
Author: Antti Julku <antti.julku@nokia.com>
Date:   Thu Aug 25 16:48:02 2011 +0300

    Bluetooth: Add mgmt events for blacklisting

    Add management interface events for blocking/unblocking a device.
    Sender of the block device command gets cmd complete and other
    mgmt sockets get the event. Event is also sent to mgmt sockets when
    blocking is done with ioctl, e.g when blocking a device with
    hciconfig. This makes it possible for bluetoothd to track status
    of blocked devices when a third party block or unblocks a device.

    Event sending is handled in mgmt_device_blocked function which gets
    called from hci_blacklist_add in hci_core.c. A pending command is
    added in mgmt_block_device, so that it can found when sending the
    event - the event is not sent to the socket from which the pending
    command came. Locks were moved out from hci_core.c to hci_sock.c
    and mgmt.c, because locking is needed also for mgmt_pending_add in
    mgmt.c.

    Signed-off-by: Antti Julku <antti.julku@nokia.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 5e762444b0d3e56bbd66f5092434c4a1ba698313)

commit 2f75bfc90245b671038b49b007ec84aa7afe88d8
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Fri Sep 2 14:51:22 2011 -0300

    Bluetooth: Use the MEDIUM security level for pairings

    This lifts the requirement of 16 digits pin codes when pairing
    with devices that do not support SSP when using the mgmt interface.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit c908df362c20be0eeef506fe62e13d835a4633f9)

commit 1161a8aede83d634382735b770870083a2d3416b
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Fri Sep 2 14:51:20 2011 -0300

    Bluetooth: Require authentication if MITM protection is requested

    The HIGH security level requires a 16 digit pin code for non-SSP
    bondings. Sometimes this requirement is not acceptable and we still
    want protection againts MITM attacks (which is something that the
    MEDIUM security level doesn't provide), for that we should allow
    another way to request authentication without using the HIGH security
    level.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit e9bf2bf03e14627fac8520468231ea11dfa37610)

commit 47e19e3e21a0366eafb1833719f3921cde7800d7
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Mon Sep 5 14:31:31 2011 -0300

    Bluetooth: Move SMP crypto functions to a workqueue

    The function crypto_blkcipher_setkey() called by smp_e()
    can sleep, so all the crypto work has to be moved to
    hci_dev workqueue.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 8aab47574a7f5b46a4cdbc6fd820ab34e6c5dbf9)

commit 48da09963ffda490d45cc8f8014bc933c7be47eb
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Mon Sep 5 14:31:30 2011 -0300

    Bluetooth: Move SMP fields to a separate structure

    The objective is to make the core to have as little as possible
    information about SMP procedures and logic. Now, all the SMP
    specific information is hidden from the core.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 1c1def09c446aae441410b70e6439ffe44dee866)

commit caa5f2a656bb341ea8fb7d6e24260a38b63fd2c6
Author: David Herrmann <dh.herrmann@googlemail.com>
Date:   Fri Aug 26 13:27:12 2011 +0200

    Bluetooth: hidp: Add support for NO_INIT_REPORTS quirk

    During setup the host initializes all HID reports. Some devices do not
    support this. If this quirk is set, we skip the initialization.
    See also usbhid_init_reports() for this quirk.

    Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 142c69c6eaab26587264881bb71546e30aafdcee)

commit 0d009c7c2dd6106a8f39c29f2c1cd0d8ec56a66e
Author: Peter Hurley <peter@hurleysoftware.com>
Date:   Wed Aug 24 10:04:56 2011 -0400

    Bluetooth: Add LE link type for debugfs output

    Add LE link type as known connection type for debugfs stringizing
    output.

    Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 21061df3a2577b8d1feb1ca3cb51445085692e89)

commit 6b6f5feb5a1e644d1b93719c0c7b6fc10f8ffef8
Author: Antti Julku <antti.julku@nokia.com>
Date:   Wed Jun 22 13:11:56 2011 +0300

    Bluetooth: Add mgmt command for fast connectable mode

    Add command to management interface for enabling/disabling the
    fast connectable mode.

    Signed-off-by: Antti Julku <antti.julku@nokia.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit f6422ec624a19ba144b4b5cdbbc5ee41cc6f6400)

commit 1a8ced1813a9317d255076907681ce7c4a354b15
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Fri Aug 19 21:06:56 2011 -0300

    Bluetooth: Add link_type information to the mgmt Connected event

    One piece of information that was lost when using the mgmt interface,
    was the type of the connection. Using HCI events we used to know
    the type of the connection based on the type of the event, e.g.
    HCI_LE_Connection_Complete for LE links.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit cfafccf730d363accacbd165542095ce6f7d2de8)

commit 9dcf05e9dd60943c68cda85d21c8e072ecccf161
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Fri Aug 19 21:06:55 2011 -0300

    Bluetooth: Add support for running SMP without a socket

    When doing the pairing procedure we won't have an associated
    socket, but we still have to do the SMP negotiation. This
    adds support for encrypting the link and exchanging keys.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 160dc6ac1256ed15a507bec9a2ff1f6d24a5a3ff)

commit eadc01e3e8d177624db151205e045e16db33c029
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Fri Aug 19 21:06:52 2011 -0300

    Bluetooth: Use the same timeouts for both ACL and LE links

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 454d48ff70c24930c6b0f9cb64f290fca2dfb271)

commit 4ccb44d89c888596be20e694a5c45129084cfd99
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Fri Aug 19 21:06:51 2011 -0300

    Bluetooth: Add a flag to indicate that SMP is going on

    Add HCI_CONN_LE_SMP_PEND flag to indicate that SMP is pending
    for that connection. This allows to have information that an SMP
    procedure is going on for that connection.

    We use the HCI_CONN_ENCRYPT_PEND to indicate that encryption
    (HCI_LE_Start_Encryption) is pending for that connection.

    While a SMP procedure is going on we hold an reference to the
    connection, to avoid disconnections.

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit d26a23454813908a1bf0e2fd8c73233b22c6dbd7)

commit 4eb89fcecdb93cfc91377a7ba534d6a3b9d29ca1
Author: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Date:   Fri Aug 19 21:06:50 2011 -0300

    Bluetooth: Reset the security timer when a command is queued

    Each time a SMP command is enqueued, we reset the SMP timer,
    this way we follow exactly what the spec mandates:

    "The Security Manager Timer shall be reset when an L2CAP SMP command is
    queued for transmission." Vol. 3, Part H, Section 3.4

    Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit e2dcd113d15ef99d23498859e7006955b5367698)

commit b23f395e8100a7ed319ed5e02c12312ab55658d3
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Wed Aug 17 16:23:00 2011 +0300

    Bluetooth: make use of connection number to optimize the scheduler

    This checks if there is any existing connection according to its type
    before start iterating in the list and immediately stop iterating when
    reaching the number of connections.

    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 52087a792c1513b85de674a4fc67fb92855474c3)

commit 05a9406e8a85196f6fb5c49dae42b262c53378e6
Author: Peter Hurley <peter@hurleysoftware.com>
Date:   Fri Aug 5 10:53:52 2011 -0400

    Bluetooth: cmtp: Fix session cleanup on failed conn add

    Once the session thread is running, cleanup must be handled
    by the session thread only.

    Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 687beaa0d1d937c327e2f97b4b4fa6c23ca70624)

commit 8297382baa80ee13eb6decb361abc42703d104a4
Author: Peter Hurley <peter@hurleysoftware.com>
Date:   Fri Aug 5 10:44:21 2011 -0400

    Bluetooth: cmtp: Fix deadlock in session deletion

    Commit fada4ac339 introduced the usage of kthread API.
    kthread_stop is a blocking function which returns only when
    the thread exits. In this case, the thread can't exit because it's
    waiting for the write lock, which is being held by cmtp_del_connection()
    which is waiting for the thread to exit -- deadlock.

    Revert cmtp_reset_ctr to its original behavior: non-blocking signalling
    for the session to terminate.

    Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 7176522cdca1f0b78a1434b41761f0334511822a)

commit 41131a7801b01fc9c27e78be2463662d1d99862e
Author: Peter Hurley <peter@hurleysoftware.com>
Date:   Sun Jul 24 00:11:10 2011 -0400

    Bluetooth: cmtp: Fix lost wakeup of session thread

    Fix race condition which can result in missing the wakeup intended
    to stop the session thread.

    Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 3a3f5c7df55a1294c9e6e2d0b8cea604b137438f)

commit 430b0b8310880b009925af40c96f793cbc9c8519
Author: Paul Bolle <pebolle@tiscali.nl>
Date:   Tue Aug 9 17:16:28 2011 +0200

    Bluetooth: btusb: be quiet on device disconnect

    Disabling the bluetooth usb device embedded in (some) ThinkPads tends to
    lead to errors like these:
        btusb_bulk_complete: hci0 urb ffff88011b9bfd68 failed to resubmit (19)
        btusb_intr_complete: hci0 urb ffff88011b46a318 failed to resubmit (19)
        btusb_bulk_complete: hci0 urb ffff88011b46a000 failed to resubmit (19)

    That is because usb_disconnect() doesn't "quiesces" pending urbs.

    Disconnecting a device is a normal thing to happen so it's no big deal
    that usb_submit_urb() returns -ENODEV. The simplest way to get rid of
    these errors is to stop treating that return as an error. Trivial,
    actually.

    While we're at it, add comments to be explicit about the reasons we're
    not complaining about -EPERM and -ENODEV.

    Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 4935f1c164ac528dff3538f97953b385ba500710)

commit 8b5a028c66e53db8f8a438b09590f1ab16539be2
Author: Dan Carpenter <error27@gmail.com>
Date:   Wed Aug 3 17:22:45 2011 +0300

    Bluetooth: unlock if allocation fails in hci_blacklist_add()

    There was a small typo here so we never actually hit the goto which
    would call hci_dev_unlock_bh().

    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
    (cherry picked from commit 8475e2336cf80ba6e7b27715b4b3214d73c211ab)
block: row: Dispatch requests according to their io-priority

This patch implements "application-hints" which is a way the issuing
application can notify the scheduler on the priority of its request.
This is done by setting the io-priority of the request.
This patch reuses an already existing mechanism of io-priorities developed
for CFQ. Please refer to kernel/Documentation/block/ioprio.txt for
usage example and explanations.

Change-Id: I228ec8e52161b424242bb7bb133418dc8b73925a
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

Conflicts:
	block/row-iosched.c
block: row: Idling mechanism re-factoring

At the moment idling in ROW is implemented by delayed work that uses
jiffies granularity which is not very accurate. This patch replaces
current idling mechanism implementation with hrtime API, which gives
nanosecond resolution (instead of jiffies).

Change-Id: I86c7b1776d035e1d81571894b300228c8b8f2d92
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
block: row: Don't notify URGENT if there are un-completed urgent req

When ROW scheduler reports to the block layer that there is an urgent
request pending, the device driver may decide to stop the transmission
of the current request in order to handle the urgent one. If the current
transmitted request is an urgent request - we don't want it to be
stopped.
Due to the above ROW scheduler won't notify of an urgent request if
there are urgent requests in flight.

Change-Id: I2fa186d911b908ec7611682b378b9cdc48637ac7
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>

Conflicts:
	block/row-iosched.c

Conflicts:
	block/row-iosched.c
block: row: Update initial values of ROW data structures

This patch sets the initial values of internal ROW
parameters.

Change-Id: I38132062a7fcbe2e58b9cc757e55caac64d013dc
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
[smuckle@codeaurora.org: ported from msm-3.7]
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
block: IO Scheduler tweaks hardcoded