From patchwork Mon Sep 25 10:40:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harinath Nampally X-Patchwork-Id: 9969643 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 D64176038E for ; Mon, 25 Sep 2017 10:40:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAAF828B66 for ; Mon, 25 Sep 2017 10:40:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF43128B7F; Mon, 25 Sep 2017 10:40:35 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 100C328B66 for ; Mon, 25 Sep 2017 10:40:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934641AbdIYKkQ (ORCPT ); Mon, 25 Sep 2017 06:40:16 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:35472 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933162AbdIYKkP (ORCPT ); Mon, 25 Sep 2017 06:40:15 -0400 Received: by mail-oi0-f66.google.com with SMTP id r20so3464330oie.2; Mon, 25 Sep 2017 03:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bFbLjn/vhu/5+ZDaGjzAjmBKDgzdJGKAsloCxC9a4CA=; b=WrXMwfHjKc8ZqUSHKNqOvy8OG/OEoWpHacCwyAXU7HmXFdCPPRrXI7i2Lh2geXbHCr O8g+CWBb4SmdU7ZOXQfZg7X9F4uLKF+7x/3Q3Uld91vc76C7dKg74CSwvyu9FHiaLUH3 o72v1BoaHznj+ZDGy3ieIdfvCTHKV2n16IOJPiYNbUqMmXiZq9snxHKAg9cC7zPKoZax +FR1vxLNiK6r/lfxe2oIjBFbvgfqdm8FxDDpoRgSf1PyGfqX7T9UOs7hYqeMFljqJft7 CTqJhkWVFZA8/lHjahjGtALTcvfPN9w4cjLjdmOe3NLZNRlUWzQsOehuUmQ7cndX9H+y ydgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bFbLjn/vhu/5+ZDaGjzAjmBKDgzdJGKAsloCxC9a4CA=; b=CLrW+5LpPf2hq8Flga1aaxatmZQS6aFrQawCIoQi0Ilr20lIzw9WY7fyKrfS1XD/Wz mzcoTeiet2jIGOJbd2cT8vCsTe3PUxMN1Hv1mu4nJaHtedwELYeeAt2CXiPJQ/d1MBHt 53YaG062vBWJR6pkl74pODIbHj2VmyHKUROqFkBU7TZ53qyY+IZPdAvOeiDVM4lPx4gL yukT+ye8H/WedCkgTNIhiuBvwDsBSdHJwdKDV3kKcdClvOnMKmc/Pe+sWLrbcF9ytaZr kgcr+SaTTwbuuF7AGUAbFQIYKrXTvHJKT2/4PBNxdGkpLNKd3w+5hhyH/JpY+VYngMOV sogw== X-Gm-Message-State: AHPjjUiwkHF7qcCH6a5hqUh47qW3O9PdUfg5HNTSpyna0uZykLTOHzOK 5vLZFonrYjLVI0QV5Vj3GCY= X-Google-Smtp-Source: AOwi7QCq2b+TyDCwfUMj0qi54G+SHXFY+quueVI6iTJX86abNDjS4olOW5lj4+91H3BTTz5Ud11pXQ== X-Received: by 10.157.25.169 with SMTP id k38mr44462otk.177.1506336014349; Mon, 25 Sep 2017 03:40:14 -0700 (PDT) Received: from hary-Aspire-X3400G.Belkin ([97.70.80.173]) by smtp.googlemail.com with ESMTPSA id l17sm114750ote.74.2017.09.25.03.40.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Sep 2017 03:40:13 -0700 (PDT) From: Harinath Nampally To: jic23@kernel.org Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, amsfield22@gmail.com, martink@posteo.de Subject: [PATCH v3 2/3] iio: accel: mma8452: Rename time step look up struct to generic name as the values are same for all the events. Date: Mon, 25 Sep 2017 06:40:07 -0400 Message-Id: <1506336008-4480-3-git-send-email-harinath922@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506336008-4480-1-git-send-email-harinath922@gmail.com> References: <1506336008-4480-1-git-send-email-harinath922@gmail.com> 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 Improves code readability, no impact on functionality. Signed-off-by: Harinath Nampally --- drivers/iio/accel/mma8452.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 3472e7e..74b6221 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -284,7 +284,7 @@ static const int mma8452_samp_freq[8][2] = { }; /* Datasheet table: step time "Relationship with the ODR" (sample frequency) */ -static const unsigned int mma8452_transient_time_step_us[4][8] = { +static const unsigned int mma8452_time_step_us[4][8] = { { 1250, 2500, 5000, 10000, 20000, 20000, 20000, 20000 }, /* normal */ { 1250, 2500, 5000, 10000, 20000, 80000, 80000, 80000 }, /* l p l n */ { 1250, 2500, 2500, 2500, 2500, 2500, 2500, 2500 }, /* high res*/ @@ -826,7 +826,7 @@ static int mma8452_read_thresh(struct iio_dev *indio_dev, if (power_mode < 0) return power_mode; - us = ret * mma8452_transient_time_step_us[power_mode][ + us = ret * mma8452_time_step_us[power_mode][ mma8452_get_odr_index(data)]; *val = us / USEC_PER_SEC; *val2 = us % USEC_PER_SEC; @@ -883,7 +883,7 @@ static int mma8452_write_thresh(struct iio_dev *indio_dev, return ret; steps = (val * USEC_PER_SEC + val2) / - mma8452_transient_time_step_us[ret][ + mma8452_time_step_us[ret][ mma8452_get_odr_index(data)]; if (steps < 0 || steps > 0xff)