On Thursday, October 08, 2015 3:38 AM, Ian Abbott wrote:
> On 08/10/15 02:26, H Hartley Sweeten wrote:
>> According to the boardinfo, the dt3002 board does not have analog outputs.
>> The rest of the board have two 12-bit analog output channels.
>>
>> Replace the 'dachan' and 'dabits' members of the boardinfo with a bit-
>> field flag 'has_ao'. Use the new member to conditionally initialize
>> the analog output subdevice.
>>
>> Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
>> Cc: Ian Abbott <abbo...@mev.co.uk>
>> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
>> ---
>>   drivers/staging/comedi/drivers/dt3000.c | 40 
>> +++++++++++++++------------------
>>   1 file changed, 18 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/dt3000.c 
>> b/drivers/staging/comedi/drivers/dt3000.c
>> index 8d6d344..12cf65a 100644
>> --- a/drivers/staging/comedi/drivers/dt3000.c
>> +++ b/drivers/staging/comedi/drivers/dt3000.c
> [snip]
>> @@ -681,15 +674,18 @@ static int dt3000_auto_attach(struct comedi_device 
>> *dev,
>>              s->cancel       = dt3k_ai_cancel;
>>      }
>>
>> +    /* Analog Output subdevice */
>>      s = &dev->subdevices[1];
>> -    /* ao subsystem */
>> -    s->type         = COMEDI_SUBD_AO;
>> -    s->subdev_flags = SDF_WRITABLE;
>> -    s->n_chan       = 2;
>> -    s->maxdata      = (1 << board->dabits) - 1;
>> -    s->len_chanlist = 1;
>> -    s->range_table  = &range_bipolar10;
>> -    s->insn_write   = dt3k_ao_insn_write;
>> +    if (board->has_ao) {
>> +            s->type         = COMEDI_SUBD_AO;
>> +            s->subdev_flags = SDF_WRITABLE;
>> +            s->n_chan       = 2;
>> +            s->maxdata      = 0x0fff;
>> +            s->range_table  = &range_bipolar10;
>> +            s->insn_write   = dt3k_ao_insn_write;
>> +    } else {
>> +            s->type         = COMEDI_SUBD_UNUSED;
>> +    }
>>
>>      ret = comedi_alloc_subdev_readback(s);
>>      if (ret)
>>
>
> The comedi_alloc_subdev_readback() needs moving into the `if 
>  (board->has_ao)` block.

Ugh.. overlooked that. I'll post an updated series shortly.

Thanks,
Hartley

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to