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 <hswee...@visionengravers.com>
>> Cc: Ian Abbott <abbo...@mev.co.uk>
>> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
>
> 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
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to