RE: [PATCH RFC] staging: comedi: dt282x: condition with no effect - if identical to else

From: Hartley Sweeten
Date: Wed Feb 04 2015 - 11:19:38 EST


On Tuesday, February 03, 2015 8:13 AM, Ian Abbott wrote:
> On 03/02/15 12:38, Nicholas Mc Guire wrote:
>> The if and the else branch code are identical - so the condition has no
>> effect on the effective code - this patch removes the condition and the
>> duplicated code.
>>
>> Signed-off-by: Nicholas Mc Guire <hofrat@xxxxxxxxx>
>> ---
>>
>> The if and else branch are identical code thus the condition has no effect
>>
>> if (cmd->scan_begin_src == TRIG_FOLLOW) {
>> /* internal trigger */
>> err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
>> } else {
>> /* external trigger */
>> /* should be level/edge, hi/lo specification here */
>> err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
>> }
>>
> I think what that comment means is that it should allow scan_begin_arg
> to have various combinations of the CR_EDGE and CR_INVERT bits set.
> I.e. it ought to allow whatever combination of CR_EDGE and CR_INVERT
> better describes the nature of the external trigger signal, in addition
> to allowing the lazy default value 0.
>
> I don't know what the nature of the external trigger signal is, as I
> haven't seen the manual. I think Hartley might have seen one.

According to the manual, the external trigger is not "programmable". It's
a Schmitt trigger input, enables on TTL logic low, with a 22K pullup.

Since the 'scan_begin_arg' is not actually used for the analog input async
command, I think removing the comments completely is fine. Just change
the check to:

err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0);

Regards,
Hartley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/