[PATCH 4/8] [media] staging: sir: use usleep_range() rather than busy looping

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

 



usleep_range() is perfect for this.

Signed-off-by: Sean Young <sean@xxxxxxxx>
---
 drivers/staging/media/lirc/lirc_sir.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c
index 3a2bac9..9b09c25 100644
--- a/drivers/staging/media/lirc/lirc_sir.c
+++ b/drivers/staging/media/lirc/lirc_sir.c
@@ -90,21 +90,6 @@ static inline void soutp(int offset, int value)
 	outb(value, io + offset);
 }
 
-#ifndef MAX_UDELAY_MS
-#define MAX_UDELAY_US 5000
-#else
-#define MAX_UDELAY_US (MAX_UDELAY_MS * 1000)
-#endif
-
-static void safe_udelay(unsigned long usecs)
-{
-	while (usecs > MAX_UDELAY_US) {
-		udelay(MAX_UDELAY_US);
-		usecs -= MAX_UDELAY_US;
-	}
-	udelay(usecs);
-}
-
 /* SECTION: Communication with user-space */
 static int sir_tx_ir(struct rc_dev *dev, unsigned int *tx_buf,
 		     unsigned int count)
@@ -294,7 +279,7 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id)
 
 static void send_space(unsigned long len)
 {
-	safe_udelay(len);
+	usleep_range(len, len + 25);
 }
 
 static void send_pulse(unsigned long len)
-- 
2.9.3




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux