Commit 7310dd3f authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Marcel Holtmann

Bluetooth: hci_qca: Simplify determination of serial clock on/off state from votes

The serial clocks should be on when there is a vote for at least one
of the clocks (RX or TX), and off when there is no 'on' vote. The
current logic to determine the combined state is a bit redundant
in the code paths for different types of votes, use a single
statement in the common path instead.
Signed-off-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 4c07a5d7
...@@ -289,25 +289,21 @@ static void serial_clock_vote(unsigned long vote, struct hci_uart *hu) ...@@ -289,25 +289,21 @@ static void serial_clock_vote(unsigned long vote, struct hci_uart *hu)
case HCI_IBS_TX_VOTE_CLOCK_ON: case HCI_IBS_TX_VOTE_CLOCK_ON:
qca->tx_vote = true; qca->tx_vote = true;
qca->tx_votes_on++; qca->tx_votes_on++;
new_vote = true;
break; break;
case HCI_IBS_RX_VOTE_CLOCK_ON: case HCI_IBS_RX_VOTE_CLOCK_ON:
qca->rx_vote = true; qca->rx_vote = true;
qca->rx_votes_on++; qca->rx_votes_on++;
new_vote = true;
break; break;
case HCI_IBS_TX_VOTE_CLOCK_OFF: case HCI_IBS_TX_VOTE_CLOCK_OFF:
qca->tx_vote = false; qca->tx_vote = false;
qca->tx_votes_off++; qca->tx_votes_off++;
new_vote = qca->rx_vote | qca->tx_vote;
break; break;
case HCI_IBS_RX_VOTE_CLOCK_OFF: case HCI_IBS_RX_VOTE_CLOCK_OFF:
qca->rx_vote = false; qca->rx_vote = false;
qca->rx_votes_off++; qca->rx_votes_off++;
new_vote = qca->rx_vote | qca->tx_vote;
break; break;
default: default:
...@@ -315,6 +311,8 @@ static void serial_clock_vote(unsigned long vote, struct hci_uart *hu) ...@@ -315,6 +311,8 @@ static void serial_clock_vote(unsigned long vote, struct hci_uart *hu)
return; return;
} }
new_vote = qca->rx_vote | qca->tx_vote;
if (new_vote != old_vote) { if (new_vote != old_vote) {
if (new_vote) if (new_vote)
__serial_clock_on(hu->tty); __serial_clock_on(hu->tty);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment