diff options
author | Sean Young <sean@mess.org> | 2013-11-03 17:13:57 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-11-07 12:04:12 -0500 |
commit | 9bd766b79a80159338c10f8cec4c1f7ed0fe4a4e (patch) | |
tree | 475be25a4b5ce68d54c672bf397eb764e136760c /drivers/media/rc | |
parent | 5f27ca418bedd0342942eca61a12f76d73d95962 (diff) |
[media] iguanair: simplify calculation of carrier delay cycles
Simplify the logic that calculates the carrier, and removes a warning
on avr32 arch:
drivers/media/rc/iguanair.c: In function 'iguanair_set_tx_carrier':
drivers/media/rc/iguanair.c:304: warning: 'sevens' may be used uninitialized in this function
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r-- | drivers/media/rc/iguanair.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index 19632b1c2190..7f05e197680b 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c | |||
@@ -308,22 +308,12 @@ static int iguanair_set_tx_carrier(struct rc_dev *dev, uint32_t carrier) | |||
308 | cycles = DIV_ROUND_CLOSEST(24000000, carrier * 2) - | 308 | cycles = DIV_ROUND_CLOSEST(24000000, carrier * 2) - |
309 | ir->cycle_overhead; | 309 | ir->cycle_overhead; |
310 | 310 | ||
311 | /* make up the the remainer of 4-cycle blocks */ | 311 | /* |
312 | switch (cycles & 3) { | 312 | * Calculate minimum number of 7 cycles needed so |
313 | case 0: | 313 | * we are left with a multiple of 4; so we want to have |
314 | sevens = 0; | 314 | * (sevens * 7) & 3 == cycles & 3 |
315 | break; | 315 | */ |
316 | case 1: | 316 | sevens = (4 - cycles) & 3; |
317 | sevens = 3; | ||
318 | break; | ||
319 | case 2: | ||
320 | sevens = 2; | ||
321 | break; | ||
322 | case 3: | ||
323 | sevens = 1; | ||
324 | break; | ||
325 | } | ||
326 | |||
327 | fours = (cycles - sevens * 7) / 4; | 317 | fours = (cycles - sevens * 7) / 4; |
328 | 318 | ||
329 | /* magic happens here */ | 319 | /* magic happens here */ |