From patchwork Sat Nov 22 15:21:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beniamino Galvani X-Patchwork-Id: 5359521 Return-Path: X-Original-To: patchwork-linux-arm@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 13B14C11AC for ; Sat, 22 Nov 2014 15:27:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22E2C20145 for ; Sat, 22 Nov 2014 15:27:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F0FC2013D for ; Sat, 22 Nov 2014 15:27:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XsCYQ-0007bx-6X; Sat, 22 Nov 2014 15:24:54 +0000 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XsCYD-0007Wc-7Z for linux-arm-kernel@lists.infradead.org; Sat, 22 Nov 2014 15:24:42 +0000 Received: by mail-wg0-f42.google.com with SMTP id z12so9030617wgg.29 for ; Sat, 22 Nov 2014 07:24:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NplbvmPooj3le34tsx8D8IHjMKZeeK2Az6N/fmvPIh4=; b=p5iqdEbc4LMR1eLEuFc/6ohhxf/xbNcJ1SwSMMi33GdyrIF093nukqQEBaKaY5+OoM qEpfF5Qq9yoqy0FEVWn6+PQrcdY7SBqJJzX/N2wRoXOrH7AjSG072xsYru9lbMTpv4Np 9imqf1ODPaJNGz/vzZblr77bo185KPC4XxFoV9AclS4b6XfTleRK8ml7Qypv7tDf3yvA uZSFnAndU5Q0yRrSxJnuobyCqtzAuFhKNrtbhqEyMBvPlD9o9ISYqVVpIfUaRNPJCZJ+ ByjaAHI/+0KPy1uRgzm9qcg2XfO/aSLyUhUwQJCHjpmL7s6etXijHc3XN+j5z0nCjVOX n9gA== X-Received: by 10.194.243.164 with SMTP id wz4mr18088132wjc.129.1416669858994; Sat, 22 Nov 2014 07:24:18 -0800 (PST) Received: from sark.local (host115-93-dynamic.40-79-r.retail.telecomitalia.it. [79.40.93.115]) by mx.google.com with ESMTPSA id gy4sm3648520wib.11.2014.11.22.07.24.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Nov 2014 07:24:18 -0800 (PST) From: Beniamino Galvani To: Mark Brown Subject: [PATCH v3 1/4] spi: core: Add spi_transfer_is_last() helper Date: Sat, 22 Nov 2014 16:21:39 +0100 Message-Id: <1416669702-7841-2-git-send-email-b.galvani@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416669702-7841-1-git-send-email-b.galvani@gmail.com> References: <1416669702-7841-1-git-send-email-b.galvani@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141122_072441_461276_4BEDD9FC X-CRM114-Status: UNSURE ( 8.97 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) Cc: Mark Rutland , devicetree@vger.kernel.org, Russell King , Victor Wan , Pawel Moll , Ian Campbell , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Beniamino Galvani , Rob Herring , Kumar Gala , Carlo Caione , Jerry Cao , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_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 This adds the function spi_transfer_is_last() which can be used by drivers to know whether a given transfer is the last one in the current message. Signed-off-by: Beniamino Galvani --- include/linux/spi/spi.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 46d188a..a6ef2a8 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1049,4 +1049,10 @@ spi_unregister_device(struct spi_device *spi) extern const struct spi_device_id * spi_get_device_id(const struct spi_device *sdev); +static inline bool +spi_transfer_is_last(struct spi_master *master, struct spi_transfer *xfer) +{ + return list_is_last(&xfer->transfer_list, &master->cur_msg->transfers); +} + #endif /* __LINUX_SPI_H */