[PATCH] spi: bcm2835: fix overflow in calculation of transfer time
kernel at martin.sperl.org
Wed Jul 29 07:31:41 PDT 2015
> On 29.07.2015, at 16:03, Mark Brown <broonie at kernel.org> wrote:
> On Wed, Jul 29, 2015 at 07:34:10AM +0000, kernel at martin.sperl.org wrote:
>> From: Martin Sperl <kernel at martin.sperl.org>
>> This resulted in the use of polling mode when other approaches
>> (dma or interrupts) would have been more appropriate.
> Please describe the actual issue and how it's being fixed in the commit
> message. In this case the fix appears to be converting the timeout
> variable to a long long which will make things better but obviously
> isn't a complete fix for overflows - presumably the ideal thing here is
> to handle saturation better?
Will change the description of the commit and resubmit.
As for saturation I guess that nobody will ever run a spi-transfer
of len=2049638230413 bytes (at which point it would wrap) which:
a) would take 4679 days to reach at 125MHz
(the max frequency of the bcm2835 SPI HW limit)
b) would not fit spi_transfer->len (defined as unsigned)
So handling saturation is not an issue when using "long long”
in the context of this device.
More information about the linux-rpi-kernel