From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754370AbcE3IhF (ORCPT ); Mon, 30 May 2016 04:37:05 -0400 Received: from down.free-electrons.com ([37.187.137.238]:59945 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754327AbcE3IhC (ORCPT ); Mon, 30 May 2016 04:37:02 -0400 Date: Mon, 30 May 2016 10:37:00 +0200 From: Maxime Ripard To: Michal Suchanek Cc: linux-sunxi@googlegroups.com, Mark Brown , Chen-Yu Tsai , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/5] spi: sun4i: fix FIFO limit Message-ID: <20160530083700.GF4247@lukather> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/aVve/J9H4Wl5yVO" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --/aVve/J9H4Wl5yVO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Thu, May 26, 2016 at 07:25:24PM -0000, Michal Suchanek wrote: > When testing SPI without DMA I noticed that filling the FIFO on the > spi controller causes timeout. >=20 > Always leave room for one byte in the FIFO. >=20 > Signed-off-by: Michal Suchanek Sending it to stable would be great (with a fixes tag too). >=20 > --- > v2: > use EMSGSIZE instead of EINVAL > --- > drivers/spi/spi-sun4i.c | 8 ++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c > index fe63bbd..04f1b77 100644 > --- a/drivers/spi/spi-sun4i.c > +++ b/drivers/spi/spi-sun4i.c > @@ -180,7 +180,9 @@ static int sun4i_spi_transfer_one(struct spi_master *= master, > =20 > /* We don't support transfer larger than the FIFO */ > if (tfr->len > SUN4I_FIFO_DEPTH) > - return -EINVAL; > + return -EMSGSIZE; One new line here. > + if (tfr->tx_buf && tfr->len >=3D SUN4I_FIFO_DEPTH) > + return -EMSGSIZE; > =20 > reinit_completion(&sspi->done); > sspi->tx_buf =3D tfr->tx_buf; > @@ -271,7 +273,9 @@ static int sun4i_spi_transfer_one(struct spi_master *= master, > sun4i_spi_write(sspi, SUN4I_XMIT_CNT_REG, SUN4I_XMIT_CNT(tx_len)); > =20 > /* Fill the TX FIFO */ > - sun4i_spi_fill_fifo(sspi, SUN4I_FIFO_DEPTH); > + /* Filling the FIFO fully causes timeout for some reason > + * at least on spi2 on A10s */ This is not the proper comment style and generate a warning with checkpatch, please fix that (and merge the comment with the previous comment). Thanks! Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --/aVve/J9H4Wl5yVO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXS/usAAoJEBx+YmzsjxAgAIMP/i/aAL+gsHrcGNTjChIaIb7d Pa/KMs9mUiFlWz73v2XoFY1V7AFfxATI4ym5JxS7hUNCkA68vf0+o5CULUC0sKCA g9ZPDDTUwceFwjt7Qb5OThG+hI25JHStsT0BgdipDhbo5/xl8Q/BosMMJ9/q0drm hy5Q7Rj4QMH/ihyWTTex2emMbuoNMjy6LM7AUKRlBIJaCCcpHJ5dKl9O3tpeJMZ7 wH5pdOubzW9BXPZAx4oRp27dSVCXar2koNzBQCHV9O0/bpoFoGdONmGbNSDvLz9h v1joNcPL42vfRmzqYZpMHqnjvSMxVztHtea/0OJ68M6oWFh7ajoORLk0UmsCf+Qj qlNTXId8O7WOKC4itk5bueOFZKjSPup7tVy0UlWEBzPpLitwkX+rTK7DHwkrFWew IHMqsLVzuoRQQwMLGcPk7RffRv0k9BAdWFdQkN5SVhALr6C/ZQpOFQcLjBBfQKKL xKQAigXNfXEexvV295CjFpELes33s5xhHqGvjh/j84Noui3tFG1smgGYsYqWHIus /LJuuSeB739Jn/M3MrxJ65Kx2cqZiRClCAmfh8CRNmBOQzcfj2ga5Fg0PsqZDGXG wd4NgnLUCKo4ZfOX2mEk3288LmnjhQdixxgz7FpzJv5PLNSpfxy13Exoz2rAUyNB 3/IsLOn3FRMTw43X5dsP =bup/ -----END PGP SIGNATURE----- --/aVve/J9H4Wl5yVO--