From patchwork Mon Sep 25 10:07:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harinath Nampally X-Patchwork-Id: 9969559 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 8DFA260393 for ; Mon, 25 Sep 2017 10:08:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E0F028A58 for ; Mon, 25 Sep 2017 10:08:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72B8C28066; Mon, 25 Sep 2017 10:08:36 +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 103D128A58 for ; Mon, 25 Sep 2017 10:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934055AbdIYKId (ORCPT ); Mon, 25 Sep 2017 06:08:33 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:35494 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932627AbdIYKHw (ORCPT ); Mon, 25 Sep 2017 06:07:52 -0400 Received: by mail-oi0-f65.google.com with SMTP id r20so3415302oie.2; Mon, 25 Sep 2017 03:07:52 -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=gm5hdbLDLecsOq6ElR7HS5Und5k1Erj9R+/5taRNA8d1Q6wcgWym3NhdlF/5womCTq tn21yVPt1vvxtIjiVTfxshqqdxWEjlkxEpmJiEQqRsT4lKromVTbLCDld8jV44BLNahl 2LekXWvT/Kww3ZJ4ti9OTyHu18dISXWWdYVhYKEZbNIDSvWZ631QlPH2p9AfqOTQcf8L flcorzpPg8en4DR12UFpJa4gYHEPREagT95k7raMJSVurQSTydxDfIJhXKC91nq2WJae DOMICoYJ7Mm4ccItW0ikYMb0x8Y0J6hw/dqXKM8qSt1n4b0pcSYn8vaZM5xgpGuMXExV g5SA== 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=M9rcNMRW/qXNiziHYSSgKZZYo+5Ap1qVpPiaFoX/7BF1mCO4/d4QlOOflRrePTGoTZ 0JoabEcBPkbi7IOf9Z6GAk7dOQRJQ/Q8RfZXhYajRA9BvDoXiiXgkUOgb4EsUiO33Aqb x90hh5WZj+D/zoczDk4fx472PcyPj98HqvupoD+NuKOHxvjaTF2BJcq7SyFEn733N77V 8CTvzpU3ottO85/ypzg1TIdc7bWOgPDosrB+paeNPhHeDfH6X8TBDjZSwHnfXz9vVb9u cYKSay3nnDwvog3XzTZBRbuAZQcTsdvJ9g2B9UU9QGTWZFUHDJ5ID4a4rqFkQ2ILMp9l k5Zw== X-Gm-Message-State: AHPjjUjO7FQmrAshIM/N4BJioZHGkva6DTEVmMHRixGh+mqfrgdMZ7o/ 4/3SOJkPJtJUoviH/1pZ858= X-Google-Smtp-Source: AOwi7QBXiViK9eMAxCuP3ZT+RkEeixnGzbGp6yVzy+bj5NxF/cB8PfFC1T4J6fOuMTk5qr7J5nsRmQ== X-Received: by 10.202.106.198 with SMTP id f189mr8418872oic.50.1506334071989; Mon, 25 Sep 2017 03:07:51 -0700 (PDT) Received: from hary-Aspire-X3400G.Belkin ([97.70.80.173]) by smtp.googlemail.com with ESMTPSA id x206sm6998815oig.55.2017.09.25.03.07.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Sep 2017 03:07:51 -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 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:07:43 -0400 Message-Id: <1506334065-2891-3-git-send-email-harinath922@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506334065-2891-1-git-send-email-harinath922@gmail.com> References: <1506334065-2891-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)