Skip to content

Commit

Permalink
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/bluetooth/bluetooth-next

Johan Hedberg says:

====================
pull request: bluetooth-next 2015-08-28

One more bunch of Bluetooth patches for 4.3:

 - Crash fix for hci_bcm driver
 - Enhancements to hci_intel driver (e.g. baudrate configuration)
 - Fix for SCO link type after multiple connect attempts
 - Cleanups & minor fixes in a few other places

Please let me know if there are any issues pulling. Thanks.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Aug 29, 2015
2 parents 6d74232 + 917522a commit f5004a1
Show file tree
Hide file tree
Showing 9 changed files with 372 additions and 40 deletions.
2 changes: 2 additions & 0 deletions drivers/bluetooth/btintel.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,5 @@ MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION);
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");
MODULE_FIRMWARE("intel/ibt-11-5.sfi");
MODULE_FIRMWARE("intel/ibt-11-5.ddc");
3 changes: 1 addition & 2 deletions drivers/bluetooth/btmrvl_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,8 +1376,7 @@ static void btmrvl_sdio_dump_firmware(struct btmrvl_private *priv)

/* fw_dump_data will be free in device coredump release function
after 5 min*/
dev_coredumpv(&priv->btmrvl_dev.hcidev->dev, fw_dump_data,
fw_dump_len, GFP_KERNEL);
dev_coredumpv(&card->func->dev, fw_dump_data, fw_dump_len, GFP_KERNEL);
BT_INFO("== btmrvl firmware dump to /sys/class/devcoredump end");
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)

/* fw_patch_num indicates the version of patch the device currently
* have. If there is no patch data in the device, it is always 0x00.
* So, if it is other than 0x00, no need to patch the deivce again.
* So, if it is other than 0x00, no need to patch the device again.
*/
if (ver->fw_patch_num) {
BT_INFO("%s: Intel device is already patched. patch num: %02x",
Expand Down Expand Up @@ -2100,7 +2100,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)

frag_len += sizeof(*cmd) + cmd->plen;

/* The paramter length of the secure send command requires
/* The parameter length of the secure send command requires
* a 4 byte alignment. It happens so that the firmware file
* contains proper Intel_NOP commands to align the fragments
* as needed.
Expand Down
40 changes: 28 additions & 12 deletions drivers/bluetooth/hci_bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct bcm_data {
};

/* List of BCM BT UART devices */
static DEFINE_SPINLOCK(bcm_device_list_lock);
static DEFINE_SPINLOCK(bcm_device_lock);
static LIST_HEAD(bcm_device_list);

static int bcm_set_baudrate(struct hci_uart *hu, unsigned int speed)
Expand Down Expand Up @@ -118,7 +118,7 @@ static int bcm_set_baudrate(struct hci_uart *hu, unsigned int speed)
return 0;
}

/* bcm_device_exists should be protected by bcm_device_list_lock */
/* bcm_device_exists should be protected by bcm_device_lock */
static bool bcm_device_exists(struct bcm_device *device)
{
struct list_head *p;
Expand All @@ -138,8 +138,8 @@ static int bcm_gpio_set_power(struct bcm_device *dev, bool powered)
if (powered && !IS_ERR(dev->clk) && !dev->clk_enabled)
clk_enable(dev->clk);

gpiod_set_value_cansleep(dev->shutdown, powered);
gpiod_set_value_cansleep(dev->device_wakeup, powered);
gpiod_set_value(dev->shutdown, powered);
gpiod_set_value(dev->device_wakeup, powered);

if (!powered && !IS_ERR(dev->clk) && dev->clk_enabled)
clk_disable(dev->clk);
Expand All @@ -164,7 +164,7 @@ static int bcm_open(struct hci_uart *hu)

hu->priv = bcm;

spin_lock(&bcm_device_list_lock);
spin_lock(&bcm_device_lock);
list_for_each(p, &bcm_device_list) {
struct bcm_device *dev = list_entry(p, struct bcm_device, list);

Expand All @@ -185,7 +185,7 @@ static int bcm_open(struct hci_uart *hu)
if (bcm->dev)
bcm_gpio_set_power(bcm->dev, true);

spin_unlock(&bcm_device_list_lock);
spin_unlock(&bcm_device_lock);

return 0;
}
Expand All @@ -197,14 +197,14 @@ static int bcm_close(struct hci_uart *hu)
BT_DBG("hu %p", hu);

/* Protect bcm->dev against removal of the device or driver */
spin_lock(&bcm_device_list_lock);
spin_lock(&bcm_device_lock);
if (bcm_device_exists(bcm->dev)) {
bcm_gpio_set_power(bcm->dev, false);
#ifdef CONFIG_PM_SLEEP
bcm->dev->hu = NULL;
#endif
}
spin_unlock(&bcm_device_list_lock);
spin_unlock(&bcm_device_lock);

skb_queue_purge(&bcm->txq);
kfree_skb(bcm->rx_skb);
Expand Down Expand Up @@ -338,6 +338,11 @@ static int bcm_suspend(struct device *dev)

BT_DBG("suspend (%p): is_suspended %d", bdev, bdev->is_suspended);

spin_lock(&bcm_device_lock);

if (!bdev->hu)
goto unlock;

if (!bdev->is_suspended) {
hci_uart_set_flow_control(bdev->hu, true);

Expand All @@ -352,6 +357,9 @@ static int bcm_suspend(struct device *dev)
mdelay(15);
}

unlock:
spin_unlock(&bcm_device_lock);

return 0;
}

Expand All @@ -362,6 +370,11 @@ static int bcm_resume(struct device *dev)

BT_DBG("resume (%p): is_suspended %d", bdev, bdev->is_suspended);

spin_lock(&bcm_device_lock);

if (!bdev->hu)
goto unlock;

if (bdev->device_wakeup) {
gpiod_set_value(bdev->device_wakeup, true);
BT_DBG("resume, delaying 15 ms");
Expand All @@ -375,6 +388,9 @@ static int bcm_resume(struct device *dev)
hci_uart_set_flow_control(bdev->hu, false);
}

unlock:
spin_unlock(&bcm_device_lock);

return 0;
}
#endif
Expand Down Expand Up @@ -488,9 +504,9 @@ static int bcm_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "%s device registered.\n", dev->name);

/* Place this instance on the device list */
spin_lock(&bcm_device_list_lock);
spin_lock(&bcm_device_lock);
list_add_tail(&dev->list, &bcm_device_list);
spin_unlock(&bcm_device_list_lock);
spin_unlock(&bcm_device_lock);

bcm_gpio_set_power(dev, false);

Expand All @@ -501,9 +517,9 @@ static int bcm_remove(struct platform_device *pdev)
{
struct bcm_device *dev = platform_get_drvdata(pdev);

spin_lock(&bcm_device_list_lock);
spin_lock(&bcm_device_lock);
list_del(&dev->list);
spin_unlock(&bcm_device_list_lock);
spin_unlock(&bcm_device_lock);

acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));

Expand Down
9 changes: 7 additions & 2 deletions drivers/bluetooth/hci_h4.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
switch ((&pkts[i])->lsize) {
case 0:
/* No variable data length */
(&pkts[i])->recv(hdev, skb);
skb = NULL;
dlen = 0;
break;
case 1:
/* Single octet variable length */
Expand Down Expand Up @@ -252,6 +251,12 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
kfree_skb(skb);
return ERR_PTR(-EILSEQ);
}

if (!dlen) {
/* No more data, complete frame */
(&pkts[i])->recv(hdev, skb);
skb = NULL;
}
} else {
/* Complete frame */
(&pkts[i])->recv(hdev, skb);
Expand Down
Loading

0 comments on commit f5004a1

Please sign in to comment.