Commit 6cfeba4f authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Marcel Holtmann

[Bluetooth] Replace schedule_timeout() with msleep()

Use msleep() instead of schedule_timeout() to guarantee the task
delays at least the desired time amount.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 94ae4fb0
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/delay.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
...@@ -776,8 +777,7 @@ int bluecard_open(bluecard_info_t *info) ...@@ -776,8 +777,7 @@ int bluecard_open(bluecard_info_t *info)
outb(0x80, iobase + 0x30); outb(0x80, iobase + 0x30);
/* Wait some time */ /* Wait some time */
set_current_state(TASK_INTERRUPTIBLE); msleep(10);
schedule_timeout(HZ / 100);
/* Turn FPGA on */ /* Turn FPGA on */
outb(0x00, iobase + 0x30); outb(0x00, iobase + 0x30);
...@@ -823,8 +823,7 @@ int bluecard_open(bluecard_info_t *info) ...@@ -823,8 +823,7 @@ int bluecard_open(bluecard_info_t *info)
outb((0x0f << RTS_LEVEL_SHIFT_BITS) | 1, iobase + REG_RX_CONTROL); outb((0x0f << RTS_LEVEL_SHIFT_BITS) | 1, iobase + REG_RX_CONTROL);
/* Timeout before it is safe to send the first HCI packet */ /* Timeout before it is safe to send the first HCI packet */
set_current_state(TASK_INTERRUPTIBLE); msleep(1250);
schedule_timeout((HZ * 5) / 4); // or set it to 3/2
/* Register HCI device */ /* Register HCI device */
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
......
...@@ -25,12 +25,11 @@ ...@@ -25,12 +25,11 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/delay.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/ioport.h> #include <linux/ioport.h>
...@@ -639,8 +638,7 @@ int bt3c_open(bt3c_info_t *info) ...@@ -639,8 +638,7 @@ int bt3c_open(bt3c_info_t *info)
} }
/* Timeout before it is safe to send the first HCI packet */ /* Timeout before it is safe to send the first HCI packet */
set_current_state(TASK_INTERRUPTIBLE); msleep(1000);
schedule_timeout(HZ);
/* Register HCI device */ /* Register HCI device */
err = hci_register_dev(hdev); err = hci_register_dev(hdev);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/delay.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/ioport.h> #include <linux/ioport.h>
...@@ -545,8 +546,7 @@ int btuart_open(btuart_info_t *info) ...@@ -545,8 +546,7 @@ int btuart_open(btuart_info_t *info)
btuart_change_speed(info, DEFAULT_BAUD_RATE); btuart_change_speed(info, DEFAULT_BAUD_RATE);
/* Timeout before it is safe to send the first HCI packet */ /* Timeout before it is safe to send the first HCI packet */
set_current_state(TASK_INTERRUPTIBLE); msleep(1000);
schedule_timeout(HZ);
/* Register HCI device */ /* Register HCI device */
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/delay.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/ioport.h> #include <linux/ioport.h>
...@@ -524,8 +525,7 @@ int dtl1_open(dtl1_info_t *info) ...@@ -524,8 +525,7 @@ int dtl1_open(dtl1_info_t *info)
spin_unlock_irqrestore(&(info->lock), flags); spin_unlock_irqrestore(&(info->lock), flags);
/* Timeout before it is safe to send the first HCI packet */ /* Timeout before it is safe to send the first HCI packet */
set_current_state(TASK_INTERRUPTIBLE); msleep(2000);
schedule_timeout(HZ * 2);
/* Register HCI device */ /* Register HCI device */
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
......
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