Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281305 > unrolled thread
| Started by | Mark Brown <broonie@kernel.org> |
|---|---|
| First post | 2015-12-02 00:20 +0100 |
| Last post | 2015-12-07 21:20 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v5 08/10] spi: expose master transfer size limitation. Mark Brown <broonie@kernel.org> - 2015-12-02 00:20 +0100
Re: [PATCH v5 08/10] spi: expose master transfer size limitation. Michal Suchanek <hramrach@gmail.com> - 2015-12-02 10:40 +0100
Re: [PATCH v5 08/10] spi: expose master transfer size limitation. Martin Sperl <martin@sperl.org> - 2015-12-04 15:40 +0100
Re: [PATCH v5 08/10] spi: expose master transfer size limitation. Michal Suchanek <hramrach@gmail.com> - 2015-12-04 17:50 +0100
Re: [PATCH v5 08/10] spi: expose master transfer size limitation. Mark Brown <broonie@kernel.org> - 2015-12-07 21:20 +0100
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2015-12-02 00:20 +0100 |
| Subject | Re: [PATCH v5 08/10] spi: expose master transfer size limitation. |
| Message-ID | <qB2ng-7GU-19@gated-at.bofh.it> |
[Multipart message — attachments visible in raw view] — view raw
On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
> +static inline size_t
> +spi_max_transfer_size(struct spi_device *spi)
> +{
> + struct spi_master *master = spi->master;
> + if (!master->max_transfer_size)
> + return 0;
> + return master->max_transfer_size(spi);
> +}
Can we change this to return SIZE_MAX instead (ie, the maximum value for
a size_t)? That way callers don't need to worry if there is a limit, if
they want to handle it they can just unconditionally assume that a limit
will be provided.
[toc] | [next] | [standalone]
| From | Michal Suchanek <hramrach@gmail.com> |
|---|---|
| Date | 2015-12-02 10:40 +0100 |
| Message-ID | <qBc3h-5mE-33@gated-at.bofh.it> |
| In reply to | #1281305 |
On 2 December 2015 at 00:12, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>
>> +static inline size_t
>> +spi_max_transfer_size(struct spi_device *spi)
>> +{
>> + struct spi_master *master = spi->master;
>> + if (!master->max_transfer_size)
>> + return 0;
>> + return master->max_transfer_size(spi);
>> +}
>
> Can we change this to return SIZE_MAX instead (ie, the maximum value for
> a size_t)? That way callers don't need to worry if there is a limit, if
> they want to handle it they can just unconditionally assume that a limit
> will be provided.
Yes, that sounds reasonable.
Thanks
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Martin Sperl <martin@sperl.org> |
|---|---|
| Date | 2015-12-04 15:40 +0100 |
| Message-ID | <qBZGG-3Ud-23@gated-at.bofh.it> |
| In reply to | #1281305 |
> On 02.12.2015, at 00:12, Mark Brown <broonie@kernel.org> wrote:
>
> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>
>> +static inline size_t
>> +spi_max_transfer_size(struct spi_device *spi)
>> +{
>> + struct spi_master *master = spi->master;
>> + if (!master->max_transfer_size)
>> + return 0;
>> + return master->max_transfer_size(spi);
>> +}
>
> Can we change this to return SIZE_MAX instead (ie, the maximum value for
> a size_t)? That way callers don't need to worry if there is a limit, if
> they want to handle it they can just unconditionally assume that a limit
> will be provided.
As I just came across: spi_master.max_dma_len, so I wonder how this
value would differ from the proposed spi_master.max_transfer_size
on specific HW?
For all practical purposes I would assume both are identical.
Martin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Michal Suchanek <hramrach@gmail.com> |
|---|---|
| Date | 2015-12-04 17:50 +0100 |
| Message-ID | <qC1Iu-5b5-21@gated-at.bofh.it> |
| In reply to | #1283873 |
On 4 December 2015 at 15:30, Martin Sperl <martin@sperl.org> wrote:
>
>> On 02.12.2015, at 00:12, Mark Brown <broonie@kernel.org> wrote:
>>
>> On Tue, Dec 01, 2015 at 04:51:06PM -0000, Michal Suchanek wrote:
>>
>>> +static inline size_t
>>> +spi_max_transfer_size(struct spi_device *spi)
>>> +{
>>> + struct spi_master *master = spi->master;
>>> + if (!master->max_transfer_size)
>>> + return 0;
>>> + return master->max_transfer_size(spi);
>>> +}
>>
>> Can we change this to return SIZE_MAX instead (ie, the maximum value for
>> a size_t)? That way callers don't need to worry if there is a limit, if
>> they want to handle it they can just unconditionally assume that a limit
>> will be provided.
>
> As I just came across: spi_master.max_dma_len, so I wonder how this
> value would differ from the proposed spi_master.max_transfer_size
> on specific HW?
>
> For all practical purposes I would assume both are identical.
They aren't.
Some SPI masters don't use DMA. Some SPI master drivers can drive CS
manually so they can glue multiple DMA (or whatever) transfers into
single logical SPI transfer transparently. And some cannot. Hence this
limit.
That said I don't know what is the purpose of spi_master.max_dma_len.
It is seldom used. It seems to be used as a hint for the DMA buffer
size in spi.c only.
It is set in 3 drivers.
Thanks
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2015-12-07 21:20 +0100 |
| Message-ID | <qDaql-PS-7@gated-at.bofh.it> |
| In reply to | #1283873 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, Dec 04, 2015 at 03:30:50PM +0100, Martin Sperl wrote: > > On 02.12.2015, at 00:12, Mark Brown <broonie@kernel.org> wrote: > > Can we change this to return SIZE_MAX instead (ie, the maximum value for > > a size_t)? That way callers don't need to worry if there is a limit, if > > they want to handle it they can just unconditionally assume that a limit > > will be provided. > As I just came across: spi_master.max_dma_len, so I wonder how this > value would differ from the proposed spi_master.max_transfer_size > on specific HW? > For all practical purposes I would assume both are identical. Yeah, we should probably just remove the DMA specific one in time though it may be useful for some devices with built in DMA engines if they're oddly limited I'm not sure how practical their DMA would be if it differed from the overall transfer length.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web