RE: [PATCH 20/28] staging: comedi: rti800: tidy up analog input 'muxgain'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux