From patchwork Wed Mar 21 10:29:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Masney X-Patchwork-Id: 10299079 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 3859F60349 for ; Wed, 21 Mar 2018 10:30:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6F3529806 for ; Wed, 21 Mar 2018 10:30:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2BE129800; Wed, 21 Mar 2018 10:30:07 +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_SIGNED, 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 16A5829800 for ; Wed, 21 Mar 2018 10:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751747AbeCUK3j (ORCPT ); Wed, 21 Mar 2018 06:29:39 -0400 Received: from onstation.org ([52.200.56.107]:47380 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751480AbeCUK32 (ORCPT ); Wed, 21 Mar 2018 06:29:28 -0400 Received: from xilitla.hsd1.wv.comcast.net (c-98-236-77-125.hsd1.wv.comcast.net [98.236.77.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 2A5DF1E73; Wed, 21 Mar 2018 10:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=onstation.org; s=default; t=1521628167; bh=dfRO0213uPJZ4/XaPJjCM3RRPvz+V5ocQNf2sm/OJNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxD8hLPR6ktWwUBlNNhv6r9Htxcy2k9P8a1l7gzKbGfUoJXUOY7t4ysFoLzQjq2VY 3ySTa73KqJXoMwrUdNbgfXV3BiMs16swxBmY0Ka7a3xlhsW8rvmvXCxyAd1HCod1U1 V8lhGMu8p7j1CYwtjQZ7pT8E061DjSEQkhvM14+U= From: Brian Masney To: jic23@kernel.org, linux-iio@vger.kernel.org Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-kernel@vger.kernel.org, Jon.Brenner@ams.com Subject: [PATCH 10/11] staging: iio: tsl2x7x: put local variables in reverse Christmas tree order Date: Wed, 21 Mar 2018 06:29:11 -0400 Message-Id: <20180321102912.5130-11-masneyb@onstation.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180321102912.5130-1-masneyb@onstation.org> References: <20180321102912.5130-1-masneyb@onstation.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch ensures that all of the local variable declarations are in reverse Christmas tree order where possible to increase code readability. Signed-off-by: Brian Masney --- drivers/staging/iio/light/tsl2x7x.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c index 65b7fbca8c5d..5f78664d2b0e 100644 --- a/drivers/staging/iio/light/tsl2x7x.c +++ b/drivers/staging/iio/light/tsl2x7x.c @@ -336,13 +336,12 @@ static int tsl2x7x_write_control_reg(struct tsl2X7X_chip *chip, u8 data) */ static int tsl2x7x_get_lux(struct iio_dev *indio_dev) { - u32 lux; /* raw lux calculated from device data */ - u64 lux64; - u32 ratio; - u8 buf[4]; - struct tsl2x7x_lux *p; struct tsl2X7X_chip *chip = iio_priv(indio_dev); + struct tsl2x7x_lux *p; + u32 lux, ratio; int i, ret; + u64 lux64; + u8 buf[4]; mutex_lock(&chip->als_mutex); @@ -589,13 +588,9 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev) static int tsl2x7x_chip_on(struct iio_dev *indio_dev) { - int i; - int ret = 0; - u8 *dev_reg; - int als_count; - int als_time; struct tsl2X7X_chip *chip = iio_priv(indio_dev); - u8 reg_val = 0; + int ret, i, als_count, als_time; + u8 *dev_reg, reg_val; /* Non calculated parameters */ chip->tsl2x7x_config[TSL2X7X_PRX_TIME] = chip->settings.prx_time; @@ -1121,8 +1116,8 @@ static int tsl2x7x_read_raw(struct iio_dev *indio_dev, int *val2, long mask) { - int ret = -EINVAL; struct tsl2X7X_chip *chip = iio_priv(indio_dev); + int ret = -EINVAL; switch (mask) { case IIO_CHAN_INFO_PROCESSED: @@ -1583,9 +1578,9 @@ static const struct tsl2x7x_chip_info tsl2x7x_chip_info_tbl[] = { static int tsl2x7x_probe(struct i2c_client *clientp, const struct i2c_device_id *id) { - int ret; struct iio_dev *indio_dev; struct tsl2X7X_chip *chip; + int ret; indio_dev = devm_iio_device_alloc(&clientp->dev, sizeof(*chip)); if (!indio_dev)