On Tuesday, April 09, 2013 3:10 AM, Ian Abbott wrote: > On 2013-04-09 02:20, H Hartley Sweeten wrote: >> -/* settling delay times in usec for different gains */ >> -static const int gaindelay[] = { 10, 20, 40, 80 }; > >> if (insn->n > 0) { >> - BUG_ON(gain >= ARRAY_SIZE(gaindelay)); >> - udelay(gaindelay[gain]); >> + int delay = (gain == 0) ? 10 : >> + (gain == 1) ? 20 : >> + (gain == 2) ? 40 : 80; >> + >> + udelay(delay); >> } > > You could use: > > int delay = 10 << gain; > > although that would be harder to tweak later. It also does not limit the delay time. Of course 'gain' should not ever be greater than 3... Hartley _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel