From patchwork Wed Sep 7 20:52:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9319911 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 CE1E3607D3 for ; Wed, 7 Sep 2016 20:55:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCA9B29425 for ; Wed, 7 Sep 2016 20:55:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B19D829429; Wed, 7 Sep 2016 20:55:53 +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 4B07829425 for ; Wed, 7 Sep 2016 20:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757102AbcIGUzt (ORCPT ); Wed, 7 Sep 2016 16:55:49 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33538 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756869AbcIGUzr (ORCPT ); Wed, 7 Sep 2016 16:55:47 -0400 Received: by mail-wm0-f67.google.com with SMTP id b187so852377wme.0 for ; Wed, 07 Sep 2016 13:55:46 -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=pjx9ke7ZgJc6h0YBDb6suxUKiKRl+ycvj9daaaY7bFo=; b=QUupaeRYsQzsr6/jDYzgBzco1fewmfgINfHUh5Ns1OLpjEd7zcNuu+dEhEBR34hEvG RsavqWsCt8vBPR/xRkzvgXP5xLdG0LtQRZDluK/7FvYyw9b8r76jSq2hpoyn8uFTG8RK 8pUkLITeOXXW2IkgnhW+Pz01pAPCrLgqDY3DT9458teilt7JxUcpQDBpZOv0hUZkfwXl GPQ9WtmhX36SG5ShZXMH6X7OW4DAZNLGyuH+wNjg4WS9lU+jXPfmKqn5D1/uImn9HaTa 6AVKjBpv5RlAbvVpufnJz1mfdxqJnykX12ZY8IQ9xd7j7WzjzLsgPqNYKFgpw9xAYgPO 6N3Q== 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=pjx9ke7ZgJc6h0YBDb6suxUKiKRl+ycvj9daaaY7bFo=; b=bXmiQt5IEAX4TVq7Iz7FW9D5Q+hnnDOCI6+pIJ1pKY2+k7w1jr9+FN0iVv+UDk8Mxs 2r9kpPj0qlqgfK5sEoOU5cfgwhtpTbTNQ+6vihvjTR+56YAb0cj4LS7qNeRGhYqWTYPN LbuZ7h45/dTUaqlldT6mo6tBdSWswi5U9S5R96V+2pjUj7wZ0BOZs8HLfzfjLjtESY65 WDBDMiF8ZzVwRSaysG/FSU0hOOS8uyeGy3kc/nDzilydwsPVykX613eveJ56I7z9nGWR H1iwPwt5Xf6TzXjlxmuVlOiQ0SyFTJvZC71IBCtxBTLNEKTZXB4irMKFksUdq9IfH/oT /I0Q== X-Gm-Message-State: AE9vXwNIfSpq4kv0K/7p/TyZkXZ6u1BRV3GG5Al+AGiEQICdvqPf6cVcDzEz340JhPdGOA== X-Received: by 10.28.61.87 with SMTP id k84mr5852280wma.98.1473281745160; Wed, 07 Sep 2016 13:55:45 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:6565:4488:ad4:60db? (p200300625F439500656544880AD460DB.dip0.t-ipconnect.de. [2003:62:5f43:9500:6565:4488:ad4:60db]) by smtp.googlemail.com with ESMTPSA id q139sm6039096wmb.18.2016.09.07.13.55.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Sep 2016 13:55:44 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v3 08/15] spi: fsl-espi: improve return value handling in fsl_espi_bufs To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <3d3ec02a-dfaf-0494-edaa-3a2871d0d4ec@gmail.com> Date: Wed, 7 Sep 2016 22:52:43 +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 v3: - new numbering --- 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);