From patchwork Wed Jan 9 14:08:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 1952991 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 8C24BDF215 for ; Wed, 9 Jan 2013 14:09:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1TswL7-00069Z-Qg; Wed, 09 Jan 2013 14:09:09 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1TswL6-00069U-Gw for spi-devel-general@lists.sourceforge.net; Wed, 09 Jan 2013 14:09:08 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of srs.kundenserver.de designates 212.227.17.10 as permitted sender) client-ip=212.227.17.10; envelope-from=SRS0=dJwT=LC=gmx.de=g.liakhovetski@srs.kundenserver.de; helo=moutng.kundenserver.de; Received: from moutng.kundenserver.de ([212.227.17.10]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1TswL4-0003qY-K9 for spi-devel-general@lists.sourceforge.net; Wed, 09 Jan 2013 14:09:08 +0000 Received: from axis700.grange (dslb-178-006-043-106.pools.arcor-ip.net [178.6.43.106]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0MYYR3-1TWXot2gr3-00VBqA; Wed, 09 Jan 2013 15:08:55 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 09E6340B99; Wed, 9 Jan 2013 15:08:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id EDFD240B98; Wed, 9 Jan 2013 15:08:53 +0100 (CET) Date: Wed, 9 Jan 2013 15:08:53 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Grant Likely Subject: [PATCH v2 1/2] spi: bitbang: simplify pointer arithmetics Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:DCwXC9dJs6/eWsFdNyP3ek40wgWpCJWV61EHBIAhczn rIbhWPT8bnU6IL043q7kwuVbrBy1NHvG3yV0j1VHqWOR60y42f r+meAg/MnNoiglVmqs7R53/khlqyf0eg2pLqY5YCMjZsvRZrlW kda0CQAPVkv918fGk9MpfiR3fr+YJhB8C2n4w2t97tSZYODbNC d0gtAPWFzjMZwaw8xpj7WR537/f0aCOK+08xPpXsr6uYkPM9BB iXVql18uZfnjyg+MYvGAtwrNvSJEzhyU9hceiDuKxNNaNkR2YC qhKaB3lOJFIHXfbHvI96SC+dedWFMUCiHzRQ8QI/TBedZnTh1l IUU3djoCOr5GmvHqtIGv929X3SVjDC5bAIfqY09PziDb2Th/q2 Oa89X7rW+/a3g== X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (g.liakhovetski[at]gmx.de) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.10 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1TswL4-0003qY-K9 Cc: spi-devel-general@lists.sourceforge.net, Linus Walleij , Magnus Damm , linux-sh@vger.kernel.org X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net Add a pointer variable to make spi_bitbang_start() look simpler. Signed-off-by: Guennadi Liakhovetski Acked-by: Linus Walleij --- Hi Grant As requested by you in http://thread.gmane.org/gmane.linux.kernel.spi.devel/10065/focus=10114 I've split off this minor change - adding a "master" pointer and dropped other unrelated changes like renaming m -> msg etc. The resultime core patch "with space changes filtered out" looks much smaller now. drivers/spi/spi-bitbang.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index 8b3d8ef..328c4dc 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -427,40 +427,41 @@ EXPORT_SYMBOL_GPL(spi_bitbang_transfer); */ int spi_bitbang_start(struct spi_bitbang *bitbang) { - int status; + struct spi_master *master = bitbang->master; + int status; - if (!bitbang->master || !bitbang->chipselect) + if (!master || !bitbang->chipselect) return -EINVAL; INIT_WORK(&bitbang->work, bitbang_work); spin_lock_init(&bitbang->lock); INIT_LIST_HEAD(&bitbang->queue); - if (!bitbang->master->mode_bits) - bitbang->master->mode_bits = SPI_CPOL | SPI_CPHA | bitbang->flags; + if (!master->mode_bits) + master->mode_bits = SPI_CPOL | SPI_CPHA | bitbang->flags; - if (!bitbang->master->transfer) - bitbang->master->transfer = spi_bitbang_transfer; + if (!master->transfer) + master->transfer = spi_bitbang_transfer; if (!bitbang->txrx_bufs) { bitbang->use_dma = 0; bitbang->txrx_bufs = spi_bitbang_bufs; - if (!bitbang->master->setup) { + if (!master->setup) { if (!bitbang->setup_transfer) bitbang->setup_transfer = spi_bitbang_setup_transfer; - bitbang->master->setup = spi_bitbang_setup; - bitbang->master->cleanup = spi_bitbang_cleanup; + master->setup = spi_bitbang_setup; + master->cleanup = spi_bitbang_cleanup; } - } else if (!bitbang->master->setup) + } else if (!master->setup) return -EINVAL; - if (bitbang->master->transfer == spi_bitbang_transfer && + if (master->transfer == spi_bitbang_transfer && !bitbang->setup_transfer) return -EINVAL; /* this task is the only thing to touch the SPI bits */ bitbang->busy = 0; bitbang->workqueue = create_singlethread_workqueue( - dev_name(bitbang->master->dev.parent)); + dev_name(master->dev.parent)); if (bitbang->workqueue == NULL) { status = -EBUSY; goto err1; @@ -469,7 +470,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) /* driver may get busy before register() returns, especially * if someone registered boardinfo for devices */ - status = spi_register_master(bitbang->master); + status = spi_register_master(master); if (status < 0) goto err2;