From patchwork Wed Jun 15 23:40:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9179691 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 9DC3E604DB for ; Wed, 15 Jun 2016 23:41:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8565126B4A for ; Wed, 15 Jun 2016 23:41:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 793E427D4A; Wed, 15 Jun 2016 23:41:02 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 9CEB327C26 for ; Wed, 15 Jun 2016 23:41:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752819AbcFOXlB (ORCPT ); Wed, 15 Jun 2016 19:41:01 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:33005 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752631AbcFOXlA (ORCPT ); Wed, 15 Jun 2016 19:41:00 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O8U01QG8749ZT20@mailout1.samsung.com>; Thu, 16 Jun 2016 08:40:57 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.113]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 32.BC.05251.987E1675; Thu, 16 Jun 2016 08:40:57 +0900 (KST) X-AuditID: cbfee691-f79196d000001483-0e-5761e78906f4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id FD.51.06706.987E1675; Wed, 15 Jun 2016 16:40:57 -0700 (MST) Received: from samsunx.samsung ([10.113.63.54]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O8U003YQ746LA10@mmp2.samsung.com>; Thu, 16 Jun 2016 08:40:57 +0900 (KST) From: Andi Shyti To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: [PATCH] spi: add spi_sync_single_transfer wrapper for single spi_transfer Date: Thu, 16 Jun 2016 08:40:46 +0900 Message-id: <1466034046-718-1-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCLMWRmVeSWpSXmKPExsWyRsSkULfzeWK4wf5TyhbbjzxjtVj84zmT xdSHT9gsLu+aw2bR+PEmuwOrx/Uln5g9Nq3qZPPo27KK0ePzJrkAligum5TUnMyy1CJ9uwSu jEOHDQr6uSp+7FrE1sC4gaOLkZNDQsBE4svtC2wQtpjEhXvrgWwuDiGBFYwSEy80sncxcoAV LdsbAhGfxSgx9WcDVNFHRokra3YygnSzCWhKNN3+ATZJREBZ4ur3vSwgRcwCjYwSy3fcB0sI C4RIfN25hQXEZhFQlVhz9SkriM0r4CIxsaubHeIMOYnL0x+AbZAQeM8mcXfBIqgGAYlvkw+x QJwkK7HpADNEvaTEwRU3WCYwCi5gZFjFKJpakFxQnJReZKpXnJhbXJqXrpecn7uJERiYp/89 m7iD8f4B60OMAhyMSjy8Cx4lhguxJpYVV+YeYjQF2jCRWUo0OR8Y/nkl8YbGZkYWpiamxkbm lmZK4rw60j+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DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected 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 The spi_sync_single_transfer function calls spi_sync_transfer with a single spi_transfer element, instead of an array. Signed-off-by: Andi Shyti --- include/linux/spi/spi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 1f03483..660f6a1 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1051,6 +1051,24 @@ spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers, return spi_sync(spi, &msg); } +/** + * spi_sync_single_transfer - synchronous SPI data transfer of one spi_transfer + * @spi: device with which data will be exchanged + * @xfers: One spi_transfer struct + * Context: can sleep + * + * Does a synchronous SPI data transfer of a given spi_transfer. + * + * For more specific semantics see spi_sync_transfer(). + * + * It returns zero on success, else a negative error code. + */ +static inline int +spi_sync_single_transfer(struct spi_device *spi, struct spi_transfer *xfers) +{ + return spi_sync_transfer(spi, xfers, 1); +} + /* this copies txbuf and rxbuf data; for small transfers only! */ extern int spi_write_then_read(struct spi_device *spi, const void *txbuf, unsigned n_tx,