[PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Based on the length of the delay (see: [1]), use the correct sleep/delay
functions.

[1] https://www.kernel.org/doc/Documentation/timers/timers-howto.txt
Fixes: b36ba30c8ac6 ("clk: qcom: Add reset controller support")
Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>
---
 drivers/clk/qcom/reset.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c
index 0e914ec7aeae..928995c3f369 100644
--- a/drivers/clk/qcom/reset.c
+++ b/drivers/clk/qcom/reset.c
@@ -14,9 +14,15 @@
 static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
 {
 	struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev);
+	u16 delay_us = rst->reset_map[id].udelay ?: 1;
 
 	rcdev->ops->assert(rcdev, id);
-	udelay(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */
+
+	if (delay_us < 10)
+		udelay(delay_us);
+	else
+		usleep_range(delay_us, delay_us + 5);
+
 	rcdev->ops->deassert(rcdev, id);
 	return 0;
 }

-- 
2.41.0




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux