Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2317451img; Sun, 24 Mar 2019 05:42:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNU/06ox+M81/Ld5elaEeX2zp/bstSt8RqA2HhFMkVmevj0YwkYP3UwQhSHQbsmTGhDrNg X-Received: by 2002:a63:5452:: with SMTP id e18mr18567919pgm.386.1553431361134; Sun, 24 Mar 2019 05:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553431361; cv=none; d=google.com; s=arc-20160816; b=ejOov+JhxIaCFmQh74PIINPV6JVesIDGaAyshsD2netd3/Uc87j962mN7l83OxXUvs TsKpg7BdajIv3Nhl+hnnGDc3NXFfHABh+FSpNqfvooheHZzsQMV+1fybqtuNc9xcTZ9K 8vUh0qw9gRw9ViseBVOwZ6JqCjnFS3D9EoE1MBKNyxfxGbA7Jf1xNGpZ392CGui89PVm 3YoSo85dPrhySekWsfrIqVVJkjtaRiZherPsCQ3fIwmfaSJgm6d2TFHHT1vH+xWThHjW lSvwjxrI8nK8MTZDAK53NiPYpWAn8vp9lmfweJMRoflNCBegzSMp37HFF8bhfCyBAqZK hRGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=WW3GP8F9cZOqxtUorgvRA7v4Wb/gRspTUsRqKA1oE7g=; b=Gab2tRtx2KVPMurYv0Wn6ek8LqxSXB84h/u5gcLUjgnfVzzV2RH/ESny6k2egszLcm 2r27sxrERrgflTNU1vfXoOs1OECqcAOJCgjEeW/uOtoJscmCIomNOdiNkM97swTCXBrq Q8WxAe21M3TgIAJ369jelHlbaoSb2s/JD6D/wMdGnLNubLm4/s7SgZynTQRcKvtBJWm4 r3ruvea3HKZ0FdZC89fzPmMTTFPoHh/BciKe2+XMzCgOLuROmYcmeQ+PQQgapzOBvK2i QD3Je2eqTZKWemwOAq6RtBCaCRsCWe1386DSWIC5p5sW6ukdN6lj084dkmI9z6XfTAwV S+wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ZnHy/Uif"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s64si11501195pfb.67.2019.03.24.05.42.25; Sun, 24 Mar 2019 05:42:41 -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=@kernel.org header.s=default header.b="ZnHy/Uif"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728727AbfCXMlu (ORCPT + 99 others); Sun, 24 Mar 2019 08:41:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:52416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726160AbfCXMlu (ORCPT ); Sun, 24 Mar 2019 08:41:50 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 81F17222D0; Sun, 24 Mar 2019 12:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553431309; bh=/bx/xq5WecKtE5kx7fM8MrdOKvn/UgVI75BPjnbSiKA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZnHy/Uifugz7m0HqwVCT/WENuI71kNypdceLxTp1A5cyEmMVmmB0XFdgRdsjm4Vfw EuyW8K36VK0oysTwkJzyzuKwiBZihbpPcWPPEqKxGoXfHuDvSojX+H0IwzpmdoEgEe TtVR4vt82U0O4orkHV8BlMY2qatV2foLoepl8z3s= Date: Sun, 24 Mar 2019 12:41:43 +0000 From: Jonathan Cameron To: Cristian Sicilia Cc: Lars-Peter Clausen , Michael Hennerich , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/5] staging: iio: adc: Adding temp var to improve readability Message-ID: <20190324124143.72c950f4@archlinux> In-Reply-To: <82dd56df8d410ec91061ef51c2653345d7e30aa2.1553366098.git.sicilia.cristian@gmail.com> References: <82dd56df8d410ec91061ef51c2653345d7e30aa2.1553366098.git.sicilia.cristian@gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 23 Mar 2019 20:21:45 +0100 Cristian Sicilia wrote: > Creating a temporary variable to improve readability > > Signed-off-by: Cristian Sicilia Indeed makes it a little more readable, so fair enough. Applied Thanks, Jonathan > --- > 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)); > + } > } > } >