From patchwork Mon Sep 25 03:15:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harinath Nampally X-Patchwork-Id: 9969195 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 9420060365 for ; Mon, 25 Sep 2017 03:16:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 886FA28C07 for ; Mon, 25 Sep 2017 03:16:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D69C28C0C; Mon, 25 Sep 2017 03:16:13 +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 2577128C07 for ; Mon, 25 Sep 2017 03:16:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932777AbdIYDQM (ORCPT ); Sun, 24 Sep 2017 23:16:12 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:33646 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932076AbdIYDPj (ORCPT ); Sun, 24 Sep 2017 23:15:39 -0400 Received: by mail-oi0-f65.google.com with SMTP id z73so2943317oia.0; Sun, 24 Sep 2017 20:15:39 -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=sOmDpBWvRVSWOYtijuuh5ZFX1ihEl3pbRqNP25c94ExbEizF+sFKo0kh/m1cK3cWLa l+A+8z/ZY4aFso1KDviN4Lf8k5LuoaLyiQ3KUrldVUIrsKMQKkoqBTFT40/2EPUPgYZ/ 1rZCGQzk5WQnvx/8+dVeFzNp+wKCYfBuzgV+g8TyH+YBAf9c6OGX3mUk/nyq3N2810f/ Uj+49T9zqDZSKDWFfE1/HUTbI5bHKrWj0wQerzBdEPLZLiEfLMT8YqLNCPB9+Vpdr/Py x8Bd+hEsso9EU32l7vffdopJ7ynx7lH5IiMmh7V0IB7Wp5pYjWS6tAKqtvofrntET4pS N3OA== 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=oShark30KISlMnvHwk5DeZhgCwlfmV9lOqQsveANzip6uW2/TLD1MhFaYSzAj/urq/ bVrqev//bqufQZ+ZRebeSpg5ArmRRxS1mmsj7MUlly/PuJr4i7WZ2ErTu30AYPDzJOZG cGnlLJ1cU43DggOk1FxpBKUwod7WV6qN1V6FLa3oWptTfg+29ozPaJT7p+6aPX47UPz4 62iyiU2gHgttKCwsOtHQ1kg8x2LcUxlzLJXRpNNwbuZInSP4Sd4+c/dYmNYdTe5Lho4x EVbc/AaTn6cpmWMhEF7YkbSRLCb3vVYEb4zodevcY+f5cI8wkVgeHV6nqT2l6tpi3yyS wrpw== X-Gm-Message-State: AHPjjUiFfatwV9mMif1fu9/sxiu4HOahkXwTkeXFoHTVb5Y45QMN4zFr o6JUrkGQ0rhbGIvnRLMd6C0= X-Google-Smtp-Source: AOwi7QAKc3AIZYh3S9bH1QF8mvFjRDA7VBKYjN4xucGRDt6WrzYUW6Tna092Q4EmEqDovhEQO7w0Zg== X-Received: by 10.202.92.130 with SMTP id q124mr6965673oib.213.1506309339173; Sun, 24 Sep 2017 20:15:39 -0700 (PDT) Received: from hary-Aspire-X3400G.Belkin ([97.70.80.173]) by smtp.googlemail.com with ESMTPSA id i32sm99603ote.76.2017.09.24.20.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Sep 2017 20:15:38 -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 1/3] iio: accel: mma8452: Rename time step look up struct to generic name as the values are same for all the events. Date: Sun, 24 Sep 2017 23:15:31 -0400 Message-Id: <1506309333-1970-2-git-send-email-harinath922@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506309333-1970-1-git-send-email-harinath922@gmail.com> References: <1506309333-1970-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)