From 0bdb080c70495ea4efbed7661b4fe6100bd5adde Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Thu, 21 Feb 2019 10:23:08 +0100 Subject: Revert "backports: Remove unused parts" This reverts commit ab3fd3b9a801a9faa2619e2e65207e736f859a6d. --- .../0053-remove_wait_on_bit_timeout/btusb.patch | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 patches/0053-remove_wait_on_bit_timeout/btusb.patch (limited to 'patches/0053-remove_wait_on_bit_timeout/btusb.patch') diff --git a/patches/0053-remove_wait_on_bit_timeout/btusb.patch b/patches/0053-remove_wait_on_bit_timeout/btusb.patch new file mode 100644 index 00000000..52ed8b12 --- /dev/null +++ b/patches/0053-remove_wait_on_bit_timeout/btusb.patch @@ -0,0 +1,110 @@ +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -1845,8 +1845,12 @@ static void btusb_intel_bootup(struct bt + return; + + if (test_and_clear_bit(BTUSB_BOOTING, &data->flags)) { ++#if LINUX_VERSION_IS_GEQ(3,17,0) + smp_mb__after_atomic(); + wake_up_bit(&data->flags, BTUSB_BOOTING); ++#else ++ wake_up_interruptible(&data->hdev->req_wait_q); ++#endif + } + } + +@@ -1863,8 +1867,12 @@ static void btusb_intel_secure_send_resu + + if (test_and_clear_bit(BTUSB_DOWNLOADING, &data->flags) && + test_bit(BTUSB_FIRMWARE_LOADED, &data->flags)) { ++#if LINUX_VERSION_IS_GEQ(3,17,0) + smp_mb__after_atomic(); + wake_up_bit(&data->flags, BTUSB_DOWNLOADING); ++#else ++ wake_up_interruptible(&data->hdev->req_wait_q); ++#endif + } + } + +@@ -2208,6 +2216,7 @@ static int btusb_setup_intel_new(struct + * and thus just timeout if that happens and fail the setup + * of this device. + */ ++#if LINUX_VERSION_IS_GEQ(3,17,0) + err = wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING, + TASK_INTERRUPTIBLE, + msecs_to_jiffies(5000)); +@@ -2222,6 +2231,31 @@ static int btusb_setup_intel_new(struct + err = -ETIMEDOUT; + goto done; + } ++#else ++ if (test_bit(BTUSB_DOWNLOADING, &data->flags)) { ++ DECLARE_WAITQUEUE(wait, current); ++ signed long timeout; ++ ++ add_wait_queue(&hdev->req_wait_q, &wait); ++ set_current_state(TASK_INTERRUPTIBLE); ++ ++ timeout = schedule_timeout(msecs_to_jiffies(5000)); ++ ++ remove_wait_queue(&hdev->req_wait_q, &wait); ++ ++ if (signal_pending(current)) { ++ BT_ERR("%s: Firmware loading interrupted", hdev->name); ++ err = -EINTR; ++ goto done; ++ } ++ ++ if (!timeout) { ++ BT_ERR("%s: Firmware loading timeout", hdev->name); ++ err = -ETIMEDOUT; ++ goto done; ++ } ++ } ++#endif + + if (test_bit(BTUSB_FIRMWARE_FAILED, &data->flags)) { + BT_ERR("%s: Firmware loading failed", hdev->name); +@@ -2261,6 +2295,7 @@ done: + */ + BT_INFO("%s: Waiting for device to boot", hdev->name); + ++#if LINUX_VERSION_IS_GEQ(3,17,0) + err = wait_on_bit_timeout(&data->flags, BTUSB_BOOTING, + TASK_INTERRUPTIBLE, + msecs_to_jiffies(1000)); +@@ -2274,6 +2309,33 @@ done: + BT_ERR("%s: Device boot timeout", hdev->name); + return -ETIMEDOUT; + } ++#else ++ if (test_bit(BTUSB_BOOTING, &data->flags)) { ++ DECLARE_WAITQUEUE(wait, current); ++ signed long timeout; ++ ++ add_wait_queue(&hdev->req_wait_q, &wait); ++ set_current_state(TASK_INTERRUPTIBLE); ++ ++ /* Booting into operational firmware should not take ++ * longer than 1 second. However if that happens, then ++ * just fail the setup since something went wrong. ++ */ ++ timeout = schedule_timeout(msecs_to_jiffies(1000)); ++ ++ remove_wait_queue(&hdev->req_wait_q, &wait); ++ ++ if (signal_pending(current)) { ++ BT_ERR("%s: Device boot interrupted", hdev->name); ++ return -EINTR; ++ } ++ ++ if (!timeout) { ++ BT_ERR("%s: Device boot timeout", hdev->name); ++ return -ETIMEDOUT; ++ } ++ } ++#endif + + rettime = ktime_get(); + delta = ktime_sub(rettime, calltime); -- cgit v1.2.3