From patchwork Fri Sep 2 21:22:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9311689 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 DAFFD60772 for ; Fri, 2 Sep 2016 21:23:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAC972983D for ; Fri, 2 Sep 2016 21:23:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFD0F29848; Fri, 2 Sep 2016 21:23:03 +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=-5.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 64F3A2983D for ; Fri, 2 Sep 2016 21:23:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751951AbcIBVXD (ORCPT ); Fri, 2 Sep 2016 17:23:03 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33788 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751917AbcIBVXC (ORCPT ); Fri, 2 Sep 2016 17:23:02 -0400 Received: by mail-wm0-f68.google.com with SMTP id w207so4386633wmw.0 for ; Fri, 02 Sep 2016 14:23:01 -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=KEPq45dgJ7a12SE8z2tVLYOqgmRLkUDD93aexg3LPzc=; b=zxNi+LWDmj+XFRzPro1lx8i7Pd8LyNIorBDZxuenn7dfMr4XTTGH30+Kxhw2wHVYc1 EuI2TELGy6SgBNYked8MRiKFDu1BFpXv5LXcVpK3o+hO7j13aDtgNMlTgiPER+7RSxgo btyonbWv1D130Wc/7N8FSj/Krel14S9JTUxo37fJo5OBtKYYSOlGSErD2i+toGmdu808 RHogHd1boBJPrVAT9blCrpL5qWVWw8/olnmXNzRtCylnFmOdwfp8ODVBvo1vVN7+UsTL xMDNZIr+GT3heLTJ4u+RJMPAVy1n4mThzp4FRnzRD7m4idKdqfDtgJa6vEmUYkcV8Xzu dGsA== 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=KEPq45dgJ7a12SE8z2tVLYOqgmRLkUDD93aexg3LPzc=; b=coOzV+DeUukF3xZ/jxwRJFL9Q7k5A2GOKz60/EgloNR89qwxWLsaqqSz0EmXHshTJC eQb3n9QRfmAXTN/pXK/IpRLvepJiIFUSY/WrommaWVXL29K9XXEEBp4b18cSf80t8gJb Gz0ekasqp1KTGbyF27FXQjTSBU+lUuGlK06b9d4PuE8vDySVa88DZpsnvyxTVaz5mKBp TVuCEsvHsv1w9ZqEMFYrZBYM7jFrSTkd1qneX5ccn42TAcUI9YPEGONworlGYse2VjJM c4ZDnQYskGlnYcoXskiqED/LuGhjYx447erhmWk2NMhdPWfkpXtMF2hJ7QC50nfj/rAA XNvQ== X-Gm-Message-State: AE9vXwP9yZyv/dSvLMoZGSoMXMF77dzGLUlJ7dbFO1LA4jFhtonH9S/0+4j/N1x4VmdzpA== X-Received: by 10.194.200.99 with SMTP id jr3mr20907341wjc.14.1472851380858; Fri, 02 Sep 2016 14:23:00 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:39ed:a1fb:9a43:e02d? (p200300625F43950039EDA1FB9A43E02D.dip0.t-ipconnect.de. [2003:62:5f43:9500:39ed:a1fb:9a43:e02d]) by smtp.googlemail.com with ESMTPSA id c16sm5421416wme.4.2016.09.02.14.23.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Sep 2016 14:23:00 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v2 16/23] spi: fsl-espi: improve return value handling in fsl_espi_bufs To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <7112aa16-5106-0cdb-0006-594315f1031c@gmail.com> Date: Fri, 2 Sep 2016 23:22:24 +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 --- v2: - rebased --- 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 f8a6dd1..8d6a570 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -258,7 +258,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) @@ -288,9 +288,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);