[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>
This commit is contained in:
parent
5f27ca418b
commit
9bd766b79a
|
@ -308,22 +308,12 @@ static int iguanair_set_tx_carrier(struct rc_dev *dev, uint32_t carrier)
|
||||||
cycles = DIV_ROUND_CLOSEST(24000000, carrier * 2) -
|
cycles = DIV_ROUND_CLOSEST(24000000, carrier * 2) -
|
||||||
ir->cycle_overhead;
|
ir->cycle_overhead;
|
||||||
|
|
||||||
/* make up the the remainer of 4-cycle blocks */
|
/*
|
||||||
switch (cycles & 3) {
|
* Calculate minimum number of 7 cycles needed so
|
||||||
case 0:
|
* we are left with a multiple of 4; so we want to have
|
||||||
sevens = 0;
|
* (sevens * 7) & 3 == cycles & 3
|
||||||
break;
|
*/
|
||||||
case 1:
|
sevens = (4 - cycles) & 3;
|
||||||
sevens = 3;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
sevens = 2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
sevens = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
fours = (cycles - sevens * 7) / 4;
|
fours = (cycles - sevens * 7) / 4;
|
||||||
|
|
||||||
/* magic happens here */
|
/* magic happens here */
|
||||||
|
|
Loading…
Reference in New Issue