From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757783AbbLBJjk (ORCPT ); Wed, 2 Dec 2015 04:39:40 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36780 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756923AbbLBJjh (ORCPT ); Wed, 2 Dec 2015 04:39:37 -0500 MIME-Version: 1.0 In-Reply-To: <20151201231233.GA1929@sirena.org.uk> References: <8c34c7790244489c2ce0072c72bd9bc7c4cdb965.1448988089.git.hramrach@gmail.com> <20151201231233.GA1929@sirena.org.uk> From: Michal Suchanek Date: Wed, 2 Dec 2015 10:38:56 +0100 Message-ID: Subject: Re: [PATCH v5 08/10] spi: expose master transfer size limitation. To: Mark Brown Cc: 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 On 2 December 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. Yes, that sounds reasonable. Thanks Michal From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Suchanek Subject: Re: [PATCH v5 08/10] spi: expose master transfer size limitation. Date: Wed, 2 Dec 2015 10:38:56 +0100 Message-ID: References: <8c34c7790244489c2ce0072c72bd9bc7c4cdb965.1448988089.git.hramrach@gmail.com> <20151201231233.GA1929@sirena.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: 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 To: Mark Brown Return-path: In-Reply-To: <20151201231233.GA1929-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> Sender: linux-spi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On 2 December 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. Yes, that sounds reasonable. Thanks Michal -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html