Commit 776eced0 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

[media] iguanair: simplify tx loop

Make the code simpler.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent dd3a5a1e
...@@ -364,20 +364,14 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count) ...@@ -364,20 +364,14 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
while (periods > 127) { while (periods) {
ir->packet->payload[size++] = 127 | space; unsigned p = min(periods, 127u);
periods -= 127; ir->packet->payload[size++] = p | space;
periods -= p;
} }
ir->packet->payload[size++] = periods | space;
space ^= 0x80; space ^= 0x80;
} }
if (count == 0) {
rc = -EINVAL;
goto out;
}
ir->packet->header.start = 0; ir->packet->header.start = 0;
ir->packet->header.direction = DIR_OUT; ir->packet->header.direction = DIR_OUT;
ir->packet->header.cmd = CMD_SEND; ir->packet->header.cmd = CMD_SEND;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment