[PATCH 16/17] staging: comedi: s526: remove struct s526GPCTConfig

Dan Carpenter dan.carpenter at oracle.com
Sat Sep 22 13:10:54 UTC 2012


On Wed, Sep 19, 2012 at 03:12:54PM -0700, H Hartley Sweeten wrote:
> +	case INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR:
>  		/* data[0] contains the PULSE_WIDTH
>  		   data[1] contains the PULSE_PERIOD
>  		   @pre PULSE_PERIOD > PULSE_WIDTH > 0
>  		   The above periods must be expressed as a multiple of the
>  		   pulse frequency on the selected source
>  		 */
> -		if ((data[1] > data[0]) && (data[0] > 0)) {
> -			devpriv->s526_gpct_config[chan].data[0] = data[0];
> -			devpriv->s526_gpct_config[chan].data[1] = data[1];
> -		} else {
> +		if ((data[1] < data[0]) || !data[0])
                     ^^^^^^^^^^^^^^^^^
Should this be:
		if ((data[1] <= data[0] ...
That would match the original code better.

regards,
dan carpenter

>  			return -EINVAL;
> -		}
>  
>  		/* Fall thru to write the PULSE_WIDTH */
>  
> -	case PositionMeasurement:
> -	case SinglePulseGeneration:
> +	case INSN_CONFIG_GPCT_QUADRATURE_ENCODER:
> +	case INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR:
>  		outw((data[0] >> 16) & 0xffff, chan_iobase + REG_C0H);
>  		outw(data[0] & 0xffff, chan_iobase + REG_C0L);
>  		break;




More information about the devel mailing list