From patchwork Sun Mar 4 12:43:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10257647 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 1AEF2602BD for ; Sun, 4 Mar 2018 12:43:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2801287DC for ; Sun, 4 Mar 2018 12:43:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E708A287E5; Sun, 4 Mar 2018 12:43:18 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 8FDA0287DC for ; Sun, 4 Mar 2018 12:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752682AbeCDMnR (ORCPT ); Sun, 4 Mar 2018 07:43:17 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:41007 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566AbeCDMnR (ORCPT ); Sun, 4 Mar 2018 07:43:17 -0500 Received: by mail-pl0-f65.google.com with SMTP id d9-v6so700786plo.8; Sun, 04 Mar 2018 04:43:16 -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=9+KosTM0HsuJ5G1V9461G0Qc8AXadDq/HJSXhjDOhvc=; b=T1dNjPlWeMycZhOBzVI4RbrwruGcPGCWY/MZ0oOc0NyKe/i8h1M0W8zE6VLKBeLDSI kpfUgiliWqTEs6tSPrs/0A5yDD3CzQx3Nzuw+6Uc5XtoHRBEi0q6GaMp7JQdooCZ/u7H /SXSt/mIAELBb8rc4nstoxcbSa54eYR0Vavuc+IeNiNuK50P+6Bz2P0sr9cBQWUiBaXd gJJMuqzxqqzVbSHQLu6qKYO0rprpXpqJ3qGlgJLLGezGJPxOxv+K4L8c3U9ot3gYstd5 GemAg+2kXnSRDxwcVTg5vbLdgmxFpzcmXAf2eNxolEJ2syRJk0mIRtRAdynqCZAl7fzy zgZw== 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=9+KosTM0HsuJ5G1V9461G0Qc8AXadDq/HJSXhjDOhvc=; b=moodALiu3Zj4gyyH0sjmVIuM/mmkM4SRh3ylP5t6nrQNvpKfArUlkY/hnl86SHHfRc gM/IBThHJexngNY5jsE0QjUYjoxsFvh9G3YN3T1jc6iyWXrBmVIn6XgxD89m1Mg1YMwy 5BIWCs9Zvt0AVT0yfHUn18zoBC7H+M+HagG2+xyaUeGh0U8wwS4DXLfKXn94jV8unysJ 4sdtQOwY2F418Pwkr1zmX5QlFISlEWFmF9Ejtp56Qcd0miPadtAo/0KaLKL9fYrof70h hFVCfioGWoqxXK6cYmvjcH9B4JMZ3pirjg30sZiywuFwiK4mp7l7yxtrAjFfwez/CQOS NVNQ== X-Gm-Message-State: APf1xPB+s94l8DQE7O5GeJyxVr99laGCgXE536rTAvGu1mTg7DXsnp63 UHg5lZhuBPKNQ8jBwpYhem4= X-Google-Smtp-Source: AG47ELsGBDPyZL9KbudlKno+CM04M0q19TSS6BdwNXMoNMgUIBulE0VnXPI2Nlp2Pj0lXKhV7CnBlg== X-Received: by 2002:a17:902:5a0d:: with SMTP id q13-v6mr10157248pli.152.1520167396613; Sun, 04 Mar 2018 04:43:16 -0800 (PST) Received: from shreeya-VirtualBox ([103.212.140.139]) by smtp.gmail.com with ESMTPSA id k3sm17858106pff.41.2018.03.04.04.43.15 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Mar 2018 04:43:16 -0800 (PST) From: Shreeya Patel To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, 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 Cc: Shreeya Patel Subject: [PATCH v3 3/4] Staging: iio: adis16209: Adjust a switch statement Date: Sun, 4 Mar 2018 18:13:12 +0530 Message-Id: <5c523865f71eb68181bd2b207685bdf5e9b8da83.1520164945.git.shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: 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 Adjust a switch block to explicitly match channels and return -EINVAL as default case which makes the code semantically more clear. Signed-off-by: Shreeya Patel --- Changes in v3 -After split patch. drivers/staging/iio/accel/adis16209.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/accel/adis16209.c b/drivers/staging/iio/accel/adis16209.c index eb5c878..9cb1ce0 100644 --- a/drivers/staging/iio/accel/adis16209.c +++ b/drivers/staging/iio/accel/adis16209.c @@ -155,10 +155,16 @@ static int adis16209_read_raw(struct iio_dev *indio_dev, switch (chan->type) { case IIO_VOLTAGE: *val = 0; - if (chan->channel == 0) + switch (chan->channel) { + case 0: *val2 = 305180; /* 0.30518 mV */ - else + break; + case 1: *val2 = 610500; /* 0.6105 mV */ + break; + default: + return -EINVAL; + } return IIO_VAL_INT_PLUS_MICRO; case IIO_TEMP: *val = -470;