Skip to contentSkip to conversation

media: rc: unnecessary call to do_div

PATCH New Sean Young 1 participant 1 message Feb 11, 2018

Subsystems (2)
lore
Share & tools
lore

Sean Young

author maintainer
#0 lore raw

PATCH 1/1 media: rc: unnecessary call to do_div

No need to call do_div() when the remainder is thrown away.

---
 drivers/media/rc/lirc_dev.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/media/rc/lirc_dev.c +3 -5
index 6ef5b24eb1d8..aca404d32de8 100644
@@ -86,14 +86,12 @@ void ir_lirc_raw_event(struct rc_dev *dev, struct ir_raw_event ev)
 							 dev->gap_start));
 
 			/* Convert to ms and cap by LIRC_VALUE_MASK */
-			do_div(dev->gap_duration, 1000);
-			dev->gap_duration = min_t(u64, dev->gap_duration,
-						  LIRC_VALUE_MASK);
+			sample = min_t(u64, dev->gap_duration / 1000,
+				       LIRC_VALUE_MASK);
 
 			spin_lock_irqsave(&dev->lirc_fh_lock, flags);
 			list_for_each_entry(fh, &dev->lirc_fh, list)
-				kfifo_put(&fh->rawir,
-					  LIRC_SPACE(dev->gap_duration));
+				kfifo_put(&fh->rawir, LIRC_SPACE(sample));
 			spin_unlock_irqrestore(&dev->lirc_fh_lock, flags);
 			dev->gap = false;
 		}
Signature · 1 line
2.14.3