2019-03-12 20:44:09

by Matthias Kaehlcke

[permalink] [raw]
Subject: [PATCH v2 1/2] Bluetooth: hci_qca: Rename STATE_<flags> to QCA_<flags>

Rename STATE_IN_BAND_SLEEP_ENABLED to QCA_IN_BAND_SLEEP_ENABLED.
The constant represents a flag (multiple flags can be set at once),
not a unique state of the controller or driver.

Also make the flag an enum value instead of a pre-processor constant
(more flags will be added to the enum group by another patch).

Signed-off-by: Matthias Kaehlcke <[email protected]>
---
Changes in v2:
- don't use BIT()
- change to enum type
- updated commit message
---
drivers/bluetooth/hci_qca.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 237aea34b69f..1b7ba9e9e08a 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -54,9 +54,6 @@
#define HCI_IBS_WAKE_ACK 0xFC
#define HCI_MAX_IBS_SIZE 10

-/* Controller states */
-#define STATE_IN_BAND_SLEEP_ENABLED 1
-
#define IBS_WAKE_RETRANS_TIMEOUT_MS 100
#define IBS_TX_IDLE_TIMEOUT_MS 2000
#define CMD_TRANS_TIMEOUT_MS 100
@@ -67,6 +64,10 @@
/* Controller debug log header */
#define QCA_DEBUG_HANDLE 0x2EDC

+enum qca_flags {
+ QCA_IN_BAND_SLEEP_ENABLED,
+};
+
/* HCI_IBS transmit side sleep protocol states */
enum tx_ibs_states {
HCI_IBS_TX_ASLEEP,
@@ -775,7 +776,7 @@ static int qca_enqueue(struct hci_uart *hu, struct
sk_buff *skb)
/* Don't go to sleep in middle of patch download or
* Out-Of-Band(GPIOs control) sleep is selected.
*/
- if (!test_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags)) {
+ if (!test_bit(QCA_IN_BAND_SLEEP_ENABLED, &qca->flags)) {
skb_queue_tail(&qca->txq, skb);
spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);
return 0;
@@ -1192,7 +1193,7 @@ static int qca_setup(struct hci_uart *hu)
return ret;

/* Patch downloading has to be done without IBS mode */
- clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
+ clear_bit(QCA_IN_BAND_SLEEP_ENABLED, &qca->flags);

if (qcadev->btsoc_type == QCA_WCN3990) {
bt_dev_info(hdev, "setting up wcn3990");
@@ -1236,7 +1237,7 @@ static int qca_setup(struct hci_uart *hu)
/* Setup patch / NVM configurations */
ret = qca_uart_setup(hdev, qca_baudrate, qcadev->btsoc_type, soc_ver);
if (!ret) {
- set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
+ set_bit(QCA_IN_BAND_SLEEP_ENABLED, &qca->flags);
qca_debugfs_init(hdev);
} else if (ret == -ENOENT) {
/* No patch/nvm-config found, run with original fw/config */
@@ -1294,7 +1295,7 @@ static void qca_power_shutdown(struct hci_uart *hu)
* data in skb's.
*/
spin_lock_irqsave(&qca->hci_ibs_lock, flags);
- clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
+ clear_bit(QCA_IN_BAND_SLEEP_ENABLED, &qca->flags);
qca_flush(hu);
spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);

--
2.21.0.360.g471c308f928-goog


2019-04-01 07:47:35

by Balakrishna Godavarthi

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] Bluetooth: hci_qca: Rename STATE_<flags> to QCA_<flags>

Hi Matthias,

On 2019-03-13 02:12, Matthias Kaehlcke wrote:
> Rename STATE_IN_BAND_SLEEP_ENABLED to QCA_IN_BAND_SLEEP_ENABLED.
> The constant represents a flag (multiple flags can be set at once),
> not a unique state of the controller or driver.
>
> Also make the flag an enum value instead of a pre-processor constant
> (more flags will be added to the enum group by another patch).
>
> Signed-off-by: Matthias Kaehlcke <[email protected]>
> ---
> Changes in v2:
> - don't use BIT()
> - change to enum type
> - updated commit message
> ---
> drivers/bluetooth/hci_qca.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 237aea34b69f..1b7ba9e9e08a 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -54,9 +54,6 @@
> #define HCI_IBS_WAKE_ACK 0xFC
> #define HCI_MAX_IBS_SIZE 10
>
> -/* Controller states */
> -#define STATE_IN_BAND_SLEEP_ENABLED 1
> -
> #define IBS_WAKE_RETRANS_TIMEOUT_MS 100
> #define IBS_TX_IDLE_TIMEOUT_MS 2000
> #define CMD_TRANS_TIMEOUT_MS 100
> @@ -67,6 +64,10 @@
> /* Controller debug log header */
> #define QCA_DEBUG_HANDLE 0x2EDC
>
> +enum qca_flags {
> + QCA_IN_BAND_SLEEP_ENABLED,
> +};
> +

[Bala]: I would recommend to go with QCA_IBS_ENABLED as IBS is
abbreviated as In band sleep.

> /* HCI_IBS transmit side sleep protocol states */
> enum tx_ibs_states {
> HCI_IBS_TX_ASLEEP,
> @@ -775,7 +776,7 @@ static int qca_enqueue(struct hci_uart *hu, struct
> sk_buff *skb)
> /* Don't go to sleep in middle of patch download or
> * Out-Of-Band(GPIOs control) sleep is selected.
> */
> - if (!test_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags)) {
> + if (!test_bit(QCA_IN_BAND_SLEEP_ENABLED, &qca->flags)) {
> skb_queue_tail(&qca->txq, skb);
> spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);
> return 0;
> @@ -1192,7 +1193,7 @@ static int qca_setup(struct hci_uart *hu)
> return ret;
>
> /* Patch downloading has to be done without IBS mode */
> - clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
> + clear_bit(QCA_IN_BAND_SLEEP_ENABLED, &qca->flags);
>
> if (qcadev->btsoc_type == QCA_WCN3990) {
> bt_dev_info(hdev, "setting up wcn3990");
> @@ -1236,7 +1237,7 @@ static int qca_setup(struct hci_uart *hu)
> /* Setup patch / NVM configurations */
> ret = qca_uart_setup(hdev, qca_baudrate, qcadev->btsoc_type,
> soc_ver);
> if (!ret) {
> - set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
> + set_bit(QCA_IN_BAND_SLEEP_ENABLED, &qca->flags);
> qca_debugfs_init(hdev);
> } else if (ret == -ENOENT) {
> /* No patch/nvm-config found, run with original fw/config */
> @@ -1294,7 +1295,7 @@ static void qca_power_shutdown(struct hci_uart
> *hu)
> * data in skb's.
> */
> spin_lock_irqsave(&qca->hci_ibs_lock, flags);
> - clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
> + clear_bit(QCA_IN_BAND_SLEEP_ENABLED, &qca->flags);
> qca_flush(hu);
> spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);

--
Regards
Balakrishna.

2019-04-01 21:32:24

by Matthias Kaehlcke

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] Bluetooth: hci_qca: Rename STATE_<flags> to QCA_<flags>

On Mon, Apr 01, 2019 at 01:16:07PM +0530, Balakrishna Godavarthi wrote:
> Hi Matthias,
>
> On 2019-03-13 02:12, Matthias Kaehlcke wrote:
> > Rename STATE_IN_BAND_SLEEP_ENABLED to QCA_IN_BAND_SLEEP_ENABLED.
> > The constant represents a flag (multiple flags can be set at once),
> > not a unique state of the controller or driver.
> >
> > Also make the flag an enum value instead of a pre-processor constant
> > (more flags will be added to the enum group by another patch).
> >
> > Signed-off-by: Matthias Kaehlcke <[email protected]>
> > ---
> > Changes in v2:
> > - don't use BIT()
> > - change to enum type
> > - updated commit message
> > ---
> > drivers/bluetooth/hci_qca.c | 15 ++++++++-------
> > 1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> > index 237aea34b69f..1b7ba9e9e08a 100644
> > --- a/drivers/bluetooth/hci_qca.c
> > +++ b/drivers/bluetooth/hci_qca.c
> > @@ -54,9 +54,6 @@
> > #define HCI_IBS_WAKE_ACK 0xFC
> > #define HCI_MAX_IBS_SIZE 10
> >
> > -/* Controller states */
> > -#define STATE_IN_BAND_SLEEP_ENABLED 1
> > -
> > #define IBS_WAKE_RETRANS_TIMEOUT_MS 100
> > #define IBS_TX_IDLE_TIMEOUT_MS 2000
> > #define CMD_TRANS_TIMEOUT_MS 100
> > @@ -67,6 +64,10 @@
> > /* Controller debug log header */
> > #define QCA_DEBUG_HANDLE 0x2EDC
> >
> > +enum qca_flags {
> > + QCA_IN_BAND_SLEEP_ENABLED,
> > +};
> > +
>
> [Bala]: I would recommend to go with QCA_IBS_ENABLED as IBS is abbreviated
> as In band sleep.

Sounds good, thanks for the suggestion!