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: 5359511 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 28B5D9F2ED for ; Sat, 22 Nov 2014 15:25:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 529DE20145 for ; Sat, 22 Nov 2014 15:25:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91F0520131 for ; Sat, 22 Nov 2014 15:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752287AbaKVPZS (ORCPT ); Sat, 22 Nov 2014 10:25:18 -0500 Received: from mail-wi0-f174.google.com ([209.85.212.174]:53899 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751947AbaKVPYU (ORCPT ); Sat, 22 Nov 2014 10:24:20 -0500 Received: by mail-wi0-f174.google.com with SMTP id h11so1897534wiw.7 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 Cc: linux-spi@vger.kernel.org, Carlo Caione , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Russell King , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Jerry Cao , Victor Wan , Beniamino Galvani 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> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 */