summaryrefslogtreecommitdiff
path: root/drivers/media/rc/iguanair.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2014-01-21 02:10:39 +0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-02-04 23:23:06 +0400
commit776eced0e336f88fdbe4374306de1f8acaeffcc4 (patch)
treed4952472929a12e2fff065e4bdeb9062973fc3ce /drivers/media/rc/iguanair.c
parentdd3a5a1e7a8723b137f2af7905db53f011fd7287 (diff)
downloadlinux-776eced0e336f88fdbe4374306de1f8acaeffcc4.tar.xz
[media] iguanair: simplify tx loop
Make the code simpler. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/rc/iguanair.c')
-rw-r--r--drivers/media/rc/iguanair.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index 99a3a5a509e6..a83519a6a158 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -364,20 +364,14 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
rc = -EINVAL;
goto out;
}
- while (periods > 127) {
- ir->packet->payload[size++] = 127 | space;
- periods -= 127;
+ while (periods) {
+ unsigned p = min(periods, 127u);
+ ir->packet->payload[size++] = p | space;
+ periods -= p;
}
-
- ir->packet->payload[size++] = periods | space;
space ^= 0x80;
}
- if (count == 0) {
- rc = -EINVAL;
- goto out;
- }
-
ir->packet->header.start = 0;
ir->packet->header.direction = DIR_OUT;
ir->packet->header.cmd = CMD_SEND;