* [PATCH] Bluetooth: hci_uart: Fix speed selection
@ 2015-06-18 10:43 Frederic Danis
2015-06-18 11:48 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: Frederic Danis @ 2015-06-18 10:43 UTC (permalink / raw)
To: linux-bluetooth
hu->proto->*speed will always be used for all device where it is set.
But hu->*speed should be used if exist, so the test should be swapped.
The equivalent change is needed in bcm_setup() of hci_bcm.c.
Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
---
drivers/bluetooth/hci_bcm.c | 29 +++++++++++++++++++++++------
drivers/bluetooth/hci_ldisc.c | 12 ++++++------
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index aa3c9ac..23523e1 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -131,6 +131,7 @@ static int bcm_setup(struct hci_uart *hu)
{
char fw_name[64];
const struct firmware *fw;
+ unsigned int speed;
int err;
BT_DBG("hu %p", hu);
@@ -153,13 +154,29 @@ static int bcm_setup(struct hci_uart *hu)
goto finalize;
}
- if (hu->proto->init_speed)
- hci_uart_set_baudrate(hu, hu->proto->init_speed);
-
- if (hu->proto->oper_speed) {
- err = bcm_set_baudrate(hu, hu->proto->oper_speed);
+ /* Init speed if any */
+ if (hu->init_speed)
+ speed = hu->init_speed;
+ else if (hu->proto->init_speed)
+ speed = hu->proto->init_speed;
+ else
+ speed = 0;
+
+ if (speed)
+ hci_uart_set_baudrate(hu, speed);
+
+ /* Operational speed if any */
+ if (hu->oper_speed)
+ speed = hu->oper_speed;
+ else if (hu->proto->oper_speed)
+ speed = hu->proto->oper_speed;
+ else
+ speed = 0;
+
+ if (speed) {
+ err = bcm_set_baudrate(hu, speed);
if (!err)
- hci_uart_set_baudrate(hu, hu->proto->oper_speed);
+ hci_uart_set_baudrate(hu, speed);
}
finalize:
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 590bd8e..177dd69 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -370,10 +370,10 @@ static int hci_uart_setup(struct hci_dev *hdev)
int err;
/* Init speed if any */
- if (hu->proto->init_speed)
- speed = hu->proto->init_speed;
- else if (hu->init_speed)
+ if (hu->init_speed)
speed = hu->init_speed;
+ else if (hu->proto->init_speed)
+ speed = hu->proto->init_speed;
else
speed = 0;
@@ -381,10 +381,10 @@ static int hci_uart_setup(struct hci_dev *hdev)
hci_uart_set_baudrate(hu, speed);
/* Operational speed if any */
- if (hu->proto->oper_speed)
- speed = hu->proto->oper_speed;
- else if (hu->oper_speed)
+ if (hu->oper_speed)
speed = hu->oper_speed;
+ else if (hu->proto->oper_speed)
+ speed = hu->proto->oper_speed;
else
speed = 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: hci_uart: Fix speed selection
2015-06-18 10:43 [PATCH] Bluetooth: hci_uart: Fix speed selection Frederic Danis
@ 2015-06-18 11:48 ` Marcel Holtmann
2015-06-18 12:14 ` Ilya Faenson
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2015-06-18 11:48 UTC (permalink / raw)
To: Frederic Danis; +Cc: linux-bluetooth
Hi Fred,
> hu->proto->*speed will always be used for all device where it is set.
> But hu->*speed should be used if exist, so the test should be swapped.
>
> The equivalent change is needed in bcm_setup() of hci_bcm.c.
>
> Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
> ---
> drivers/bluetooth/hci_bcm.c | 29 +++++++++++++++++++++++------
> drivers/bluetooth/hci_ldisc.c | 12 ++++++------
> 2 files changed, 29 insertions(+), 12 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] Bluetooth: hci_uart: Fix speed selection
2015-06-18 11:48 ` Marcel Holtmann
@ 2015-06-18 12:14 ` Ilya Faenson
0 siblings, 0 replies; 3+ messages in thread
From: Ilya Faenson @ 2015-06-18 12:14 UTC (permalink / raw)
To: Marcel Holtmann, Frederic Danis; +Cc: linux-bluetooth
Hi Marcel and Fred,
-----Original Message-----
From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-owner@v=
ger.kernel.org] On Behalf Of Marcel Holtmann
Sent: Thursday, June 18, 2015 7:49 AM
To: Frederic Danis
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_uart: Fix speed selection
Hi Fred,
> hu->proto->*speed will always be used for all device where it is set.
> But hu->*speed should be used if exist, so the test should be swapped.
>=20
> The equivalent change is needed in bcm_setup() of hci_bcm.c.
>=20
> Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
> ---
> drivers/bluetooth/hci_bcm.c | 29 +++++++++++++++++++++++------
> drivers/bluetooth/hci_ldisc.c | 12 ++++++------
> 2 files changed, 29 insertions(+), 12 deletions(-)
patch has been applied to bluetooth-next tree.
IF: I've just checked the latest hci_ldisc.c speed selection logic against =
what I submitted yesterday. They are functionally the same so you have my b=
lessing if you need it. :-) Still, having speed configuration in two places=
is obviously an invitation to some confusion.
Regards
Marcel
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-18 12:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 10:43 [PATCH] Bluetooth: hci_uart: Fix speed selection Frederic Danis
2015-06-18 11:48 ` Marcel Holtmann
2015-06-18 12:14 ` Ilya Faenson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.