<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/bluetooth/hci_uart.h, branch linux-4.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.16.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-4.16.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2017-10-29T13:03:28Z</updated>
<entry>
<title>Bluetooth: hci_ldisc: Allow sleeping while proto locks are held.</title>
<updated>2017-10-29T13:03:28Z</updated>
<author>
<name>Ronald Tschalär</name>
<email>ronald@innovation.ch</email>
</author>
<published>2017-10-26T05:14:53Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=67d2f8781b9f00d1089aafcfa3dc09fcd0f343e2'/>
<id>urn:sha1:67d2f8781b9f00d1089aafcfa3dc09fcd0f343e2</id>
<content type='text'>
Commit dec2c92880cc5435381d50e3045ef018a762a917 ("Bluetooth: hci_ldisc:
Use rwlocking to avoid closing proto races") introduced locks in
hci_ldisc that are held while calling the proto functions. These locks
are rwlock's, and hence do not allow sleeping while they are held.
However, the proto functions that hci_bcm registers use mutexes and
hence need to be able to sleep.

In more detail: hci_uart_tty_receive() and hci_uart_dequeue() both
acquire the rwlock, after which they call proto-&gt;recv() and
proto-&gt;dequeue(), respectively. In the case of hci_bcm these point to
bcm_recv() and bcm_dequeue(). The latter both acquire the
bcm_device_lock, which is a mutex, so doing so results in a call to
might_sleep(). But since we're holding a rwlock in hci_ldisc, that
results in the following BUG (this for the dequeue case - a similar
one for the receive case is omitted for brevity):

  BUG: sleeping function called from invalid context at kernel/locking/mutex.c
  in_atomic(): 1, irqs_disabled(): 0, pid: 7303, name: kworker/7:3
  INFO: lockdep is turned off.
  CPU: 7 PID: 7303 Comm: kworker/7:3 Tainted: G        W  OE   4.13.2+ #17
  Hardware name: Apple Inc. MacBookPro13,3/Mac-A5C67F76ED83108C, BIOS MBP133.8
  Workqueue: events hci_uart_write_work [hci_uart]
  Call Trace:
   dump_stack+0x8e/0xd6
   ___might_sleep+0x164/0x250
   __might_sleep+0x4a/0x80
   __mutex_lock+0x59/0xa00
   ? lock_acquire+0xa3/0x1f0
   ? lock_acquire+0xa3/0x1f0
   ? hci_uart_write_work+0xd3/0x160 [hci_uart]
   mutex_lock_nested+0x1b/0x20
   ? mutex_lock_nested+0x1b/0x20
   bcm_dequeue+0x21/0xc0 [hci_uart]
   hci_uart_write_work+0xe6/0x160 [hci_uart]
   process_one_work+0x253/0x6a0
   worker_thread+0x4d/0x3b0
   kthread+0x133/0x150

We can't replace the mutex in hci_bcm, because there are other calls
there that might sleep. Therefore this replaces the rwlock's in
hci_ldisc with rw_semaphore's (which allow sleeping). This is a safer
approach anyway as it reduces the restrictions on the proto callbacks.
Also, because acquiring write-lock is very rare compared to acquiring
the read-lock, the percpu variant of rw_semaphore is used.

Lastly, because hci_uart_tx_wakeup() may be called from an IRQ context,
we can't block (sleep) while trying acquire the read lock there, so we
use the trylock variant.

Signed-off-by: Ronald Tschalär &lt;ronald@innovation.ch&gt;
Reviewed-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_serdev: Introduce hci_uart_unregister_device()</title>
<updated>2017-07-20T09:18:36Z</updated>
<author>
<name>Ian Molton</name>
<email>ian@mnementh.co.uk</email>
</author>
<published>2017-07-08T16:37:41Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c34dc3bfa7642fda423208579015d615f7becfa0'/>
<id>urn:sha1:c34dc3bfa7642fda423208579015d615f7becfa0</id>
<content type='text'>
Several drivers have the same (and incorrect) code in their
_remove() handler.

Coalesce this into a shared function.

Signed-off-by: Ian Molton &lt;ian@mnementh.co.uk&gt;
Reviewed-by: Sebastian Reichel &lt;sebastian.reichel@collabora.co.uk&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_ldisc: Use rwlocking to avoid closing proto races</title>
<updated>2017-05-18T11:52:50Z</updated>
<author>
<name>Dean Jenkins</name>
<email>Dean_Jenkins@mentor.com</email>
</author>
<published>2017-05-05T15:27:06Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=dec2c92880cc5435381d50e3045ef018a762a917'/>
<id>urn:sha1:dec2c92880cc5435381d50e3045ef018a762a917</id>
<content type='text'>
When HCI_UART_PROTO_READY is in the set state, the Data Link protocol
layer (proto) is bound to the HCI UART driver. This state allows the
registered proto function pointers to be used by the HCI UART driver.

When unbinding (closing) the Data Link protocol layer, the proto
function pointers much be prevented from being used immediately before
running the proto close function pointer. Otherwise, there is a risk
that a proto non-close function pointer is used during or after the
proto close function pointer is used. The consequences are likely to
be a kernel crash because the proto close function pointer will free
resources used in the Data Link protocol layer.

Therefore, add a reader writer lock (rwlock) solution to prevent the
close proto function pointer from running by using write_lock_irqsave()
whilst the other proto function pointers are protected using
read_lock(). This means HCI_UART_PROTO_READY can safely be cleared
in the knowledge that no proto function pointers are running.

When flag HCI_UART_PROTO_READY is put into the clear state,
proto close function pointer can safely be run. Note
flag HCI_UART_PROTO_SET being in the set state prevents the proto
open function pointer from being run so there is no race condition
between proto open and close function pointers.

Signed-off-by: Dean Jenkins &lt;Dean_Jenkins@mentor.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>bluetooth: hci_uart: remove unused hci_uart_init_tty</title>
<updated>2017-04-13T17:22:53Z</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2017-04-13T15:03:51Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=31927e5a52847761c1f2797a7ea53b6a75bdc518'/>
<id>urn:sha1:31927e5a52847761c1f2797a7ea53b6a75bdc518</id>
<content type='text'>
There are no users of hci_uart_init_tty, so remove it.

Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Cc: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Cc: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Cc: Johan Hedberg &lt;johan.hedberg@gmail.com&gt;
Cc: linux-bluetooth@vger.kernel.org
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_uart: add serdev driver support library</title>
<updated>2017-04-12T20:12:17Z</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2017-03-28T15:59:35Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=82f5169bf3d3b5d8f7f7c437d2d83435173cb638'/>
<id>urn:sha1:82f5169bf3d3b5d8f7f7c437d2d83435173cb638</id>
<content type='text'>
This adds library functions for serdev based BT drivers. This is largely
copied from hci_ldisc.c and modified to use serdev calls. There's a little
bit of duplication, but I avoided intermixing this as the ldisc code should
eventually go away.

Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Cc: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Cc: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Cc: Johan Hedberg &lt;johan.hedberg@gmail.com&gt;
Cc: linux-bluetooth@vger.kernel.org
Acked-by: Pavel Machek &lt;pavel@ucw.cz&gt;
[Fix style issues reported by Pavel]
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_uart: add support for word alignment</title>
<updated>2017-04-12T20:12:17Z</updated>
<author>
<name>Sebastian Reichel</name>
<email>sre@kernel.org</email>
</author>
<published>2017-03-28T15:59:34Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=aeac30140694824f26d14655271e1dcf3e32fd49'/>
<id>urn:sha1:aeac30140694824f26d14655271e1dcf3e32fd49</id>
<content type='text'>
This will be used by Nokia's H4+ protocol, which
uses 2-byte aligned packets.

Acked-by: Pavel Machek &lt;pavel@ucw.cz&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_uart: Add Marvell support</title>
<updated>2016-09-19T18:32:03Z</updated>
<author>
<name>Loic Poulain</name>
<email>loic.poulain@intel.com</email>
</author>
<published>2016-09-19T14:29:27Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=162f812f23bab583f5d514ca0e4df67797ac9cdf'/>
<id>urn:sha1:162f812f23bab583f5d514ca0e4df67797ac9cdf</id>
<content type='text'>
This patch introduces support for Marvell Bluetooth controller over
UART (8897 for now). In order to send the final firmware at full speed,
a helper firmware is firstly sent. Firmware download is driven by the
controller which sends request firmware packets (including expected
size).

This driver is a global rework of the one proposed by
Amitkumar Karwar &lt;akarwar@marvell.com&gt;.

Signed-off-by: Loic Poulain &lt;loic.poulain@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_uart: Add Nokia Protocol identifier</title>
<updated>2016-09-19T18:25:37Z</updated>
<author>
<name>Loic Poulain</name>
<email>loic.poulain@intel.com</email>
</author>
<published>2016-09-19T09:32:35Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9e69130c4efc61ce0a8fb3b9eea0188f8d41f779'/>
<id>urn:sha1:9e69130c4efc61ce0a8fb3b9eea0188f8d41f779</id>
<content type='text'>
Will be used by hci_nokia extra protocol.

Signed-off-by: Loic Poulain &lt;loic.poulain@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data</title>
<updated>2016-04-08T16:58:56Z</updated>
<author>
<name>Loic Poulain</name>
<email>loic.poulain@intel.com</email>
</author>
<published>2016-04-04T08:48:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=84cb3df02aea4b00405521e67c4c67c2d525c364'/>
<id>urn:sha1:84cb3df02aea4b00405521e67c4c67c2d525c364</id>
<content type='text'>
HCI_UART_PROTO_SET flag is set before hci_uart_set_proto call. If we
receive data from tty layer during this procedure, proto pointer may
not be assigned yet, leading to null pointer dereference in rx method
hci_uart_tty_receive.

This patch fixes this issue by introducing HCI_UART_PROTO_READY flag in
order to avoid any proto operation before proto opening and assignment.

Signed-off-by: Loic Poulain &lt;loic.poulain@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_uart: Add Intel/AG6xx support</title>
<updated>2016-02-24T15:34:23Z</updated>
<author>
<name>Loic Poulain</name>
<email>loic.poulain@intel.com</email>
</author>
<published>2016-02-22T09:48:03Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=395174bb07c1dce58fbf2baa3a01bb69f5103c59'/>
<id>urn:sha1:395174bb07c1dce58fbf2baa3a01bb69f5103c59</id>
<content type='text'>
This driver implements support for iBT2.1 Bluetooth controller embedded
in the AG620 communication combo. The controller needs to be configured
with bddata and can be patched with a binary patch file (pbn).
These operations are performed in manufacturing mode.

Signed-off-by: Loic Poulain &lt;loic.poulain@intel.com&gt;
Signed-off-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
</content>
</entry>
</feed>
