From patchwork Tue Mar 6 12:02:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10261503 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 203946016D for ; Tue, 6 Mar 2018 12:03:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E0A628EDD for ; Tue, 6 Mar 2018 12:03:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0256D28EE0; Tue, 6 Mar 2018 12:03:03 +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 7C13D28EDD for ; Tue, 6 Mar 2018 12:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750933AbeCFMDC (ORCPT ); Tue, 6 Mar 2018 07:03:02 -0500 Received: from mail-vk0-f65.google.com ([209.85.213.65]:38461 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbeCFMDB (ORCPT ); Tue, 6 Mar 2018 07:03:01 -0500 Received: by mail-vk0-f65.google.com with SMTP id s1so12109671vke.5; Tue, 06 Mar 2018 04:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=+FA2Y58kgWSvw9RM5zIK5fKSIxIbCeVWwbX3xCpD9QA=; b=S3oAAXVijq25oORlOS/cSpWS0mEln5lK5YAKeMiKrAIvijyLO9IS7Zxtb63CaKjXq6 Nn8H76eDHTiPWLbXpXpb6oD22s1TTA7plS/hAanMMwQjMbD7MVAgXofS4A+DEPlhkS34 Ocbb1pDCuEKJT+80CZNyOr5QRH1WmIqecBXS+I296MBkzBOWgSvyWwbzr2w9gXjGToAH 1G+gUFyWUC3zxyl9vpseTMzifhNilCoedJ3e4W8Cf8O6wAA8dtsbbPmhGmQFuasUFE3L YRCBr3KfB+ntTluR64VzLAz0F9/ht2X43pyJus6jYU6ZfArCzFy4vwtj56F5IY1Xzhp2 xwFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=+FA2Y58kgWSvw9RM5zIK5fKSIxIbCeVWwbX3xCpD9QA=; b=QdaiWVA4eHI935T+YtEx3esWe+refiFjQqa/bELfnZ/KWmM2AiVBiEJx1nqwbCmJ8i c8OzRQyXCM0CiwSrMbeLRBcov5Yb9s7sQth0EWE3B+8QEDrK0f6zJ31uxpiefzI+WgVZ G6JP/MHx7VCDjH3Ayd5tGniE7uR2ocYhDEtFnkELnJkddS2mL+rZkQusgbKJjYhenZTT IE6g/8056Jo25v0vhyd6N95bwuNEKbygIPCcNE0ot0SzOtd7uCcgjhdlGm1PhWGXSva5 tewyo3tdd83fQdD7MzEeHb6j2HKsW/gVGABlXKXetaRYAFugk+LhpqgmwTtrd6HMLBTc 60/Q== X-Gm-Message-State: APf1xPDgVDFlTRw4U9YElyQ9ZnqDxXqVAy9VbQ1p4ptx+gOe8GhLZdf+ x1dDcTuXe5wzEE5z8bxZsxE= X-Google-Smtp-Source: AG47ELvEj8hGIFsL2iMmSLfaxxECbHEE6EW/DgEqxXJN4Na48zTB4y1Zi9n1TfTtb9VlojlAy+tMPw== X-Received: by 10.31.21.209 with SMTP id 200mr12511712vkv.135.1520337780991; Tue, 06 Mar 2018 04:03:00 -0800 (PST) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id c67sm4505556uac.1.2018.03.06.04.02.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Mar 2018 04:03:00 -0800 (PST) Date: Tue, 6 Mar 2018 09:02:57 -0300 From: Rodrigo Siqueira To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: daniel.baluta@nxp.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: Replace occurrences of magic number 0 by IIO_CHAN_INFO_RAW Message-ID: <20180306120257.eo6kh3b65qmpotoe@smtp.gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20171215 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 Usually, functions responsible for reading raw data typically relies on values from iio_chan_info_enum to correctly identify the type of data to be read. There is a set of a device driver that uses the magic number 0 instead of IIO_CHAN_INFO_RAW. This patch improves the readability by replaces the magic number 0 for the appropriate IIO_CHAN_INFO_RAW in six devices driver in the IIO subsystem. Signed-off-by: Rodrigo Siqueira --- drivers/iio/accel/hid-sensor-accel-3d.c | 2 +- drivers/iio/dac/ad5380.c | 2 +- drivers/iio/dac/ad5764.c | 2 +- drivers/iio/gyro/hid-sensor-gyro-3d.c | 2 +- drivers/iio/light/hid-sensor-als.c | 2 +- drivers/iio/light/lm3533-als.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c index c066a3bdbff7..41d97faf5013 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c @@ -155,7 +155,7 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev, *val = 0; *val2 = 0; switch (mask) { - case 0: + case IIO_CHAN_INFO_RAW: hid_sensor_power_state(&accel_state->common_attributes, true); report_id = accel_state->accel[chan->scan_index].report_id; address = accel_3d_addresses[chan->scan_index]; diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c index 845fd1c0fd9d..873c2bf637c0 100644 --- a/drivers/iio/dac/ad5380.c +++ b/drivers/iio/dac/ad5380.c @@ -158,7 +158,7 @@ static unsigned int ad5380_info_to_reg(struct iio_chan_spec const *chan, long info) { switch (info) { - case 0: + case IIO_CHAN_INFO_RAW: return AD5380_REG_DATA(chan->address); case IIO_CHAN_INFO_CALIBBIAS: return AD5380_REG_OFFSET(chan->address); diff --git a/drivers/iio/dac/ad5764.c b/drivers/iio/dac/ad5764.c index 033f20eca616..9333177062c0 100644 --- a/drivers/iio/dac/ad5764.c +++ b/drivers/iio/dac/ad5764.c @@ -168,7 +168,7 @@ static int ad5764_read(struct iio_dev *indio_dev, unsigned int reg, static int ad5764_chan_info_to_reg(struct iio_chan_spec const *chan, long info) { switch (info) { - case 0: + case IIO_CHAN_INFO_RAW: return AD5764_REG_DATA(chan->address); case IIO_CHAN_INFO_CALIBBIAS: return AD5764_REG_OFFSET(chan->address); diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c index f59995a90387..36941e69f959 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c @@ -115,7 +115,7 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev, *val = 0; *val2 = 0; switch (mask) { - case 0: + case IIO_CHAN_INFO_RAW: hid_sensor_power_state(&gyro_state->common_attributes, true); report_id = gyro_state->gyro[chan->scan_index].report_id; address = gyro_3d_addresses[chan->scan_index]; diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index befd693a4a31..406caaee9a3c 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -97,7 +97,7 @@ static int als_read_raw(struct iio_dev *indio_dev, *val = 0; *val2 = 0; switch (mask) { - case 0: + case IIO_CHAN_INFO_RAW: switch (chan->scan_index) { case CHANNEL_SCAN_INDEX_INTENSITY: case CHANNEL_SCAN_INDEX_ILLUM: diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c index 36208a3652e9..ff5a3324b489 100644 --- a/drivers/iio/light/lm3533-als.c +++ b/drivers/iio/light/lm3533-als.c @@ -199,7 +199,7 @@ static int lm3533_als_read_raw(struct iio_dev *indio_dev, int ret; switch (mask) { - case 0: + case IIO_CHAN_INFO_RAW: switch (chan->type) { case IIO_LIGHT: ret = lm3533_als_get_adc(indio_dev, false, val);