Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp500479imu; Wed, 16 Jan 2019 02:44:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN6rxy36nZQtZSqb3rcvFypqhTbqEW2TgDl0hVuXtdYLuItrplnJcmQLsl6aAsevLsTkX9xl X-Received: by 2002:a17:902:f20d:: with SMTP id gn13mr8909389plb.11.1547635471446; Wed, 16 Jan 2019 02:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547635471; cv=none; d=google.com; s=arc-20160816; b=AydEbkk5TKrclREWsGTB40mIDjFymjQXJ3pLe/F55rVe8P35pmlTMCL61aaXjFpXHF +xqUOXWoKcEImdqb65tMJWQTuwEnvj1TaMeWkLHhlp0y4YTqeaX+zx/RhXhBrxdHoGol 5Chpj2EEM5JIK+nsG1DiwTf4wr3PEBdxiQBnWYXKTAWQ2PuEoPeKe0CDiTVM+gLOjZ0p Gs/k9aKai13338x2Ax6f/DYt2VxbasYtgema6kDzVD+R3a/B1Oxl/NKsHoYcIyLn9+0O ZX8o+87wJD11uIt19R0bet5rHrVgA40BovJSXq8d3qN/MPd9XrOW+WgVnu+bAjBw41zH oxVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=2phbaKzwnkB9mPN9q9C/MZPugBUoe3ZvFLLcCHKPRHs=; b=k2HF8ipGXvGZgEMbsSBLcHY91fouVcMlHi+oSkUcA1+o8kRWAsGWadSjuGq9oHzVpP YZdB28op+tFJqwkdIdeJ9JCKiWvxTdrStPA/r7gnPxBieAStSP76yCk3sN2M8hZvlo1M V3RSX0K4tJqjTWrG5T2ZAmLKm6+3jB0eJMrEtip64E3VNEFMuaUm74wrpLSs7ABtQBGu TYtLgDi6xls9y4UU1SpyWjvdcMJ1iVFabnfYf6zpe+3sMUX70ITb+kDxuKQnbT6Ukyw3 PKvm7kLdnclv/fvjztFHWydAbMP3Ml8/wX4YxSeF0i6Jsl0levm0YHStiiaXrhbUvQNq I1bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=veeBAUh3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si6057601pli.418.2019.01.16.02.44.12; Wed, 16 Jan 2019 02:44:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=veeBAUh3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389228AbfAOTIz (ORCPT + 99 others); Tue, 15 Jan 2019 14:08:55 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:57502 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388564AbfAOTIy (ORCPT ); Tue, 15 Jan 2019 14:08:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=2phbaKzwnkB9mPN9q9C/MZPugBUoe3ZvFLLcCHKPRHs=; b=veeBAUh3A7ud iaRPzWu8jPwu2ghaWrWQ/Tyicns7I+ray+8ZAArLDVRuTrC3rmNchR0ghQB7P3ApuGzuTWivfgtnA TmOZZkJFrLeQjLwbcj+PE0ujBPmSajb5UzPUo3ULFMfdXadjnDVCbx/D/Bqt8ov9ke/FBQnxyHJxQ ajPng=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gjU4h-000287-Ra; Tue, 15 Jan 2019 19:08:35 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 768671127848; Tue, 15 Jan 2019 19:08:35 +0000 (GMT) From: Mark Brown To: Lanqing Liu Cc: Baolin Wang , Mark Brown , broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, lanqing.liu@unisoc.com, baolin.wang@linaro.org, linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Applied "spi: sprd: Fix the error data length in SPI read-only mode" to the spi tree In-Reply-To: X-Patchwork-Hint: ignore Message-Id: <20190115190835.768671127848@debutante.sirena.org.uk> Date: Tue, 15 Jan 2019 19:08:35 +0000 (GMT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: sprd: Fix the error data length in SPI read-only mode has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 63f5ffc46d4f53b309a93b83420b2e4bd0da5aba Mon Sep 17 00:00:00 2001 From: Lanqing Liu Date: Tue, 15 Jan 2019 21:46:50 +0800 Subject: [PATCH] spi: sprd: Fix the error data length in SPI read-only mode In SPI read-only mode, we will always return the writing length, which is always the power of "bits_per_word", but the length unit using by users is byte. Thus this patch fixes the returning length by getting from read_bufs() function to get the correct length. Signed-off-by: Lanqing Liu Signed-off-by: Baolin Wang Signed-off-by: Mark Brown --- drivers/spi/spi-sprd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c index 8daa24eec624..fa324ce194b2 100644 --- a/drivers/spi/spi-sprd.c +++ b/drivers/spi/spi-sprd.c @@ -380,7 +380,7 @@ static int sprd_spi_txrx_bufs(struct spi_device *sdev, struct spi_transfer *t) { struct sprd_spi *ss = spi_controller_get_devdata(sdev->controller); u32 trans_len = ss->trans_len, len; - int ret, write_size = 0; + int ret, write_size = 0, read_size = 0; while (trans_len) { len = trans_len > SPRD_SPI_FIFO_SIZE ? SPRD_SPI_FIFO_SIZE : @@ -416,13 +416,15 @@ static int sprd_spi_txrx_bufs(struct spi_device *sdev, struct spi_transfer *t) goto complete; if (ss->trans_mode & SPRD_SPI_RX_MODE) - ss->read_bufs(ss, len); + read_size += ss->read_bufs(ss, len); trans_len -= len; } - ret = write_size; - + if (ss->trans_mode & SPRD_SPI_TX_MODE) + ret = write_size; + else + ret = read_size; complete: sprd_spi_enter_idle(ss); -- 2.20.1