On Friday, November 21, 2014 3:59 AM, Ian Abbott wrote:
> On 20/11/14 22:07, H Hartley Sweeten wrote:
>> Most of the comedi drivers that provide readback for write only subdevices 
>> now
>> use the comedi core comedi_alloc_subdev_readback() helper to allocate the 
>> subdevice
>> 'reaback' member instead of using some member in their private data. These 
>> drivers
>> also hook up the (*insn_read) callback to the comedi_readback_insn_read() 
>> helper to
>> provide the readback.
>>
>> Have the core automatically hook up the (*insn_read) callback after 
>> allocating the
>> memory. For the drivers that use a private callback, hook it up after the 
>> readback
>> bas been allocated and add a comment about the override of the default.
>>
>> Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
>> Cc: Ian Abbott <abbo...@mev.co.uk>
>> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>

[snip]

>>
>> diff --git a/drivers/staging/comedi/drivers.c 
>> b/drivers/staging/comedi/drivers.c
>> index e516ed9..051f004 100644
>> --- a/drivers/staging/comedi/drivers.c
>> +++ b/drivers/staging/comedi/drivers.c
>> @@ -109,6 +109,9 @@ int comedi_alloc_subdev_readback(struct comedi_subdevice 
>> *s)
>>      s->readback = kcalloc(s->n_chan, sizeof(*s->readback), GFP_KERNEL);
>>      if (!s->readback)
>>              return -ENOMEM;
>> +
>> +    s->insn_read = comedi_readback_insn_read;
>> +
>
> Maybe it should only do that if s->insn_read is NULL.  Then it wouldn't 
> matter if a low-level driver overrides it before or after calling 
> comedi_alloc_subdev_readback().

Ian,

I can make this change now or submit a follow up patch after Greg applies
the series. Which would you prefer?

This change would allow effect the das6402, dt9812, pcmda12, usbdux,
and usbduxsigma drivers. Those drivers would then not need the
(*insn_read) initialization moved.

Regards,
Hartley

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

Reply via email to