diff mbox

[1/3] spi: introduce max message size flag in spi_master

Message ID 6c95366c-7fcc-ef4c-033a-f9f6e152a669@gmail.com
State Not Applicable
Headers show

Commit Message

Heiner Kallweit Aug. 7, 2016, 7:47 p.m. UTC
Recently a maximum transfer size was was introduced in struct spi_master.
However there are also spi controllers with a maximum message size, e.g.
fsl-espi has a max message size of 64KB.
As there are no (known) spi controller with differing size limits for
transfer and message, introduce a flag in spi_master to indicate that
the max transfer size is also the maximum message size.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 include/linux/spi/spi.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Mark Brown Aug. 16, 2016, 4:42 p.m. UTC | #1
On Sun, Aug 07, 2016 at 09:47:18PM +0200, Heiner Kallweit wrote:

> As there are no (known) spi controller with differing size limits for
> transfer and message, introduce a flag in spi_master to indicate that
> the max transfer size is also the maximum message size.

This is a *really* cumbersome interface which will doubtless be found to
be broken at some point by some hardware that does have separate
restrictons on both.  Let's just specify the limit directly unless
there's some pressing reason not to.

There's also something off with the way you're posting the patches, your
patch series isn't threaded together.
Heiner Kallweit Aug. 17, 2016, 6:51 p.m. UTC | #2
Am 16.08.2016 um 18:42 schrieb Mark Brown:
> On Sun, Aug 07, 2016 at 09:47:18PM +0200, Heiner Kallweit wrote:
> 
>> As there are no (known) spi controller with differing size limits for
>> transfer and message, introduce a flag in spi_master to indicate that
>> the max transfer size is also the maximum message size.
> 
> This is a *really* cumbersome interface which will doubtless be found to
> be broken at some point by some hardware that does have separate
> restrictons on both.  Let's just specify the limit directly unless
> there's some pressing reason not to.
> 
> There's also something off with the way you're posting the patches, your
> patch series isn't threaded together.  
> 
Thanks for the feedback. I'll address both points and send a v2.
diff mbox

Patch

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 072cb2a..cadb1de 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -312,6 +312,8 @@  static inline void spi_unregister_driver(struct spi_driver *sdrv)
  * @flags: other constraints relevant to this driver
  * @max_transfer_size: function that returns the max transfer size for
  *	a &spi_device; may be %NULL, so the default %SIZE_MAX will be used.
+ * @max_message_size_flag: indicates that max transfer size is also
+ *	max message size
  * @io_mutex: mutex for physical bus access
  * @bus_lock_spinlock: spinlock for SPI bus locking
  * @bus_lock_mutex: mutex for exclusion of multiple callers
@@ -446,6 +448,8 @@  struct spi_master {
 	 * the limit may depend on device transfer settings
 	 */
 	size_t (*max_transfer_size)(struct spi_device *spi);
+	/* flag indicating that max transfer size is also max message size */
+	bool			max_message_size_flag;
 
 	/* I/O mutex */
 	struct mutex		io_mutex;