From patchwork Thu Aug 25 04:49:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9298641 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CDFDA608A7 for ; Thu, 25 Aug 2016 04:54:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC6DA291C5 for ; Thu, 25 Aug 2016 04:54:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B16EB291C8; Thu, 25 Aug 2016 04:54:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B73B291C5 for ; Thu, 25 Aug 2016 04:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754559AbcHYEyq (ORCPT ); Thu, 25 Aug 2016 00:54:46 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36786 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754537AbcHYEx2 (ORCPT ); Thu, 25 Aug 2016 00:53:28 -0400 Received: by mail-wm0-f65.google.com with SMTP id i138so5623349wmf.3 for ; Wed, 24 Aug 2016 21:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=lFytqOC+GCwMKXbo643WfA2GCexu4TjA65WgktRUYpA=; b=RRlpL+d1j/+bk6QdAyBEIBhPtveUJVQDYzGLx7jfBrITU6D9cih3JbHHaDmnw7iZbP 52EBUGxAwAYM4pm/mtFOxDMczeYm1MgyOFS4Q4M+tmh89ZK8NDBENJ0QPmO+N40VWg3r 6wUkHs203qyI5rbUCi7hhgRt92cxh3WBAsYauXI1U6n+TFIwFLjdrllNJkMXl/cau28Z HCmY1OxNzHFtGQKTj83LXkN1V7wSGpkAr5bs6XjGKSLepEqWsQ8HsOa/D+0BjEb6awOH HpoDHcNU/N7oXKdLzYgTNJ3C78b53g6Uo0/imn1lflmWOnQpXuD+8HNzhNil7Q+JYUpB 0ipA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=lFytqOC+GCwMKXbo643WfA2GCexu4TjA65WgktRUYpA=; b=DywkE6D3UP9hnv7LY/+SILyMYYUswN3vMqDp8S2doBGsP5hr8kxC1usZ8COfGJKKex vYntP0KXPrBff4XGgbhfVO+WRuiTnTqOzTRK6gzEVv2JT60kyjS0lnGNfGX2QjI0vDCX DiLYZvYQU2ghAK4kg2j9NZCysr/AJ453l3xO1LbaPm0N3oFSvq1ntelMn7x9ScSqAmeJ QG6lahZKwnjyb+DhRjFxU7tP2msXkpI2Uja6Lbv5V+G54WwwNUbSVagjmIiyHk+2K+D3 +lXjoC/UyIdfAC7FCweewXEtE8xrce9/o0B56pfRA51/umTMXBpVrSce5dDzXrumHtEx Ycxw== X-Gm-Message-State: AE9vXwOZ4InTycjFzrA1NQM0pvh2xGfJ6Y4Ohpv8HxjIASb5Nq8ozx1Zr7P4BeDEtTn1LA== X-Received: by 10.28.232.149 with SMTP id f21mr6066267wmi.51.1472100806736; Wed, 24 Aug 2016 21:53:26 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:dd82:2805:e44f:720e? (p200300625F439500DD822805E44F720E.dip0.t-ipconnect.de. [2003:62:5f43:9500:dd82:2805:e44f:720e]) by smtp.googlemail.com with ESMTPSA id 3sm13787391wms.1.2016.08.24.21.53.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 21:53:26 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 15/23] spi: fsl-espi: improve return value handling in fsl_espi_bufs To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: Date: Thu, 25 Aug 2016 06:49:10 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Return a proper status code from fsl_espi_bufs instead of returning the number of remaining words and let the caller evaluate it. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-fsl-espi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 4c64012..821ec3e 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -259,7 +259,7 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) /* disable rx ints */ mpc8xxx_spi_write_reg(®_base->mask, 0); - return mpc8xxx_spi->count; + return mpc8xxx_spi->count > 0 ? -EMSGSIZE : 0; } static int fsl_espi_do_trans(struct spi_message *m, struct spi_transfer *trans) @@ -289,9 +289,6 @@ static int fsl_espi_do_trans(struct spi_message *m, struct spi_transfer *trans) if (trans->len) ret = fsl_espi_bufs(spi, trans); - if (ret) - ret = -EMSGSIZE; - if (trans->delay_usecs) udelay(trans->delay_usecs);