Received: by 10.223.185.116 with SMTP id b49csp2301137wrg; Sun, 4 Mar 2018 23:52:31 -0800 (PST) X-Google-Smtp-Source: AG47ELtJI2zz7pDl2IZBGU2akB2nbfpZaUg4zpg28bDfTjN61rtyc5tppV+e8F68L5gRopP8h2zV X-Received: by 10.98.212.80 with SMTP id u16mr14534317pfl.58.1520236351583; Sun, 04 Mar 2018 23:52:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520236351; cv=none; d=google.com; s=arc-20160816; b=ZWfJPMjzX3nhPPhOzXpQlmtyKuXAERtXOlgxyyiaLLhVX4UJ2g5miTI/i/c4AGe23H HXZI0SaNrvWddCIjNBXnDBbmEeNPvXGzgVjLLMenYp46Xl+HqrxR1lz4Z9id6SGOrrJI MMX52dIiU72Sm/zaGucZVmX2qigN6CEP30/4AfIMu3ez55PXiycSUQou8hvFkqcIXb8a geWJNxUCX3VB6Lv3nfIeDWqjRTKrk1XYbctztE3LK+OPw952ACGhmESGDxRjsyBy5Grp /sFEQWMGechVf10DnSmq8kwO1QERMvvgqZsYMQzXqKLeb9t+DcYMn6vj2YCuI/xbQ6EN gxtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=IiJdkycp7lgFW7b1A7calj2NmYTeg1Y+HVwY0EBYKPs=; b=rO/RmzePcLrPghy8nRQ5aj/jd9qIrNlhiEamXfrc46fLISv8m4Uh7jgf4urYJnmB+F I484XxEnv3BBLlSeYgReAaL8XRz6z5xHXje/XJxvGrfd7JVZVkkUPYCDfqTsO5e5dtOD yHmG3EZDb8T58kUcwMMFjCAh+u3jQPlGAldiZSDEEC6nzXfJg7UGtY4CQTikzdU3lapP NbGVvw0d9LTbznbwprHyCTrdM8t1LXM0mQSzcxrS+syh+DPwoR8ZjGZ9J5+Mk6rHNzhz GenOzpjIISniDaGUshWZ00Wos690Ujle54o+oFAoF6XXIItwRmalPYSKXqw6bYyCD9JR A6DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vU+Y6N+b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si8017317pgb.43.2018.03.04.23.52.17; Sun, 04 Mar 2018 23:52:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vU+Y6N+b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933322AbeCEHvU (ORCPT + 99 others); Mon, 5 Mar 2018 02:51:20 -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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: -- 2.7.4