* [PATCH 3/4] Bluetooth: Declare bpa10x_table[] as const
From: Marcel Holtmann @ 2013-10-11 14:46 UTC (permalink / raw)
To: linux-bluetooth
The bpa10x_table[] device table can be declared as const
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/bpa10x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index b9e4e62..8a31991 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -37,7 +37,7 @@
#define VERSION "0.10"
-static struct usb_device_id bpa10x_table[] = {
+static const struct usb_device_id bpa10x_table[] = {
/* Tektronix BPA 100/105 (Digianswer) */
{ USB_DEVICE(0x08fd, 0x0002) },
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/4] Bluetooth: Declare bfusb_table[] as const
From: Marcel Holtmann @ 2013-10-11 14:46 UTC (permalink / raw)
To: linux-bluetooth
The bfusb_table[] device table can be declared as const
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/bfusb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index cce2304..3138699 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -42,7 +42,7 @@
static struct usb_driver bfusb_driver;
-static struct usb_device_id bfusb_table[] = {
+static const struct usb_device_id bfusb_table[] = {
/* AVM BlueFRITZ! USB */
{ USB_DEVICE(0x057c, 0x2200) },
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/4] Bluetooth: Declare btusb_table[] and blacklist_table[] as const
From: Marcel Holtmann @ 2013-10-11 14:46 UTC (permalink / raw)
To: linux-bluetooth
The btusb_table[] and blacklist_table[] USB device tables can be
declared as const.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/btusb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 621069c..30868fa 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -50,7 +50,7 @@ static struct usb_driver btusb_driver;
#define BTUSB_ATH3012 0x80
#define BTUSB_INTEL 0x100
-static struct usb_device_id btusb_table[] = {
+static const struct usb_device_id btusb_table[] = {
/* Generic Bluetooth USB device */
{ USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
@@ -121,7 +121,7 @@ static struct usb_device_id btusb_table[] = {
MODULE_DEVICE_TABLE(usb, btusb_table);
-static struct usb_device_id blacklist_table[] = {
+static const struct usb_device_id blacklist_table[] = {
/* CSR BlueCore devices */
{ USB_DEVICE(0x0a12, 0x0001), .driver_info = BTUSB_CSR },
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Add hdev parameter to hdev->send driver callback
From: Marcel Holtmann @ 2013-10-11 14:03 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1381500064-24414-1-git-send-email-marcel@holtmann.org>
Hi Johan,
> Instead of masking hdev inside the skb->dev parameter, hand it
> directly to the driver as a parameter to hdev->send. This makes
> the driver interface more clear and simpler.
>
> This patch fixes all drivers to accept and handle the new parameter
> of hdev->send callback. Special care has been taken for bpa10x
> and btusb drivers that require having skb->dev set to hdev for
> the URB transmit complete handlers.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> drivers/bluetooth/bfusb.c | 3 +--
> drivers/bluetooth/bluecard_cs.c | 3 +--
> drivers/bluetooth/bpa10x.c | 5 +++--
> drivers/bluetooth/bt3c_cs.c | 3 +--
> drivers/bluetooth/btmrvl_main.c | 4 +---
> drivers/bluetooth/btsdio.c | 3 +--
> drivers/bluetooth/btuart_cs.c | 3 +--
> drivers/bluetooth/btusb.c | 5 +++--
> drivers/bluetooth/btwilink.c | 5 +----
> drivers/bluetooth/dtl1_cs.c | 3 +--
> drivers/bluetooth/hci_ldisc.c | 3 +--
> drivers/bluetooth/hci_ll.c | 1 -
> drivers/bluetooth/hci_vhci.c | 3 +--
> include/net/bluetooth/hci_core.h | 2 +-
> net/bluetooth/hci_core.c | 4 +---
> 15 files changed, 18 insertions(+), 32 deletions(-)
I accidentally send this one twice. So just ignore it.
Regards
Marcel
^ permalink raw reply
* [PATCH 8/8] Bluetooth: Remove pointless parameter check in vhci_send_frame()
From: Marcel Holtmann @ 2013-10-11 14:01 UTC (permalink / raw)
To: linux-bluetooth
The hdev parameter of vhci_send_frame() is always valid. If it were
not valid, then it would have crashed earlier in the call chain.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/hci_vhci.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index e6f5919..7b16738 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -83,18 +83,11 @@ static int vhci_flush(struct hci_dev *hdev)
static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct vhci_data *data;
-
- if (!hdev) {
- BT_ERR("Frame for unknown HCI device (hdev=NULL)");
- return -ENODEV;
- }
+ struct vhci_data *data = hci_get_drvdata(hdev);
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
- data = hci_get_drvdata(hdev);
-
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
skb_queue_tail(&data->readq, skb);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 7/8] Bluetooth: Remove pointless parameter check in hci_uart_send_frame()
From: Marcel Holtmann @ 2013-10-11 14:01 UTC (permalink / raw)
To: linux-bluetooth
The hdev parameter of hci_uart_send_frame() is always valid. If it
were not valid, then it would have crashed earlier in the call chain.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/hci_ldisc.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index b040546..6e06f6f 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -236,18 +236,11 @@ static int hci_uart_close(struct hci_dev *hdev)
/* Send frames from HCI layer */
static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_uart *hu;
-
- if (!hdev) {
- BT_ERR("Frame for unknown device (hdev=NULL)");
- return -ENODEV;
- }
+ struct hci_uart *hu = hci_get_drvdata(hdev);
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
- hu = hci_get_drvdata(hdev);
-
BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len);
hu->proto->enqueue(hu, skb);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 6/8] Bluetooth: Remove pointless parameter check in dtl1_hci_send_frame()
From: Marcel Holtmann @ 2013-10-11 14:01 UTC (permalink / raw)
To: linux-bluetooth
The hdev parameter of dtl1_hci_send_frame() is always valid. If it
were not valid, then it would have crashed earlier in the call chain.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/dtl1_cs.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index ad1a2f9..52eed1f 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -384,17 +384,10 @@ static int dtl1_hci_close(struct hci_dev *hdev)
static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- dtl1_info_t *info;
+ dtl1_info_t *info = hci_get_drvdata(hdev);
struct sk_buff *s;
nsh_t nsh;
- if (!hdev) {
- BT_ERR("Frame for unknown HCI device (hdev=NULL)");
- return -ENODEV;
- }
-
- info = hci_get_drvdata(hdev);
-
switch (bt_cb(skb)->pkt_type) {
case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 5/8] Bluetooth: Remove pointless parameter check in btuart_hci_send_frame()
From: Marcel Holtmann @ 2013-10-11 14:01 UTC (permalink / raw)
To: linux-bluetooth
The hdev parameter of btuart_hci_send_frame() is always valid. If it
were not valid, then it would have crashed earlier in the call chain.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/btuart_cs.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index f567cd8..a03ecc2 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -425,14 +425,7 @@ static int btuart_hci_close(struct hci_dev *hdev)
static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- btuart_info_t *info;
-
- if (!hdev) {
- BT_ERR("Frame for unknown HCI device (hdev=NULL)");
- return -ENODEV;
- }
-
- info = hci_get_drvdata(hdev);
+ btuart_info_t *info = hci_get_drvdata(hdev);
switch (bt_cb(skb)->pkt_type) {
case HCI_COMMAND_PKT:
--
1.8.3.1
^ permalink raw reply related
* [PATCH 4/8] Bluetooth: Remove pointless parameter check in btmrvl_send_frame()
From: Marcel Holtmann @ 2013-10-11 14:01 UTC (permalink / raw)
To: linux-bluetooth
The hdev parameter of btmrvl_send_frame() is always valid. If it were
not valid, then it would have crashed earlier in the call chain.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/btmrvl_main.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 547a447..5cf31c4 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -357,17 +357,10 @@ static void btmrvl_free_adapter(struct btmrvl_private *priv)
static int btmrvl_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct btmrvl_private *priv = NULL;
+ struct btmrvl_private *priv = hci_get_drvdata(hdev);
BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len);
- if (!hdev) {
- BT_ERR("Frame for unknown HCI device");
- return -ENODEV;
- }
-
- priv = hci_get_drvdata(hdev);
-
if (!test_bit(HCI_RUNNING, &hdev->flags)) {
BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags);
print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET,
--
1.8.3.1
^ permalink raw reply related
* [PATCH 3/8] Bluetooth: Remove pointless parameter check in bt3c_hci_send_frame()
From: Marcel Holtmann @ 2013-10-11 14:00 UTC (permalink / raw)
To: linux-bluetooth
The hdev parameter of bt3c_hci_send_frame() is always valid. If it
were not valid, then it would have crashed earlier in the call chain.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/bt3c_cs.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index fcd5fe9..73d8799 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -417,16 +417,9 @@ static int bt3c_hci_close(struct hci_dev *hdev)
static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- bt3c_info_t *info;
+ bt3c_info_t *info = hci_get_drvdata(hdev);
unsigned long flags;
- if (!hdev) {
- BT_ERR("Frame for unknown HCI device (hdev=NULL)");
- return -ENODEV;
- }
-
- info = hci_get_drvdata(hdev);
-
switch (bt_cb(skb)->pkt_type) {
case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/8] Bluetooth: Remove pointless parameter check in bluecard_hci_send_frame()
From: Marcel Holtmann @ 2013-10-11 14:00 UTC (permalink / raw)
To: linux-bluetooth
The hdev parameter of bluecard_hci_send_frame() is always valid. If it
were not valid, then it would have crashed earlier in the call chain.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/bluecard_cs.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 9194a1b..57427de 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -660,14 +660,7 @@ static int bluecard_hci_close(struct hci_dev *hdev)
static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- bluecard_info_t *info;
-
- if (!hdev) {
- BT_ERR("Frame for unknown HCI device (hdev=NULL)");
- return -ENODEV;
- }
-
- info = hci_get_drvdata(hdev);
+ bluecard_info_t *info = hci_get_drvdata(hdev);
switch (bt_cb(skb)->pkt_type) {
case HCI_COMMAND_PKT:
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/8] Bluetooth: Remove pointless parameter check in bfusb_send_frame()
From: Marcel Holtmann @ 2013-10-11 14:00 UTC (permalink / raw)
To: linux-bluetooth
The hdev parameter of bfusb_send_frame() is always valid. If it were
not valid, then it would have crashed earlier in the call chain.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/bfusb.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index a675849..cce2304 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -466,23 +466,16 @@ static int bfusb_close(struct hci_dev *hdev)
static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct bfusb_data *data;
+ struct bfusb_data *data = hci_get_drvdata(hdev);
struct sk_buff *nskb;
unsigned char buf[3];
int sent = 0, size, count;
BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, bt_cb(skb)->pkt_type, skb->len);
- if (!hdev) {
- BT_ERR("Frame for unknown HCI device (hdev=NULL)");
- return -ENODEV;
- }
-
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
- data = hci_get_drvdata(hdev);
-
switch (bt_cb(skb)->pkt_type) {
case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++;
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Add hdev parameter to hdev->send driver callback
From: Marcel Holtmann @ 2013-10-11 14:00 UTC (permalink / raw)
To: linux-bluetooth
Instead of masking hdev inside the skb->dev parameter, hand it
directly to the driver as a parameter to hdev->send. This makes
the driver interface more clear and simpler.
This patch fixes all drivers to accept and handle the new parameter
of hdev->send callback. Special care has been taken for bpa10x
and btusb drivers that require having skb->dev set to hdev for
the URB transmit complete handlers.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/bfusb.c | 3 +--
drivers/bluetooth/bluecard_cs.c | 3 +--
drivers/bluetooth/bpa10x.c | 5 +++--
drivers/bluetooth/bt3c_cs.c | 3 +--
drivers/bluetooth/btmrvl_main.c | 4 +---
drivers/bluetooth/btsdio.c | 3 +--
drivers/bluetooth/btuart_cs.c | 3 +--
drivers/bluetooth/btusb.c | 5 +++--
drivers/bluetooth/btwilink.c | 5 +----
drivers/bluetooth/dtl1_cs.c | 3 +--
drivers/bluetooth/hci_ldisc.c | 3 +--
drivers/bluetooth/hci_ll.c | 1 -
drivers/bluetooth/hci_vhci.c | 3 +--
include/net/bluetooth/hci_core.h | 2 +-
net/bluetooth/hci_core.c | 4 +---
15 files changed, 18 insertions(+), 32 deletions(-)
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index b7b5bb8..a675849 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -464,9 +464,8 @@ static int bfusb_close(struct hci_dev *hdev)
return 0;
}
-static int bfusb_send_frame(struct sk_buff *skb)
+static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct bfusb_data *data;
struct sk_buff *nskb;
unsigned char buf[3];
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 395acde..9194a1b 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -658,10 +658,9 @@ static int bluecard_hci_close(struct hci_dev *hdev)
}
-static int bluecard_hci_send_frame(struct sk_buff *skb)
+static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
bluecard_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
if (!hdev) {
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 3188fb4..b9e4e62 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -350,9 +350,8 @@ static int bpa10x_flush(struct hci_dev *hdev)
return 0;
}
-static int bpa10x_send_frame(struct sk_buff *skb)
+static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct bpa10x_data *data = hci_get_drvdata(hdev);
struct usb_ctrlrequest *dr;
struct urb *urb;
@@ -364,6 +363,8 @@ static int bpa10x_send_frame(struct sk_buff *skb)
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
+ skb->dev = (void *) hdev;
+
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb)
return -ENOMEM;
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index d8e4b0d..fcd5fe9 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -415,10 +415,9 @@ static int bt3c_hci_close(struct hci_dev *hdev)
}
-static int bt3c_hci_send_frame(struct sk_buff *skb)
+static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
bt3c_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
unsigned long flags;
if (!hdev) {
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 8ac4d93..547a447 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -187,7 +187,6 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 cmd_no,
bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT;
- skb->dev = (void *) priv->btmrvl_dev.hcidev;
skb_queue_head(&priv->adapter->tx_queue, skb);
priv->btmrvl_dev.sendcmdflag = true;
@@ -356,9 +355,8 @@ static void btmrvl_free_adapter(struct btmrvl_private *priv)
priv->adapter = NULL;
}
-static int btmrvl_send_frame(struct sk_buff *skb)
+static int btmrvl_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct btmrvl_private *priv = NULL;
BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len);
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c
index 72fe49e..b61440a 100644
--- a/drivers/bluetooth/btsdio.c
+++ b/drivers/bluetooth/btsdio.c
@@ -254,9 +254,8 @@ static int btsdio_flush(struct hci_dev *hdev)
return 0;
}
-static int btsdio_send_frame(struct sk_buff *skb)
+static int btsdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct btsdio_data *data = hci_get_drvdata(hdev);
BT_DBG("%s", hdev->name);
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index d0b89ec..f567cd8 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -423,10 +423,9 @@ static int btuart_hci_close(struct hci_dev *hdev)
}
-static int btuart_hci_send_frame(struct sk_buff *skb)
+static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
btuart_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
if (!hdev) {
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index faa429f..621069c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -716,9 +716,8 @@ static int btusb_flush(struct hci_dev *hdev)
return 0;
}
-static int btusb_send_frame(struct sk_buff *skb)
+static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct btusb_data *data = hci_get_drvdata(hdev);
struct usb_ctrlrequest *dr;
struct urb *urb;
@@ -730,6 +729,8 @@ static int btusb_send_frame(struct sk_buff *skb)
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
+ skb->dev = (void *) hdev;
+
switch (bt_cb(skb)->pkt_type) {
case HCI_COMMAND_PKT:
urb = usb_alloc_urb(0, GFP_ATOMIC);
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
index 5e10fb0..f038dba 100644
--- a/drivers/bluetooth/btwilink.c
+++ b/drivers/bluetooth/btwilink.c
@@ -251,14 +251,11 @@ static int ti_st_close(struct hci_dev *hdev)
return err;
}
-static int ti_st_send_frame(struct sk_buff *skb)
+static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev;
struct ti_st *hst;
long len;
- hdev = (struct hci_dev *)skb->dev;
-
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 2945141..ad1a2f9 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -382,10 +382,9 @@ static int dtl1_hci_close(struct hci_dev *hdev)
}
-static int dtl1_hci_send_frame(struct sk_buff *skb)
+static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
dtl1_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
struct sk_buff *s;
nsh_t nsh;
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index bc68a44..b040546 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -234,9 +234,8 @@ static int hci_uart_close(struct hci_dev *hdev)
}
/* Send frames from HCI layer */
-static int hci_uart_send_frame(struct sk_buff *skb)
+static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev* hdev = (struct hci_dev *) skb->dev;
struct hci_uart *hu;
if (!hdev) {
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 58a9541..69a90b1 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -110,7 +110,6 @@ static int send_hcill_cmd(u8 cmd, struct hci_uart *hu)
/* prepare packet */
hcill_packet = (struct hcill_cmd *) skb_put(skb, 1);
hcill_packet->cmd = cmd;
- skb->dev = (void *) hu->hdev;
/* send packet */
skb_queue_tail(&ll->txq, skb);
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 0fd522e..e6f5919 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -81,9 +81,8 @@ static int vhci_flush(struct hci_dev *hdev)
return 0;
}
-static int vhci_send_frame(struct sk_buff *skb)
+static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev* hdev = (struct hci_dev *) skb->dev;
struct vhci_data *data;
if (!hdev) {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 29b8147..0e01dc2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -285,7 +285,7 @@ struct hci_dev {
int (*close)(struct hci_dev *hdev);
int (*flush)(struct hci_dev *hdev);
int (*setup)(struct hci_dev *hdev);
- int (*send)(struct sk_buff *skb);
+ int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
void (*notify)(struct hci_dev *hdev, unsigned int evt);
};
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4f0d4b4..a097a62 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2713,9 +2713,7 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
/* Get rid of skb owner, prior to sending to the driver. */
skb_orphan(skb);
- skb->dev = (void *) hdev;
-
- if (hdev->send(skb) < 0)
+ if (hdev->send(hdev, skb) < 0)
BT_ERR("%s sending frame failed", hdev->name);
}
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Add hdev parameter to hdev->send driver callback
From: Johan Hedberg @ 2013-10-11 13:38 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381497558-6315-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Fri, Oct 11, 2013, Marcel Holtmann wrote:
> Instead of masking hdev inside the skb->dev parameter, hand it
> directly to the driver as a parameter to hdev->send. This makes
> the driver interface more clear and simpler.
>
> This patch fixes all drivers to accept and handle the new parameter
> of hdev->send callback. Special care has been taken for bpa10x
> and btusb drivers that require having skb->dev set to hdev for
> the URB transmit complete handlers.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> drivers/bluetooth/bfusb.c | 3 +--
> drivers/bluetooth/bluecard_cs.c | 3 +--
> drivers/bluetooth/bpa10x.c | 5 +++--
> drivers/bluetooth/bt3c_cs.c | 3 +--
> drivers/bluetooth/btmrvl_main.c | 4 +---
> drivers/bluetooth/btsdio.c | 3 +--
> drivers/bluetooth/btuart_cs.c | 3 +--
> drivers/bluetooth/btusb.c | 5 +++--
> drivers/bluetooth/btwilink.c | 5 +----
> drivers/bluetooth/dtl1_cs.c | 3 +--
> drivers/bluetooth/hci_ldisc.c | 3 +--
> drivers/bluetooth/hci_ll.c | 1 -
> drivers/bluetooth/hci_vhci.c | 3 +--
> include/net/bluetooth/hci_core.h | 2 +-
> net/bluetooth/hci_core.c | 4 +---
> 15 files changed, 18 insertions(+), 32 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Add hdev parameter to hdev->send driver callback
From: Marcel Holtmann @ 2013-10-11 13:19 UTC (permalink / raw)
To: linux-bluetooth
Instead of masking hdev inside the skb->dev parameter, hand it
directly to the driver as a parameter to hdev->send. This makes
the driver interface more clear and simpler.
This patch fixes all drivers to accept and handle the new parameter
of hdev->send callback. Special care has been taken for bpa10x
and btusb drivers that require having skb->dev set to hdev for
the URB transmit complete handlers.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
drivers/bluetooth/bfusb.c | 3 +--
drivers/bluetooth/bluecard_cs.c | 3 +--
drivers/bluetooth/bpa10x.c | 5 +++--
drivers/bluetooth/bt3c_cs.c | 3 +--
drivers/bluetooth/btmrvl_main.c | 4 +---
drivers/bluetooth/btsdio.c | 3 +--
drivers/bluetooth/btuart_cs.c | 3 +--
drivers/bluetooth/btusb.c | 5 +++--
drivers/bluetooth/btwilink.c | 5 +----
drivers/bluetooth/dtl1_cs.c | 3 +--
drivers/bluetooth/hci_ldisc.c | 3 +--
drivers/bluetooth/hci_ll.c | 1 -
drivers/bluetooth/hci_vhci.c | 3 +--
include/net/bluetooth/hci_core.h | 2 +-
net/bluetooth/hci_core.c | 4 +---
15 files changed, 18 insertions(+), 32 deletions(-)
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index b7b5bb8..a675849 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -464,9 +464,8 @@ static int bfusb_close(struct hci_dev *hdev)
return 0;
}
-static int bfusb_send_frame(struct sk_buff *skb)
+static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct bfusb_data *data;
struct sk_buff *nskb;
unsigned char buf[3];
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 395acde..9194a1b 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -658,10 +658,9 @@ static int bluecard_hci_close(struct hci_dev *hdev)
}
-static int bluecard_hci_send_frame(struct sk_buff *skb)
+static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
bluecard_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
if (!hdev) {
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 3188fb4..b9e4e62 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -350,9 +350,8 @@ static int bpa10x_flush(struct hci_dev *hdev)
return 0;
}
-static int bpa10x_send_frame(struct sk_buff *skb)
+static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct bpa10x_data *data = hci_get_drvdata(hdev);
struct usb_ctrlrequest *dr;
struct urb *urb;
@@ -364,6 +363,8 @@ static int bpa10x_send_frame(struct sk_buff *skb)
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
+ skb->dev = (void *) hdev;
+
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb)
return -ENOMEM;
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index d8e4b0d..fcd5fe9 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -415,10 +415,9 @@ static int bt3c_hci_close(struct hci_dev *hdev)
}
-static int bt3c_hci_send_frame(struct sk_buff *skb)
+static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
bt3c_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
unsigned long flags;
if (!hdev) {
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 8ac4d93..547a447 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -187,7 +187,6 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 cmd_no,
bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT;
- skb->dev = (void *) priv->btmrvl_dev.hcidev;
skb_queue_head(&priv->adapter->tx_queue, skb);
priv->btmrvl_dev.sendcmdflag = true;
@@ -356,9 +355,8 @@ static void btmrvl_free_adapter(struct btmrvl_private *priv)
priv->adapter = NULL;
}
-static int btmrvl_send_frame(struct sk_buff *skb)
+static int btmrvl_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct btmrvl_private *priv = NULL;
BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len);
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c
index 72fe49e..b61440a 100644
--- a/drivers/bluetooth/btsdio.c
+++ b/drivers/bluetooth/btsdio.c
@@ -254,9 +254,8 @@ static int btsdio_flush(struct hci_dev *hdev)
return 0;
}
-static int btsdio_send_frame(struct sk_buff *skb)
+static int btsdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct btsdio_data *data = hci_get_drvdata(hdev);
BT_DBG("%s", hdev->name);
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index d0b89ec..f567cd8 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -423,10 +423,9 @@ static int btuart_hci_close(struct hci_dev *hdev)
}
-static int btuart_hci_send_frame(struct sk_buff *skb)
+static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
btuart_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
if (!hdev) {
BT_ERR("Frame for unknown HCI device (hdev=NULL)");
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index faa429f..621069c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -716,9 +716,8 @@ static int btusb_flush(struct hci_dev *hdev)
return 0;
}
-static int btusb_send_frame(struct sk_buff *skb)
+static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev = (struct hci_dev *) skb->dev;
struct btusb_data *data = hci_get_drvdata(hdev);
struct usb_ctrlrequest *dr;
struct urb *urb;
@@ -730,6 +729,8 @@ static int btusb_send_frame(struct sk_buff *skb)
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
+ skb->dev = (void *) hdev;
+
switch (bt_cb(skb)->pkt_type) {
case HCI_COMMAND_PKT:
urb = usb_alloc_urb(0, GFP_ATOMIC);
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
index 5e10fb0..f038dba 100644
--- a/drivers/bluetooth/btwilink.c
+++ b/drivers/bluetooth/btwilink.c
@@ -251,14 +251,11 @@ static int ti_st_close(struct hci_dev *hdev)
return err;
}
-static int ti_st_send_frame(struct sk_buff *skb)
+static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev *hdev;
struct ti_st *hst;
long len;
- hdev = (struct hci_dev *)skb->dev;
-
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 2945141..ad1a2f9 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -382,10 +382,9 @@ static int dtl1_hci_close(struct hci_dev *hdev)
}
-static int dtl1_hci_send_frame(struct sk_buff *skb)
+static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
dtl1_info_t *info;
- struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
struct sk_buff *s;
nsh_t nsh;
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index bc68a44..b040546 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -234,9 +234,8 @@ static int hci_uart_close(struct hci_dev *hdev)
}
/* Send frames from HCI layer */
-static int hci_uart_send_frame(struct sk_buff *skb)
+static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev* hdev = (struct hci_dev *) skb->dev;
struct hci_uart *hu;
if (!hdev) {
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 58a9541..69a90b1 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -110,7 +110,6 @@ static int send_hcill_cmd(u8 cmd, struct hci_uart *hu)
/* prepare packet */
hcill_packet = (struct hcill_cmd *) skb_put(skb, 1);
hcill_packet->cmd = cmd;
- skb->dev = (void *) hu->hdev;
/* send packet */
skb_queue_tail(&ll->txq, skb);
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 0fd522e..e6f5919 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -81,9 +81,8 @@ static int vhci_flush(struct hci_dev *hdev)
return 0;
}
-static int vhci_send_frame(struct sk_buff *skb)
+static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
- struct hci_dev* hdev = (struct hci_dev *) skb->dev;
struct vhci_data *data;
if (!hdev) {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 29b8147..0e01dc2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -285,7 +285,7 @@ struct hci_dev {
int (*close)(struct hci_dev *hdev);
int (*flush)(struct hci_dev *hdev);
int (*setup)(struct hci_dev *hdev);
- int (*send)(struct sk_buff *skb);
+ int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
void (*notify)(struct hci_dev *hdev, unsigned int evt);
};
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4f0d4b4..a097a62 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2713,9 +2713,7 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
/* Get rid of skb owner, prior to sending to the driver. */
skb_orphan(skb);
- skb->dev = (void *) hdev;
-
- if (hdev->send(skb) < 0)
+ if (hdev->send(hdev, skb) < 0)
BT_ERR("%s sending frame failed", hdev->name);
}
--
1.8.3.1
^ permalink raw reply related
* Re: [RFC] Bluetooth: Set ISOC altsetting from within notify callback
From: Marcel Holtmann @ 2013-10-11 12:36 UTC (permalink / raw)
To: Timo Müller; +Cc: linux-bluetooth
In-Reply-To: <5257EB7A.7010407@timomueller.eu>
Hi Timo,
>> Since the event handling is done within a workqueue, the notify
>> callback can now sleep. So no need to trigger a separate workqueue
>> from within the Bluetooth USB driver.
>>
>> This should give a little bit better latency with the SCO packet
>> processing since the ISOC altsetting is correct from the beginning.
>>
>> However I am not sure if we can actually sleep in the USB reset
>> handler and what we need to do to restore the correct altsetting
>> in there. This could potentially fail, so please test ;)
>>
>> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
>> ---
>> drivers/bluetooth/btusb.c | 34 ++++++++++++++--------------------
>> 1 file changed, 14 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
>> index f3dfc0a..32cae73 100644
>> --- a/drivers/bluetooth/btusb.c
>> +++ b/drivers/bluetooth/btusb.c
>> @@ -245,7 +245,6 @@ struct btusb_data {
>>
>> unsigned long flags;
>>
>> - struct work_struct work;
>> struct work_struct waker;
>>
>> struct usb_anchor tx_anchor;
>> @@ -685,7 +684,6 @@ static int btusb_close(struct hci_dev *hdev)
>> if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
>> return 0;
>>
>> - cancel_work_sync(&data->work);
>> cancel_work_sync(&data->waker);
>>
>> clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
>> @@ -827,18 +825,6 @@ done:
>> return err;
>> }
>>
>> -static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
>> -{
>> - struct btusb_data *data = hci_get_drvdata(hdev);
>> -
>> - BT_DBG("%s evt %d", hdev->name, evt);
>> -
>> - if (hdev->conn_hash.sco_num != data->sco_num) {
>> - data->sco_num = hdev->conn_hash.sco_num;
>> - schedule_work(&data->work);
>> - }
>> -}
>> -
>> static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
>> {
>> struct btusb_data *data = hci_get_drvdata(hdev);
>> @@ -882,9 +868,8 @@ static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
>> return 0;
>> }
>>
>> -static void btusb_work(struct work_struct *work)
>> +static void btusb_update_isoc_altsetting(struct btusb_data *data)
>> {
>> - struct btusb_data *data = container_of(work, struct btusb_data, work);
>> struct hci_dev *hdev = data->hdev;
>> int new_alts;
>> int err;
>> @@ -932,6 +917,18 @@ static void btusb_work(struct work_struct *work)
>> }
>> }
>>
>> +static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
>> +{
>> + struct btusb_data *data = hci_get_drvdata(hdev);
>> +
>> + BT_DBG("%s evt %d", hdev->name, evt);
>> +
>> + if (hdev->conn_hash.sco_num != data->sco_num) {
>> + data->sco_num = hdev->conn_hash.sco_num;
>> + btusb_update_isoc_altsetting(data);
>> + }
>> +}
>> +
>> static void btusb_waker(struct work_struct *work)
>> {
>> struct btusb_data *data = container_of(work, struct btusb_data, waker);
>> @@ -1404,7 +1401,6 @@ static int btusb_probe(struct usb_interface *intf,
>>
>> spin_lock_init(&data->lock);
>>
>> - INIT_WORK(&data->work, btusb_work);
>> INIT_WORK(&data->waker, btusb_waker);
>> spin_lock_init(&data->txlock);
>>
>> @@ -1540,8 +1536,6 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
>> return -EBUSY;
>> }
>>
>> - cancel_work_sync(&data->work);
>> -
>> btusb_stop_traffic(data);
>> usb_kill_anchored_urbs(&data->tx_anchor);
>>
>> @@ -1606,8 +1600,8 @@ static int btusb_resume(struct usb_interface *intf)
>> play_deferred(data);
>> clear_bit(BTUSB_SUSPENDING, &data->flags);
>> spin_unlock_irq(&data->txlock);
>> - schedule_work(&data->work);
>>
>> + btusb_update_isoc_altsetting(data);
>> return 0;
>>
>> failed:
>>
>
> I have been testing this patch for the last two days at the UPF in Vienna. It was running fine most of the time, but I experienced two crashes. Both crashes appeared when there was an active call and the phone transferred audio to the phone and back. Both times I wasn't able to reproduce, when I restarted everything and tested again it worked fine.
>
> Unfortunately the kernel log is not complete but, when it failed the kernel reported:
> [147.344546] Bluetooth: hci0 SCO packet for unknown connection handle 5
> [147.354515] Bluetooth: hci0 SCO packet for unknown connection handle 21
> [147.354537] Bluetooth: hci0 SCO packet for unknown connection handle 29
> [147.354548] Bluetooth: hci0 SCO packet for unknown connection handle 65534
> [147.364574] Bluetooth: hci0 SCO packet for unknown connection handle 65532
> [147.364581] Bluetooth: hci0 SCO packet for unknown connection handle 27
> …
what kind of hardware where you testing with?
This handle mismatch normally means that our SCO packet frames are out of sync. I think we are not doing a good job trying to keep them nicely lined up.
For the crash, do you happen to have a backtrace of the crash. Personally I was worried about the reset handling and not the actual alternate setting switching.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH BlueZ 1/2] audio/AVCTP: Fix crash after disconnecting
From: Luiz Augusto von Dentz @ 2013-10-11 12:23 UTC (permalink / raw)
To: Luiz Augusto von Dentz, linux-bluetooth@vger.kernel.org
In-Reply-To: <20131011115840.GA7403@x220.p-661hnu-f1>
Hi Johan,
On Fri, Oct 11, 2013 at 2:58 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Luiz,
>
> On Fri, Oct 11, 2013, Luiz Augusto von Dentz wrote:
>> at 0x414C08: finalize_discovery (avdtp.c:1050)
>> by 0x414C5A: process_discover (avdtp.c:3346)
>> by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> by 0x40A3B6: main (main.c:595)
>> Address 0x5e25de8 is 1,144 bytes inside a block of size 1,176 free'd
>> at 0x4A074C4: free (in
>> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>> by 0x3D4604D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> by 0x4152F2: connection_lost (avdtp.c:1206)
>> by 0x4162C4: cancel_request (avdtp.c:2662)
>> by 0x4164BD: request_timeout (avdtp.c:2672)
>> by 0x3D46048962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> by 0x40A3B6: main (main.c:595)
>> ---
>> profiles/audio/avdtp.c | 42 +++++++++++++++++++++++++-----------------
>> 1 file changed, 25 insertions(+), 17 deletions(-)
>>
>> diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
>> index 622dff8..b938ee7 100644
>> --- a/profiles/audio/avdtp.c
>> +++ b/profiles/audio/avdtp.c
>> @@ -354,6 +354,12 @@ struct avdtp_state_callback {
>> void *user_data;
>> };
>>
>> +struct discover_callback {
>> + unsigned int id;
>> + avdtp_discover_cb_t cb;
>> + void *user_data;
>> +};
>> +
>> struct avdtp_stream {
>> GIOChannel *io;
>> uint16_t imtu;
>> @@ -412,9 +418,7 @@ struct avdtp {
>>
>> char *buf;
>>
>> - avdtp_discover_cb_t discov_cb;
>> - void *user_data;
>> -
>> + struct discover_callback *discover;
>> struct pending_req *req;
>
> It seems to me that this patch is doing two things:
>
> 1. Refactor the discov data out to a separate struct
> 2. Add an idle callback id for some extra tracking
>
> Shouldn't these be done in separate patches? Furthermore, I had to read
> through the patch several times to figure out exactly what the fix is -
> something I wouldn't have needed to do if there was a proper commit
> message explaining what was wrong and how you fix it.
Yep, it seems there is also a typo it should have been AVDTP not
AVCTP, anyway gonna split the patch one with a fix to cancel if
g_idle_add is pending when disconnected and a second to push the
discover data to a specific struct.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [RFC] Bluetooth: Set ISOC altsetting from within notify callback
From: Timo Müller @ 2013-10-11 12:13 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380952305-14104-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
Marcel Holtmann wrote, On 05.10.2013 07:51:
> Since the event handling is done within a workqueue, the notify
> callback can now sleep. So no need to trigger a separate workqueue
> from within the Bluetooth USB driver.
>
> This should give a little bit better latency with the SCO packet
> processing since the ISOC altsetting is correct from the beginning.
>
> However I am not sure if we can actually sleep in the USB reset
> handler and what we need to do to restore the correct altsetting
> in there. This could potentially fail, so please test ;)
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> drivers/bluetooth/btusb.c | 34 ++++++++++++++--------------------
> 1 file changed, 14 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index f3dfc0a..32cae73 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -245,7 +245,6 @@ struct btusb_data {
>
> unsigned long flags;
>
> - struct work_struct work;
> struct work_struct waker;
>
> struct usb_anchor tx_anchor;
> @@ -685,7 +684,6 @@ static int btusb_close(struct hci_dev *hdev)
> if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
> return 0;
>
> - cancel_work_sync(&data->work);
> cancel_work_sync(&data->waker);
>
> clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
> @@ -827,18 +825,6 @@ done:
> return err;
> }
>
> -static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
> -{
> - struct btusb_data *data = hci_get_drvdata(hdev);
> -
> - BT_DBG("%s evt %d", hdev->name, evt);
> -
> - if (hdev->conn_hash.sco_num != data->sco_num) {
> - data->sco_num = hdev->conn_hash.sco_num;
> - schedule_work(&data->work);
> - }
> -}
> -
> static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
> {
> struct btusb_data *data = hci_get_drvdata(hdev);
> @@ -882,9 +868,8 @@ static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
> return 0;
> }
>
> -static void btusb_work(struct work_struct *work)
> +static void btusb_update_isoc_altsetting(struct btusb_data *data)
> {
> - struct btusb_data *data = container_of(work, struct btusb_data, work);
> struct hci_dev *hdev = data->hdev;
> int new_alts;
> int err;
> @@ -932,6 +917,18 @@ static void btusb_work(struct work_struct *work)
> }
> }
>
> +static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
> +{
> + struct btusb_data *data = hci_get_drvdata(hdev);
> +
> + BT_DBG("%s evt %d", hdev->name, evt);
> +
> + if (hdev->conn_hash.sco_num != data->sco_num) {
> + data->sco_num = hdev->conn_hash.sco_num;
> + btusb_update_isoc_altsetting(data);
> + }
> +}
> +
> static void btusb_waker(struct work_struct *work)
> {
> struct btusb_data *data = container_of(work, struct btusb_data, waker);
> @@ -1404,7 +1401,6 @@ static int btusb_probe(struct usb_interface *intf,
>
> spin_lock_init(&data->lock);
>
> - INIT_WORK(&data->work, btusb_work);
> INIT_WORK(&data->waker, btusb_waker);
> spin_lock_init(&data->txlock);
>
> @@ -1540,8 +1536,6 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
> return -EBUSY;
> }
>
> - cancel_work_sync(&data->work);
> -
> btusb_stop_traffic(data);
> usb_kill_anchored_urbs(&data->tx_anchor);
>
> @@ -1606,8 +1600,8 @@ static int btusb_resume(struct usb_interface *intf)
> play_deferred(data);
> clear_bit(BTUSB_SUSPENDING, &data->flags);
> spin_unlock_irq(&data->txlock);
> - schedule_work(&data->work);
>
> + btusb_update_isoc_altsetting(data);
> return 0;
>
> failed:
>
I have been testing this patch for the last two days at the UPF in
Vienna. It was running fine most of the time, but I experienced two
crashes. Both crashes appeared when there was an active call and the
phone transferred audio to the phone and back. Both times I wasn't able
to reproduce, when I restarted everything and tested again it worked fine.
Unfortunately the kernel log is not complete but, when it failed the
kernel reported:
[147.344546] Bluetooth: hci0 SCO packet for unknown connection handle 5
[147.354515] Bluetooth: hci0 SCO packet for unknown connection handle 21
[147.354537] Bluetooth: hci0 SCO packet for unknown connection handle 29
[147.354548] Bluetooth: hci0 SCO packet for unknown connection handle 65534
[147.364574] Bluetooth: hci0 SCO packet for unknown connection handle 65532
[147.364581] Bluetooth: hci0 SCO packet for unknown connection handle 27
...
I have uploaded the following logs, I hope this helps:
hcidump: http://pastebin.com/aQh8ZAE7
bluez: http://pastebin.com/GUnyiHrA
ofono: http://pastebin.com/3AVg9BpP
pulseaudio: http://pastebin.com/zzGdzhNG
dbus-monitor: http://pastebin.com/jiWeaQ6j
incomplete syslog: http://pastebin.com/wRAXhHxD
Note that I've cleaned the logs from BT_MACs and telephone numbers.
Best regards
Timo
---
For completeness, this was my setup:
kernel: v3.12-rc3-65-gf927318
with the remaining patches from [RFC BlueZ v3 0/8] SSP MITM protection
bluez: 4.101
with backported bug fixes and ivi specific patches, see
https://github.com/bmwcarit/bluez
pulseaudio: 4.0
with few fixes from mastiz and demarchi
see https://github.com/bmwcarit/pulseaudio
ofono: 1.12
with backported fixes
Lucas De Marchi common: Fix parsing SS control string
Lucas De Marchi gitignore: Ignore file generated by Automake 1.13
Lucas De Marchi stk: Fix sizeof on memcpy
Lucas De Marchi gdbus: Use gcc builtin instead of g_atomic
Claudio Takahasi hfpmodem: Fix segfault in CIEV GAtChat callback
Mikel Astiz hfpmodem: Fix release-and-swap without +CIEV
Mikel Astiz hfpmodem: Avoid transitional voicecall states
Mikel Astiz hfpmodem: Refactor voicecall notify with foreach
Lucas De Marchi build: Use AM_CPPFLAGS instead of INCLUDES
Lucas De Marchi build: Do not use deprecated AM_CONFIG_HEADER
and my N9 quirks from [PATCHv4 0/8] Nokia N9 specific quirks (except
[PATCHv4 5/8] hfp_hf_bluez5: Pass vendor on voicecall creation)
^ permalink raw reply
* Re: [PATCH BlueZ 1/2] audio/AVCTP: Fix crash after disconnecting
From: Johan Hedberg @ 2013-10-11 11:58 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1381491762-25395-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Fri, Oct 11, 2013, Luiz Augusto von Dentz wrote:
> at 0x414C08: finalize_discovery (avdtp.c:1050)
> by 0x414C5A: process_discover (avdtp.c:3346)
> by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
> by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
> by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
> by 0x40A3B6: main (main.c:595)
> Address 0x5e25de8 is 1,144 bytes inside a block of size 1,176 free'd
> at 0x4A074C4: free (in
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x3D4604D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3)
> by 0x4152F2: connection_lost (avdtp.c:1206)
> by 0x4162C4: cancel_request (avdtp.c:2662)
> by 0x4164BD: request_timeout (avdtp.c:2672)
> by 0x3D46048962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
> by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
> by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
> by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
> by 0x40A3B6: main (main.c:595)
> ---
> profiles/audio/avdtp.c | 42 +++++++++++++++++++++++++-----------------
> 1 file changed, 25 insertions(+), 17 deletions(-)
>
> diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
> index 622dff8..b938ee7 100644
> --- a/profiles/audio/avdtp.c
> +++ b/profiles/audio/avdtp.c
> @@ -354,6 +354,12 @@ struct avdtp_state_callback {
> void *user_data;
> };
>
> +struct discover_callback {
> + unsigned int id;
> + avdtp_discover_cb_t cb;
> + void *user_data;
> +};
> +
> struct avdtp_stream {
> GIOChannel *io;
> uint16_t imtu;
> @@ -412,9 +418,7 @@ struct avdtp {
>
> char *buf;
>
> - avdtp_discover_cb_t discov_cb;
> - void *user_data;
> -
> + struct discover_callback *discover;
> struct pending_req *req;
It seems to me that this patch is doing two things:
1. Refactor the discov data out to a separate struct
2. Add an idle callback id for some extra tracking
Shouldn't these be done in separate patches? Furthermore, I had to read
through the patch several times to figure out exactly what the fix is -
something I wouldn't have needed to do if there was a proper commit
message explaining what was wrong and how you fix it.
Johan
^ permalink raw reply
* [PATCH BlueZ 3/3] tools/mpris-player: Forward player signals
From: Luiz Augusto von Dentz @ 2013-10-11 11:53 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1381492404-25765-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Forward signals received from player in the session bus to the system
bus where bluetoothd can catch them.
---
tools/mpris-player.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/tools/mpris-player.c b/tools/mpris-player.c
index 03b8875..c94330c 100644
--- a/tools/mpris-player.c
+++ b/tools/mpris-player.c
@@ -543,8 +543,8 @@ static void remove_player(DBusConnection *conn, const char *sender)
g_free(owner);
}
-static gboolean properties_changed(DBusConnection *conn,
- DBusMessage *msg, void *user_data)
+static gboolean player_signal(DBusConnection *conn, DBusMessage *msg,
+ void *user_data)
{
DBusMessage *signal;
DBusMessageIter iter, args;
@@ -558,17 +558,15 @@ static gboolean properties_changed(DBusConnection *conn,
if (owner == NULL)
goto done;
- signal = dbus_message_new_signal(path, DBUS_INTERFACE_PROPERTIES,
- "PropertiesChanged");
+ signal = dbus_message_new_signal(path, dbus_message_get_interface(msg),
+ dbus_message_get_member(msg));
if (signal == NULL) {
- fprintf(stderr, "Unable to allocate new %s.PropertisChanged"
- " signal", DBUS_INTERFACE_PROPERTIES);
+ fprintf(stderr, "Unable to allocate new %s.%s signal",
+ dbus_message_get_interface(msg),
+ dbus_message_get_member(msg));
goto done;
}
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
dbus_message_iter_init_append(signal, &args);
append_iter(&args, &iter);
@@ -2512,7 +2510,7 @@ int main(int argc, char *argv[])
{
GOptionContext *context;
GError *error = NULL;
- guint owner_watch, properties_watch;
+ guint owner_watch, properties_watch, signal_watch;
struct sigaction sa;
context = g_option_context_new(NULL);
@@ -2554,10 +2552,14 @@ int main(int argc, char *argv[])
name_owner_changed,
NULL, NULL);
-
properties_watch = g_dbus_add_properties_watch(session, NULL, NULL,
MPRIS_PLAYER_INTERFACE,
- properties_changed,
+ player_signal,
+ NULL, NULL);
+
+ signal_watch = g_dbus_add_signal_watch(session, NULL, NULL,
+ MPRIS_PLAYER_INTERFACE,
+ NULL, player_signal,
NULL, NULL);
memset(&sa, 0, sizeof(sa));
@@ -2578,6 +2580,7 @@ int main(int argc, char *argv[])
g_dbus_remove_watch(session, owner_watch);
g_dbus_remove_watch(session, properties_watch);
+ g_dbus_remove_watch(session, signal_watch);
g_dbus_client_unref(client);
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 2/3] audio/media: Send status changed if position changes
From: Luiz Augusto von Dentz @ 2013-10-11 11:53 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1381492404-25765-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If position changes send a status changed event to force the position to
be resynced.
---
profiles/audio/media.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 646c76a..0adc7c2 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1306,13 +1306,21 @@ static gboolean set_status(struct media_player *mp, DBusMessageIter *iter)
static gboolean set_position(struct media_player *mp, DBusMessageIter *iter)
{
uint64_t value;
+ const char *status;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INT64)
return FALSE;
dbus_message_iter_get_basic(iter, &value);
- mp->position = value / 1000;
+ value /= 1000;
+
+ if (value > get_position(mp))
+ status = "forward-seek";
+ else
+ status = "reverse-seek";
+
+ mp->position = value;
g_timer_start(mp->timer);
DBG("Position=%u", mp->position);
@@ -1327,9 +1335,14 @@ static gboolean set_position(struct media_player *mp, DBusMessageIter *iter)
* If position is the maximum value allowed or greater than track's
* duration, we send a track-reached-end event.
*/
- if (mp->position == UINT32_MAX || mp->position >= mp->duration)
+ if (mp->position == UINT32_MAX || mp->position >= mp->duration) {
avrcp_player_event(mp->player, AVRCP_EVENT_TRACK_REACHED_END,
NULL);
+ return TRUE;
+ }
+
+ /* Send a status change to force resync the position */
+ avrcp_player_event(mp->player, AVRCP_EVENT_STATUS_CHANGED, status);
return TRUE;
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 1/3] audio/media: Add support for tracking Seeked signal
From: Luiz Augusto von Dentz @ 2013-10-11 11:53 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This tracks Seeked signal and update the position in case it happens.
---
profiles/audio/media.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 9c72b8d..646c76a 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -96,6 +96,7 @@ struct media_player {
guint watch;
guint properties_watch;
guint track_watch;
+ guint seek_watch;
char *status;
uint32_t position;
uint32_t duration;
@@ -949,6 +950,7 @@ static void media_player_free(gpointer data)
g_dbus_remove_watch(conn, mp->watch);
g_dbus_remove_watch(conn, mp->properties_watch);
g_dbus_remove_watch(conn, mp->track_watch);
+ g_dbus_remove_watch(conn, mp->seek_watch);
if (mp->track)
g_hash_table_unref(mp->track);
@@ -1681,6 +1683,21 @@ static gboolean properties_changed(DBusConnection *connection, DBusMessage *msg,
return TRUE;
}
+static gboolean position_changed(DBusConnection *connection, DBusMessage *msg,
+ void *user_data)
+{
+ struct media_player *mp = user_data;
+ DBusMessageIter iter;
+
+ DBG("sender=%s path=%s", mp->sender, mp->path);
+
+ dbus_message_iter_init(msg, &iter);
+
+ set_position(mp, &iter);
+
+ return TRUE;
+}
+
static struct media_player *media_player_create(struct media_adapter *adapter,
const char *sender,
const char *path,
@@ -1702,6 +1719,10 @@ static struct media_player *media_player_create(struct media_adapter *adapter,
path, MEDIA_PLAYER_INTERFACE,
properties_changed,
mp, NULL);
+ mp->seek_watch = g_dbus_add_signal_watch(conn, sender,
+ path, MEDIA_PLAYER_INTERFACE,
+ "Seeked", position_changed,
+ mp, NULL);
mp->player = avrcp_register_player(adapter->btd_adapter, &player_cb,
mp, media_player_free);
if (!mp->player) {
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 2/2] obexd/session: Fix crash when transport is disconnected
From: Luiz Augusto von Dentz @ 2013-10-11 11:42 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1381491762-25395-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When transport is disconnected unexpectedly it can cause the following
crash:
gobex-DEBUG: gobex/gobex.c:g_obex_send_internal() The transport is not connected
Invalid read of size 8
at 0x42662E: session_process_queue (session.c:789)
by 0x42668F: session_process (session.c:719)
by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x40D5FC: main (main.c:319)
Address 0x5086760 is 32 bytes inside a block of size 56 free'd
at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x3D4604D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x426146: session_process_setpath (session.c:1063)
by 0x426629: session_process_queue (session.c:786)
by 0x42668F: session_process (session.c:719)
by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x40D5FC: main (main.c:319)
---
obexd/client/session.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/obexd/client/session.c b/obexd/client/session.c
index 67c2b83..8138b1e 100644
--- a/obexd/client/session.c
+++ b/obexd/client/session.c
@@ -296,6 +296,16 @@ done:
g_free(callback);
}
+static void session_disconnected(GObex *obex, GError *err, gpointer user_data)
+{
+ struct obc_session *session = user_data;
+
+ if (err)
+ error("%s", err->message);
+
+ obc_session_shutdown(session);
+}
+
static void transport_func(GIOChannel *io, GError *err, gpointer user_data)
{
struct callback_data *callback = user_data;
@@ -345,6 +355,8 @@ static void transport_func(GIOChannel *io, GError *err, gpointer user_data)
session->obex = obex;
sessions = g_slist_prepend(sessions, session);
+ g_obex_set_disconnect_function(obex, session_disconnected, session);
+
return;
done:
callback->func(callback->session, NULL, err, callback->data);
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 1/2] audio/AVCTP: Fix crash after disconnecting
From: Luiz Augusto von Dentz @ 2013-10-11 11:42 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
at 0x414C08: finalize_discovery (avdtp.c:1050)
by 0x414C5A: process_discover (avdtp.c:3346)
by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x40A3B6: main (main.c:595)
Address 0x5e25de8 is 1,144 bytes inside a block of size 1,176 free'd
at 0x4A074C4: free (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x3D4604D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x4152F2: connection_lost (avdtp.c:1206)
by 0x4162C4: cancel_request (avdtp.c:2662)
by 0x4164BD: request_timeout (avdtp.c:2672)
by 0x3D46048962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
by 0x40A3B6: main (main.c:595)
---
profiles/audio/avdtp.c | 42 +++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 622dff8..b938ee7 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -354,6 +354,12 @@ struct avdtp_state_callback {
void *user_data;
};
+struct discover_callback {
+ unsigned int id;
+ avdtp_discover_cb_t cb;
+ void *user_data;
+};
+
struct avdtp_stream {
GIOChannel *io;
uint16_t imtu;
@@ -412,9 +418,7 @@ struct avdtp {
char *buf;
- avdtp_discover_cb_t discov_cb;
- void *user_data;
-
+ struct discover_callback *discover;
struct pending_req *req;
guint dc_timer;
@@ -1041,19 +1045,21 @@ static void avdtp_sep_set_state(struct avdtp *session,
static void finalize_discovery(struct avdtp *session, int err)
{
+ struct discover_callback *discover = session->discover;
struct avdtp_error avdtp_err;
- avdtp_error_init(&avdtp_err, AVDTP_ERRNO, err);
-
- if (!session->discov_cb)
+ if (!discover)
return;
- session->discov_cb(session, session->seps,
- err ? &avdtp_err : NULL,
- session->user_data);
+ avdtp_error_init(&avdtp_err, AVDTP_ERRNO, err);
- session->discov_cb = NULL;
- session->user_data = NULL;
+ if (discover->id > 0)
+ g_source_remove(discover->id);
+
+ discover->cb(session, session->seps, err ? &avdtp_err : NULL,
+ discover->user_data);
+ g_free(discover);
+ session->discover = NULL;
}
static void release_stream(struct avdtp_stream *stream, struct avdtp *session)
@@ -3332,20 +3338,22 @@ int avdtp_discover(struct avdtp *session, avdtp_discover_cb_t cb,
{
int err;
- if (session->discov_cb)
+ if (session->discover)
return -EBUSY;
+ session->discover = g_new0(struct discover_callback, 1);
+
if (session->seps) {
- session->discov_cb = cb;
- session->user_data = user_data;
- g_idle_add(process_discover, session);
+ session->discover->cb = cb;
+ session->discover->user_data = user_data;
+ session->discover->id = g_idle_add(process_discover, session);
return 0;
}
err = send_request(session, FALSE, NULL, AVDTP_DISCOVER, NULL, 0);
if (err == 0) {
- session->discov_cb = cb;
- session->user_data = user_data;
+ session->discover->cb = cb;
+ session->discover->user_data = user_data;
}
return err;
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Add device/intel repository
From: Andrei Emeltchenko @ 2013-10-11 10:37 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
In device/intel we need to disable blacklisting bluetooth kernel modules.
Change-Id: I84a742ad75035bf5d3238cd632fe875aa5f97143
---
topics/local_manifest.xml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/topics/local_manifest.xml b/topics/local_manifest.xml
index 360f5f5..3ad60c4 100644
--- a/topics/local_manifest.xml
+++ b/topics/local_manifest.xml
@@ -19,4 +19,8 @@
<project path="bionic" name="android-bluez.bionic"
remote="android-bluez" revision="master" />
+ <remove-project name="device/intel" />
+ <project path="device/intel" name="android-bluez.device-intel"
+ remote="android-bluez" revision="master" />
+
</manifest>
--
1.7.10.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox