Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1807136img; Sat, 23 Mar 2019 12:46:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPFOdaE0OZJMpzeYLHWXiizJ6v9VkXPSj4vyCMhrzCj0cZCl4NFTH1iVZT7Dx9i4X8i3CT X-Received: by 2002:a63:cc43:: with SMTP id q3mr15669739pgi.387.1553370367594; Sat, 23 Mar 2019 12:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553370367; cv=none; d=google.com; s=arc-20160816; b=U1U7VocZ55cjSEJ3Xd1sxAGKQaakKZkj5yjbz/1VgL8bXbK37bY2U+9G7ReSwxFGtO 8sVbx/b7SYwA3k6TJ6TXhoMXEOlKU0qYIAn41bSgMyuIr0Bi7ZjvefVJ5TufFTdRR8eM 9VUj32zZwlPqnzWVF22dekXzjVTAVZVewvTvO54Pu7727PEtbN05ZNrN3MlCZ1Wq4cSR Rx9ZS2zefJjUaBqD/55UorCENWUXwpPPSFkFTkOP1G8hqrLk3lEGsDw2vtO/2HKYTe3+ eVT2hxFAaTMin/CfxOJr2pvAzAdt3E7Xr1kEDoFySFuR+7qgT057bUjUsX1J2H/Wnpai 0iYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UNX6DqWrbbVQKs40nVLxu3cNUe9PZN8vCebi9sI0jrE=; b=N5ezrbsbAhk3CBFUMSWkjdfOsrr4ZNfjNnFbF7l81ofq5ywpMtux66E/Udd43/M93Y 711sv4uNrpF84ZXGdUnZktwcqAHzGMDIiY2D2oIbWdGSF8SfmLcPX8eIWGf6sPcHVIE4 ad7iJHlWrwOl89HEOIKVawMv2kM+e6trFNSJYwUf2qYoacKTYkIwHsy8oqo3lujQFwYI o7CvrW2ik31skIzOCQmZmJMhfhgjrVKTPwBByaax9cpFlOOoMZvX+5UOMLHYT+R6PZWA FfZxIiFn0Wh/pb6cLvxzJ5M+Y5fRRCFZII9mR4QOC5okemm6ZHEngCh1BghwJZfQl6Om FV9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kf8I+1Jm; 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 v21si1247129pfe.119.2019.03.23.12.45.36; Sat, 23 Mar 2019 12:46:07 -0700 (PDT) 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=kf8I+1Jm; 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 S1727980AbfCWTVv (ORCPT + 99 others); Sat, 23 Mar 2019 15:21:51 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37362 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727544AbfCWTVt (ORCPT ); Sat, 23 Mar 2019 15:21:49 -0400 Received: by mail-wr1-f67.google.com with SMTP id w10so5840940wrm.4; Sat, 23 Mar 2019 12:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UNX6DqWrbbVQKs40nVLxu3cNUe9PZN8vCebi9sI0jrE=; b=kf8I+1JmVgSyjktuio6doUoGCrZU9wYInsprBtF6Frm4VaDBDaCTJsjgRA1Mbfudry S3mJ2O1/nsKq6PDbSOgrLirT+DP4Jxvt2Saug4SQLHrifh9ThFE0rjMaPcslCCylF23x eD2AlnYemRT+L0HudujpLed6yaeDvp6GD8wN9/gi2IqilcEXDUOjtUzmZAbmEO12FIKz iQnCYCjD5Ji6R//2bgp2e1vT0kHmSCWZKVLLkUnygzRmL8TrjTccdx4yhwQ02WpiPMuc JZE1HxWJKkp8C0cV/RoBv83R3a+RN0sM4OAXY1CtiNPijDAf6LLhJ6atMuS3Pxz//3h1 ysUg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UNX6DqWrbbVQKs40nVLxu3cNUe9PZN8vCebi9sI0jrE=; b=piZj0HRnKa+FXuyJ9ocjwxGDLj/XhtoXiMnWv56heSS5W7MD+RjH76JTBSaTtofvr9 ywCMaWxjuP4SjCfGDcbkgT/NSDIH95r3WYsvCprjHmJVr+3h7SkZ6Vo1DULsl2J6LQ6A XywMY36BpS7Mkt6JfDC6u4MPLX7AdIibYMHe9CC4vFklxWd33vfMPbe4iy/GSbI5LBnc lbhz/wiJZkenX7M4wsfKiR5jgEnGZfJugsEIxOmIET5xcAmXX2v7pVJ2po3ANxZSBZny idq9pK3XjU0K5WrJS9W+16QtrN5vH4c2tmE2CVXfznVuBMNBcALIbR7evcHbCADR9vO5 cnvw== X-Gm-Message-State: APjAAAXv1JbRLlfkNK7A65GZ2Y/smVqT1aLL0zZteSVb6oUfCjg+vFPw rYmj9JKVZnqrSFFmS1u7/a0PjSK9S6E= X-Received: by 2002:adf:f48d:: with SMTP id l13mr11367355wro.2.1553368907716; Sat, 23 Mar 2019 12:21:47 -0700 (PDT) Received: from peano ([87.19.116.42]) by smtp.gmail.com with ESMTPSA id b3sm14153024wmj.15.2019.03.23.12.21.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Mar 2019 12:21:47 -0700 (PDT) Date: Sat, 23 Mar 2019 20:21:45 +0100 From: Cristian Sicilia To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] staging: iio: adc: Adding temp var to improve readability Message-ID: <82dd56df8d410ec91061ef51c2653345d7e30aa2.1553366098.git.sicilia.cristian@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Creating a temporary variable to improve readability Signed-off-by: Cristian Sicilia --- drivers/staging/iio/adc/ad7280a.c | 55 ++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index d81a5bd..5d848aa 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -784,43 +784,38 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) for (i = 0; i < st->scan_cnt; i++) { if (((channels[i] >> 23) & 0xF) <= AD7280A_CELL_VOLTAGE_6) { if (((channels[i] >> 11) & 0xFFF) >= - st->cell_threshhigh) - iio_push_event(indio_dev, - IIO_EVENT_CODE(IIO_VOLTAGE, - 1, - 0, - IIO_EV_DIR_RISING, - IIO_EV_TYPE_THRESH, - 0, 0, 0), + st->cell_threshhigh) { + u64 tmp = IIO_EVENT_CODE(IIO_VOLTAGE, 1, 0, + IIO_EV_DIR_RISING, + IIO_EV_TYPE_THRESH, + 0, 0, 0); + iio_push_event(indio_dev, tmp, iio_get_time_ns(indio_dev)); - else if (((channels[i] >> 11) & 0xFFF) <= - st->cell_threshlow) - iio_push_event(indio_dev, - IIO_EVENT_CODE(IIO_VOLTAGE, - 1, - 0, - IIO_EV_DIR_FALLING, - IIO_EV_TYPE_THRESH, - 0, 0, 0), + } else if (((channels[i] >> 11) & 0xFFF) <= + st->cell_threshlow) { + u64 tmp = IIO_EVENT_CODE(IIO_VOLTAGE, 1, 0, + IIO_EV_DIR_FALLING, + IIO_EV_TYPE_THRESH, + 0, 0, 0); + iio_push_event(indio_dev, tmp, iio_get_time_ns(indio_dev)); + } } else { - if (((channels[i] >> 11) & 0xFFF) >= st->aux_threshhigh) - iio_push_event(indio_dev, - IIO_UNMOD_EVENT_CODE( - IIO_TEMP, - 0, + if (((channels[i] >> 11) & 0xFFF) >= + st->aux_threshhigh) { + u64 tmp = IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_EV_TYPE_THRESH, - IIO_EV_DIR_RISING), + IIO_EV_DIR_RISING); + iio_push_event(indio_dev, tmp, iio_get_time_ns(indio_dev)); - else if (((channels[i] >> 11) & 0xFFF) <= - st->aux_threshlow) - iio_push_event(indio_dev, - IIO_UNMOD_EVENT_CODE( - IIO_TEMP, - 0, + } else if (((channels[i] >> 11) & 0xFFF) <= + st->aux_threshlow) { + u64 tmp = IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_EV_TYPE_THRESH, - IIO_EV_DIR_FALLING), + IIO_EV_DIR_FALLING); + iio_push_event(indio_dev, tmp, iio_get_time_ns(indio_dev)); + } } } -- 2.7.4