RE: [PATCH 01/19] staging: comedi: drivers: have core hook up default (*insn_read) for readback

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

 



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 <hsweeten@xxxxxxxxxxxxxxxxxxx>
>> Cc: Ian Abbott <abbotti@xxxxxxxxx>
>> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

[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
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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