From patchwork Sat Jan 18 14:05:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3508391 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E9FA3C02DC for ; Sat, 18 Jan 2014 14:05:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 325EA20142 for ; Sat, 18 Jan 2014 14:05:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 592B920148 for ; Sat, 18 Jan 2014 14:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbaAROF1 (ORCPT ); Sat, 18 Jan 2014 09:05:27 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:55737 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752032AbaAROF1 (ORCPT ); Sat, 18 Jan 2014 09:05:27 -0500 Received: by mail-pa0-f50.google.com with SMTP id kp14so5230830pab.23 for ; Sat, 18 Jan 2014 06:05:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=53Pt517hfFVaWAZiQAGt8/VPwtslapKUXGzh96UBBzg=; b=HASMtkgavIIwdWVheQN6MPFM/3UAy7Ck6/PTSwKseO09pg3q3kQmg6eVepyZ2lMo7X ByqRlGH6/GNPsT5MCnWS/Tsx47BA0QHwZlO0lXkoC8Uad3u5M3mvkpq8/Dvvm094nqVq mvtxeL+63IscazHfP22n2RcRwwIZSnR0HK9KJGTzCUXlOf67FFjSVogoXdC1EH6zjAiZ ngZrfpq3XuNDN/B0X6pk6ndq83YbIB0X8pvhFptr3VliQl6SP8vbbowruNtl/ZlhFA/Q 4rhFSWOkQwRpAHIb1p0zDOuLF11Aan/iYYy/uCmFCl4+YyoYR9QoUpsH+JKnn2M0opFn JJ1g== X-Gm-Message-State: ALoCoQm4uFTjk4z8L3f2suTiD9wkn9BE8+6oUY8HEMJd3ax71KgM8jGfaWbf5L0+1gpokaJsbCiI X-Received: by 10.66.149.231 with SMTP id ud7mr8396968pab.8.1390053926807; Sat, 18 Jan 2014 06:05:26 -0800 (PST) Received: from [192.168.0.102] (220-143-33-230.dynamic.hinet.net. [220.143.33.230]) by mx.google.com with ESMTPSA id x5sm30553205pbw.26.2014.01.18.06.05.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 Jan 2014 06:05:25 -0800 (PST) Message-ID: <1390053922.16621.4.camel@phoenix> Subject: [PATCH] spi: core: Fix transfer failure when master->transfer_one returns positive value From: Axel Lin To: Mark Brown Cc: linux-spi@vger.kernel.org Date: Sat, 18 Jan 2014 22:05:22 +0800 X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP master->transfer_one returns positive value is not a error. So set ret to 0 when master->transfer_one returns positive value. Otherwise, I hit "spi_master spi0: failed to transfer one message from queue" error when my transfer_one callback returns 1. Signed-off-by: Axel Lin --- drivers/spi/spi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index db421bd..11fefd5 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -609,8 +609,10 @@ static int spi_transfer_one_message(struct spi_master *master, goto out; } - if (ret > 0) + if (ret > 0) { + ret = 0; wait_for_completion(&master->xfer_completion); + } trace_spi_transfer_stop(msg, xfer);