From patchwork Mon Mar 5 07:49:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 10258305 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 14E8360134 for ; Mon, 5 Mar 2018 07:51:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0486A2896B for ; Mon, 5 Mar 2018 07:51:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBCD82896E; Mon, 5 Mar 2018 07:51:32 +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=-5.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, 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 A6EFF2896B for ; Mon, 5 Mar 2018 07:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752394AbeCEHvS (ORCPT ); Mon, 5 Mar 2018 02:51:18 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33591 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933248AbeCEHu0 (ORCPT ); Mon, 5 Mar 2018 02:50:26 -0500 Received: by mail-pf0-f196.google.com with SMTP id q13so6878624pff.0; Sun, 04 Mar 2018 23:50:26 -0800 (PST) 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=IiJdkycp7lgFW7b1A7calj2NmYTeg1Y+HVwY0EBYKPs=; b=vU+Y6N+brAvGV0y/ZfEOZSdIjMaG0OSzFGjS5QYibiC28tNFRxMXilLda9BbKp0Wgb aK15kV5gg+aBTN94OhLOM/j2K3fA4vXKD8VbYykygOm151LulHdmfw0w7rIIGoWLYkTV 8TG/VQEmwkeVBX+UbNeI7FZwfwlKk3DUxF9Yek+72XmTLMuQ9wcTceSrb0qPaBIVV+9o obC9WRQquZdkn+9bRMfdnSpBYjpitxpmzeWzzXJDcRV2IKkvLNxQGh8xoeqtjngw8j+4 cf5lN9vNIa8tIliUPYxH5lHyI0zPchHfuTHuOWp+pejBtOFnOhJhOrI5Ia2UMADxcOR/ n8Aw== 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=IiJdkycp7lgFW7b1A7calj2NmYTeg1Y+HVwY0EBYKPs=; b=qzJAxfhQHZGUzfAypM3jeYI2EsInLMTtHSYv1OH6lN4iqvqkmIAO16vTmm9D5bD2wu AyY77n7240YKYfYbNfpqeFlPs+oqqAiFLkoXyeV51cx5JxiZnKdscJTq5GzVNAaGCpON rsDK/mjX9fZ6GucSD6ufDqqN5nKiuwAJUP6Hx0ZSoV8/SjuBtE1iVCTEDMFabr5QuV1s upsGYECi4gO1kSIhElxtD8HiAEADFzrCE9EVV4Wut8oszgLMnH8YaDGFgwMoumr28VUT hH5rIwi4ztyq0cYjzhsa8UCl+klo9u7JLl0JdS6Y2fnDEWSH3dGOhPljsvglrjeMqy6E WJOw== X-Gm-Message-State: AElRT7FHbm2f8e0NBpf3KB73jcEtOPaFIEuL4nZxk9PBjbo11l+vLaax zmhEVWDAO76rr3xMaNeI3jI= X-Google-Smtp-Source: AG47ELsI4sjcP0sseRzQAPcGbU+oKhRgIYBW5FbZqbrqFxgSXbPlQX3BqGIe1EP3mEC8ulg++eH85A== X-Received: by 10.101.78.139 with SMTP id b11mr4380329pgs.229.1520236225808; Sun, 04 Mar 2018 23:50:25 -0800 (PST) Received: from localhost.localdomain ([103.46.193.14]) by smtp.gmail.com with ESMTPSA id 125sm21674256pff.114.2018.03.04.23.50.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Mar 2018 23:50:25 -0800 (PST) From: Himanshu Jha To: jic23@kernel.org Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, daniel.baluta@gmail.com, Himanshu Jha Subject: [PATCH 08/11] Staging: iio: accel: Use switch statement than if-else Date: Mon, 5 Mar 2018 13:19:27 +0530 Message-Id: <1520236170-14668-9-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520236170-14668-1-git-send-email-himanshujha199640@gmail.com> References: <1520236170-14668-1-git-send-email-himanshujha199640@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 Use switch statement instead of if-else pair to explicitly match the only two channels present. Signed-off-by: Himanshu Jha --- drivers/staging/iio/accel/adis16201.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c index 1737708..307d4ab 100644 --- a/drivers/staging/iio/accel/adis16201.c +++ b/drivers/staging/iio/accel/adis16201.c @@ -114,12 +114,15 @@ static int adis16201_read_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_SCALE: switch (chan->type) { case IIO_VOLTAGE: - if (chan->channel == 0) { + switch (chan->channel) { + case 0: *val = 1; *val2 = 220000; - } else { + break; + case 1: *val = 0; *val2 = 610000; + break; } return IIO_VAL_INT_PLUS_MICRO; case IIO_TEMP: