Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4169491yba; Sun, 19 May 2019 12:25:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaNWx17Um/QlaBj/tPh0mVuLoIxaop9csLs86ftL4TvGZRH+ulcE9O+6827zUK6fS9Kksm X-Received: by 2002:a65:6088:: with SMTP id t8mr23031155pgu.381.1558293921941; Sun, 19 May 2019 12:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558293921; cv=none; d=google.com; s=arc-20160816; b=BMZLz8gIIgdVCzZWetS6WaMCdIDgPtccDJrXiEpiNigCQ+Gc/VMu1kcwfXwTQIOekU 92ErXZ4Rs9o1F04hxsPKtwWDswDdBNdFmfs+4MBl3SdoJq05Kq5KU8jKm2dGS2Gpt50z pvCbLyCArpeJSgEIulANH1W5ZOgJZDSZexvZ0VRJuf1ty8BkJIVktsmZy9LDyJoKdx7Z Yd456MY3w4tQlsbezfL7RgVfRFYrfL7DNDev3afi2EwJNseDYvueqXxQkCU6uuZyaoN6 ExkBLYKyXBgWi5gjaauMSfLwyR6EXu1/Xls5ICEY7670WjthUxUkbjDQ3Im8Ro6pArZn 5cSw== 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=kXBfSuxHDvLAOvGzZbZNWTzOn9zFRrN8dEpcFXnbH70=; b=Og/oq1HIwx2FRcaVu+cBbliWZEbQMfQJWZhAJ33CQSl0Gb7tH/uDQa83Y5CQDUalaK hvH7qkD7/wmp53VssGvrW0oLJnLje4WFLue35G5a2AJfjuAh7tt0QXoMRnLYi+sZC+71 cE5CEW2ZT+EG5czH2oPzlzIkaJm2GIeJ6Y3ZiVQksKqY7taPVOqFsij4N/I7csmFdlSu NZTPVgsXbkO13lnhBiSsHCW/Z7cURrBDiG7A7saNpH0D3SPW0rHIItgHAjNf7xAFo9z7 I9LtuU/NdEwi4WFv5q/SwbfenqozhJOHgKy/4GmNZy5l7pgeAm/ki3QYw+F0/b/iKheT WLuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HvjBcJ20; 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 x21si16186467pfa.48.2019.05.19.12.24.53; Sun, 19 May 2019 12:25:21 -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=HvjBcJ20; 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 S1727803AbfESRhW (ORCPT + 99 others); Sun, 19 May 2019 13:37:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:39214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726472AbfESRhV (ORCPT ); Sun, 19 May 2019 13:37:21 -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 1A0AE214D8; Sun, 19 May 2019 10:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558261797; bh=XzlTETSMrzArR830GrEOHizV3Tpk3ohasxsl/cG3kLo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HvjBcJ20xJPkYcnBZXtTexX3Q9oLp+na2+udcGibyOclGZLbFG+S8H1FXz3GXfioz fnTjdd1L6Y2F18ct5mvA08pAi47sJ5rnZ9c+NYlnM+fRMj1Tsuh9hIQtxgKtnlT10y YtkC1zvVFsgv2RmjxJmbjIbN4A4oKjRUrtPbzUss= Date: Sun, 19 May 2019 11:29:52 +0100 From: Jonathan Cameron To: Melissa Wen Cc: Lars-Peter Clausen , Michael Hennerich , Stefan Popa , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , Barry Song <21cnbao@gmail.com>, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com Subject: Re: [PATCH] staging:iio:ad7150: fix threshold mode config bit Message-ID: <20190519112952.58142fb0@archlinux> In-Reply-To: <20190519010456.lwq7n2e6nkqa6niz@smtp.gmail.com> References: <20190519010456.lwq7n2e6nkqa6niz@smtp.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, 18 May 2019 22:04:56 -0300 Melissa Wen wrote: > According to the AD7150 configuration register description, bit 7 assumes > value 1 when the threshold mode is fixed and 0 when it is adaptive, > however, the operation that identifies this mode was considering the > opposite values. > > This patch renames the boolean variable to describe it correctly and > properly replaces it in the places where it is used. > > Fixes: 531efd6aa0991 ("staging:iio:adc:ad7150: chan_spec conv + i2c_smbus commands + drop unused poweroff timeout control.") > Signed-off-by: Melissa Wen Looks good to me. Applied to the fixes-togreg branch of iio.git pushed out as as testing-fixes for the autobuilders to see if they can find anything we have missed. Thanks, Jonathan > --- > drivers/staging/iio/cdc/ad7150.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c > index dd7fcab8e19e..e075244c602b 100644 > --- a/drivers/staging/iio/cdc/ad7150.c > +++ b/drivers/staging/iio/cdc/ad7150.c > @@ -5,6 +5,7 @@ > * Copyright 2010-2011 Analog Devices Inc. > */ > > +#include > #include > #include > #include > @@ -130,7 +131,7 @@ static int ad7150_read_event_config(struct iio_dev *indio_dev, > { > int ret; > u8 threshtype; > - bool adaptive; > + bool thrfixed; > struct ad7150_chip_info *chip = iio_priv(indio_dev); > > ret = i2c_smbus_read_byte_data(chip->client, AD7150_CFG); > @@ -138,21 +139,23 @@ static int ad7150_read_event_config(struct iio_dev *indio_dev, > return ret; > > threshtype = (ret >> 5) & 0x03; > - adaptive = !!(ret & 0x80); > + > + /*check if threshold mode is fixed or adaptive*/ > + thrfixed = FIELD_GET(AD7150_CFG_FIX, ret); > > switch (type) { > case IIO_EV_TYPE_MAG_ADAPTIVE: > if (dir == IIO_EV_DIR_RISING) > - return adaptive && (threshtype == 0x1); > - return adaptive && (threshtype == 0x0); > + return !thrfixed && (threshtype == 0x1); > + return !thrfixed && (threshtype == 0x0); > case IIO_EV_TYPE_THRESH_ADAPTIVE: > if (dir == IIO_EV_DIR_RISING) > - return adaptive && (threshtype == 0x3); > - return adaptive && (threshtype == 0x2); > + return !thrfixed && (threshtype == 0x3); > + return !thrfixed && (threshtype == 0x2); > case IIO_EV_TYPE_THRESH: > if (dir == IIO_EV_DIR_RISING) > - return !adaptive && (threshtype == 0x1); > - return !adaptive && (threshtype == 0x0); > + return thrfixed && (threshtype == 0x1); > + return thrfixed && (threshtype == 0x0); > default: > break; > }