diff mbox

Bluetooth: hci_qca: Replace open-coded msleep()

Message ID 20180626170654.96831-1-swboyd@chromium.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Stephen Boyd June 26, 2018, 5:06 p.m. UTC
These three lines make up what msleep() already does, i.e. setting the
task to uninterruptible, sleeping for so many jiffies, and then
schedule() already puts the task state back to TASK_RUNNING when it
returns. Make things clearer by just calling msleep() instead.

Cc: Thierry Escande <thierry.escande@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/bluetooth/hci_qca.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Matthias Kaehlcke June 26, 2018, 8:49 p.m. UTC | #1
On Tue, Jun 26, 2018 at 10:06:54AM -0700, Stephen Boyd wrote:
> These three lines make up what msleep() already does, i.e. setting the
> task to uninterruptible, sleeping for so many jiffies, and then
> schedule() already puts the task state back to TASK_RUNNING when it
> returns. Make things clearer by just calling msleep() instead.
> 
> Cc: Thierry Escande <thierry.escande@linaro.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Reviewed-off-by: Matthias Kaehlcke <mka@chromium.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd Sept. 28, 2018, 4:10 p.m. UTC | #2
Quoting Stephen Boyd (2018-06-26 10:06:54)
> These three lines make up what msleep() already does, i.e. setting the
> task to uninterruptible, sleeping for so many jiffies, and then
> schedule() already puts the task state back to TASK_RUNNING when it
> returns. Make things clearer by just calling msleep() instead.
> 
> Cc: Thierry Escande <thierry.escande@linaro.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---

Marcel, can you pick this patch up?

>  drivers/bluetooth/hci_qca.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 51790dd02afb..ef2b00bdf06d 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -908,9 +908,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
>          * controller will come back after they receive this HCI command
>          * then host can communicate with new baudrate to controller
>          */
> -       set_current_state(TASK_UNINTERRUPTIBLE);
> -       schedule_timeout(msecs_to_jiffies(BAUDRATE_SETTLE_TIMEOUT_MS));
> -       set_current_state(TASK_RUNNING);
> +       msleep(BAUDRATE_SETTLE_TIMEOUT_MS);
>  
>         return 0;
>  }
Marcel Holtmann Sept. 28, 2018, 5:20 p.m. UTC | #3
Hi Stephen,

>> These three lines make up what msleep() already does, i.e. setting the
>> task to uninterruptible, sleeping for so many jiffies, and then
>> schedule() already puts the task state back to TASK_RUNNING when it
>> returns. Make things clearer by just calling msleep() instead.
>> 
>> Cc: Thierry Escande <thierry.escande@linaro.org>
>> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
>> ---
> 
> Marcel, can you pick this patch up?

I would do that, but unfortunately it does apply against bluetooth-next tree.

Regards

Marcel
diff mbox

Patch

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 51790dd02afb..ef2b00bdf06d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -908,9 +908,7 @@  static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
 	 * controller will come back after they receive this HCI command
 	 * then host can communicate with new baudrate to controller
 	 */
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(BAUDRATE_SETTLE_TIMEOUT_MS));
-	set_current_state(TASK_RUNNING);
+	msleep(BAUDRATE_SETTLE_TIMEOUT_MS);
 
 	return 0;
 }