History

[media] staging: sir: use usleep_range() rather than busy looping

usleep_range() is perfect for this.

Sean Young committed 9 years ago

Commit 19bc4e01 parent 43371f61 file · +1 −16Browse files

Showing the changes to drivers/staging/media/lirc (1 of 1 file). Show all

Unified · Split

drivers/staging/media/lirc/lirc_sir.c+1−16
@@ -76,21 +76,6 @@ static inline void soutp(int offset, int value) · 75 unmodified lines
76 outb(value, io + offset);76 outb(value, io + offset);
77}77}
78 78
79#ifndef MAX_UDELAY_MS
80#define MAX_UDELAY_US 5000
81#else
82#define MAX_UDELAY_US (MAX_UDELAY_MS * 1000)
83#endif
84
85static void safe_udelay(unsigned long usecs)
86{
87 while (usecs > MAX_UDELAY_US) {
88 udelay(MAX_UDELAY_US);
89 usecs -= MAX_UDELAY_US;
90 }
91 udelay(usecs);
92}
93
94/* SECTION: Communication with user-space */79/* SECTION: Communication with user-space */
95static int sir_tx_ir(struct rc_dev *dev, unsigned int *tx_buf,80static int sir_tx_ir(struct rc_dev *dev, unsigned int *tx_buf,
96 unsigned int count)81 unsigned int count)
@@ -281,7 +266,7 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) · 184 unmodified lines
281 266
282static void send_space(unsigned long len)267static void send_space(unsigned long len)
283{268{
284 safe_udelay(len);269 usleep_range(len, len + 25);
285}270}
286 271
287static void send_pulse(unsigned long len)272static void send_pulse(unsigned long len)