Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755167AbbLDQqN (ORCPT ); Fri, 4 Dec 2015 11:46:13 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:34104 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753979AbbLDQqL (ORCPT ); Fri, 4 Dec 2015 11:46:11 -0500 MIME-Version: 1.0 In-Reply-To: <5FC39638-EEE0-4CFA-B464-0B4743CB6AB6@sperl.org> References: <8c34c7790244489c2ce0072c72bd9bc7c4cdb965.1448988089.git.hramrach@gmail.com> <20151201231233.GA1929@sirena.org.uk> <5FC39638-EEE0-4CFA-B464-0B4743CB6AB6@sperl.org> From: Michal Suchanek Date: Fri, 4 Dec 2015 17:45:28 +0100 Message-ID: Subject: Re: [PATCH v5 08/10] spi: expose master transfer size limitation. To: Martin Sperl Cc: Mark Brown , Heiner Kallweit , David Woodhouse , Brian Norris , Han Xu , Boris Brezillon , Javier Martinez Canillas , Stephen Warren , "Andrew F. Davis" , Marek Vasut , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Mika Westerberg , Gabor Juhos , =?UTF-8?B?QmVhbiBIdW8g6ZyN5paM5paM?= , Furquan Shaikh , MTD Maling List , Linux Kernel Mailing List , linux-spi Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1619 Lines: 47 On 4 December 2015 at 15:30, Martin Sperl wrote: > >> On 02.12.2015, at 00:12, Mark Brown 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/