mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 18:11:20 +00:00
Bluetooth: hci_uart: Fix speed selection
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> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
2a973dfada
commit
960ef1d72f
2 changed files with 28 additions and 11 deletions
|
@ -131,6 +131,7 @@ static int bcm_setup(struct hci_uart *hu)
|
||||||
{
|
{
|
||||||
char fw_name[64];
|
char fw_name[64];
|
||||||
const struct firmware *fw;
|
const struct firmware *fw;
|
||||||
|
unsigned int speed;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
BT_DBG("hu %p", hu);
|
BT_DBG("hu %p", hu);
|
||||||
|
@ -153,13 +154,29 @@ static int bcm_setup(struct hci_uart *hu)
|
||||||
goto finalize;
|
goto finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hu->proto->init_speed)
|
/* Init speed if any */
|
||||||
hci_uart_set_baudrate(hu, hu->proto->init_speed);
|
if (hu->init_speed)
|
||||||
|
speed = hu->init_speed;
|
||||||
|
else if (hu->proto->init_speed)
|
||||||
|
speed = hu->proto->init_speed;
|
||||||
|
else
|
||||||
|
speed = 0;
|
||||||
|
|
||||||
if (hu->proto->oper_speed) {
|
if (speed)
|
||||||
err = bcm_set_baudrate(hu, hu->proto->oper_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)
|
if (!err)
|
||||||
hci_uart_set_baudrate(hu, hu->proto->oper_speed);
|
hci_uart_set_baudrate(hu, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
finalize:
|
finalize:
|
||||||
|
|
|
@ -370,10 +370,10 @@ static int hci_uart_setup(struct hci_dev *hdev)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* Init speed if any */
|
/* Init speed if any */
|
||||||
if (hu->proto->init_speed)
|
if (hu->init_speed)
|
||||||
speed = hu->proto->init_speed;
|
|
||||||
else if (hu->init_speed)
|
|
||||||
speed = hu->init_speed;
|
speed = hu->init_speed;
|
||||||
|
else if (hu->proto->init_speed)
|
||||||
|
speed = hu->proto->init_speed;
|
||||||
else
|
else
|
||||||
speed = 0;
|
speed = 0;
|
||||||
|
|
||||||
|
@ -381,10 +381,10 @@ static int hci_uart_setup(struct hci_dev *hdev)
|
||||||
hci_uart_set_baudrate(hu, speed);
|
hci_uart_set_baudrate(hu, speed);
|
||||||
|
|
||||||
/* Operational speed if any */
|
/* Operational speed if any */
|
||||||
if (hu->proto->oper_speed)
|
if (hu->oper_speed)
|
||||||
speed = hu->proto->oper_speed;
|
|
||||||
else if (hu->oper_speed)
|
|
||||||
speed = hu->oper_speed;
|
speed = hu->oper_speed;
|
||||||
|
else if (hu->proto->oper_speed)
|
||||||
|
speed = hu->proto->oper_speed;
|
||||||
else
|
else
|
||||||
speed = 0;
|
speed = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue