RE: [PATCH 01/55] staging: comedi: comedi_buf: introduce comedi_buf_write_samples()

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

 



On Thursday, October 23, 2014 3:23 AM, Ian Abbott wrote:
> On 22/10/14 23:36, H Hartley Sweeten wrote:
>> Introduce a generic method to write samples to the async buffer.
>>
>> The number of samples is first checked against the number of samples that
>> would fill the async buffer. The size of each sample is determined using
>> the bytes_per_sample() helper. If all the samples will fit in the async
>> buffer they are written to the buffer using comedi_write_array_to_buffer().
>>
>> This will allow converting all the comedi drivers to use a common method to
>> write data to the async buffer.
>>
>> Since comedi_write_array_to_buffer() sets the COMEDI_CB_BLOCK event after
>> writing the data, those events can be removed from the drivers.
>>
>> In addition, comedi_inc_scan_progress() will automatically detect the end of
>> scan and set the COMEDI_CB_EOS event. Those events can also be removed from
>> the drivers.
>>
>> Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
>> Cc: Ian Abbott <abbotti@xxxxxxxxx>
>> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> Maybe instead of returning 0 here, it could set nsamples to max_samples 
> and carry on.  Then at least it might write some samples to the buffer. 
> For example, in your patch 08, the 'for' loop you replaced might have 
> written some samples to the buffer before flagging the overrun, but the 
> Replacement wouldn't.

I also thought of that and have a patch ready to do that.

This series just gets all the drivers to use the same method
to add samples to the async buffer. Other than the change
to the ni_labpc_isadma module in patch 8, it should not
change the behavior of any of the drivers.

>> +	}
>
> You could return early here if nsamples == 0.

Yah, it saves a step. I'll move that in the patch that adds
the samples that fit in the buffer before flagging the
overrun.

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