Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1335082imb; Sat, 2 Mar 2019 11:10:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwG/cyvbsOl7PPq5yb6WxW9VD2brwe6CWPW2C9gAdytWiOvAXP5lzB/HtFa76TiHwgpOT7y X-Received: by 2002:a17:902:7613:: with SMTP id k19mr6746256pll.207.1551553823906; Sat, 02 Mar 2019 11:10:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551553823; cv=none; d=google.com; s=arc-20160816; b=O2PscDaeAIu4+DzrxdbHeBwKe0JAJAjQCGi0vOzyK/BCU7kZOj15vnH8WVYyL1Bmhn QYUiXxnaonl/UpvviSYyyz86osGc6SFyg/lWZDnOrxat+wZW4BLLI/f+vKgN0QwPo+xw 1KMv/MEYPhzwD05uI3h2YI1Yil1eke7yAMT+OxbI//xXQhQ4wxFpo/N2BRT1fEPrZaro /vqti3zdTO72fQmoRXPmCu1S1WvRPWn+d0IU5wTPrkhZFSvztjoC7cfT7Pkk2SEv2A3q ejbHbJ8UrLD3K4/nJusfopEQqAh9CIaz1D0S3Ud2QPOxLp8wbZQf12V1AwlqMeNA+DZo PYAg== 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; bh=FJQJuJBNXE5y1KHfQXaEsOmL+LoL1al+IlddIg+15Lc=; b=KsP7+0U8qhLKxK2JUk4dvkb93r2GrbliXMyfwOHIzsq2mdTj7Kol4h388biX5Y/LQD 29n3xSyF6gDFLBX42LB/jl4fxd7hPmud+n16WQey0K5htwX0OmR3tGXP53EajUXaNKmY gca45TpGHTK00omBGbyk5sG4jiot3wsEAKLtG0aveBRNRDv3HqCuizFxnhTjUn0/BKGi stnrUxJ3qIczQ2Rl84RhrW9005iCVWIy4mhSpstmQpZoH3wVqoOc2OMVUImb3pBr1SvF zCe0KpPpczOiq463SLNsGm95Jo1/58IHBZMvPLYl0CiwLMrVAeEjh4D9nzcroc5Rnlui p9ZA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l93si1213428plb.433.2019.03.02.11.10.07; Sat, 02 Mar 2019 11:10:23 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727082AbfCBTIZ (ORCPT + 99 others); Sat, 2 Mar 2019 14:08:25 -0500 Received: from saturn.retrosnub.co.uk ([46.235.226.198]:47388 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbfCBTIZ (ORCPT ); Sat, 2 Mar 2019 14:08:25 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) by saturn.retrosnub.co.uk (Postfix; Retrosnub mail submission) with ESMTPSA id 0043D9E74B3; Sat, 2 Mar 2019 19:08:19 +0000 (GMT) Date: Sat, 2 Mar 2019 19:08:17 +0000 From: Jonathan Cameron To: "Ardelean, Alexandru" Cc: "lars@metafoo.de" , "robh+dt@kernel.org" , "Popa, Stefan Serban" , "knaack.h@gmx.de" , "Hennerich, Michael" , "renatogeh@gmail.com" , "mark.rutland@arm.com" , "giuliano.belinassi@usp.br" , "pmeerw@pmeerw.net" , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" , "devel@driverdev.osuosl.org" , "kernel-usp@googlegroups.com" , "devicetree@vger.kernel.org" Subject: Re: [PATCH v4 3/9] staging: iio: ad7780: set pattern values and masks directly Message-ID: <20190302190817.61dc4e72@archlinux> In-Reply-To: <20190302190716.26838b52@archlinux> References: <9c8331166124ec2bd52794a9c9f844bfb70d1cd9.1551358569.git.renatogeh@gmail.com> <20190302190716.26838b52@archlinux> 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, 2 Mar 2019 19:07:16 +0000 Jonathan Cameron wrote: > On Fri, 1 Mar 2019 07:17:04 +0000 > "Ardelean, Alexandru" wrote: > > > On Thu, 2019-02-28 at 11:24 -0300, Renato Lui Geh wrote: > > > > > > > > > The AD7780 driver contains status pattern bits designed for checking > > > whether serial transfers have been correctly performed. Pattern macros > > > were previously generated through bit fields. This patch sets good > > > pattern values directly and masks through GENMASK. > > > > > > Signed-off-by: Renato Lui Geh > > > --- > > > drivers/staging/iio/adc/ad7780.c | 20 +++++++++----------- > > > 1 file changed, 9 insertions(+), 11 deletions(-) > > > > > > diff --git a/drivers/staging/iio/adc/ad7780.c > > > b/drivers/staging/iio/adc/ad7780.c > > > index 7a68e90ddf14..56c49e28f432 100644 > > > --- a/drivers/staging/iio/adc/ad7780.c > > > +++ b/drivers/staging/iio/adc/ad7780.c > > > @@ -17,6 +17,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > #include > > > #include > > > @@ -28,16 +29,13 @@ > > > #define AD7780_ID1 BIT(4) > > > #define AD7780_ID0 BIT(3) > > > #define AD7780_GAIN BIT(2) > > > -#define AD7780_PAT1 BIT(1) > > > -#define AD7780_PAT0 BIT(0) > > > > I don't see a problem to leave the bitfields; they can be read & matched > > easier with the datasheet. > > > > > > > > -#define AD7780_PATTERN (AD7780_PAT0) > > > -#define AD7780_PATTERN_MASK (AD7780_PAT0 | AD7780_PAT1) > > > > > > -#define AD7170_PAT2 BIT(2) > > > > > +#define AD7780_PATTERN_GOOD 1 > > > > It was also nice before that the PAT0..PAT2 bitfields were used to define a > > good pattern, since it's easier to match with the datasheet. > This one was much suggestion. Not particularly important one. Not enough sleep this week clearly :) This one was _my_ suggestion. > > Personally if a datasheet is pointlessly confusing I tend to ignore it. > This is a two bit field as the bits don't have independent meaning! > > I'm not strongly tied to it though and as it's an Analog driver and > you all do a good job maintaining the set I'll go with your preference! > I do prefer the naming of PATTERN_GOOD though if nothing else! > > > > > > > +#define AD7780_PATTERN_MASK GENMASK(1, 0) > > > > I like the general usage of GENMASK, but I'm not sure in this case it's > > worth doing. Maybe I missed a discussion somewhere, about doing this > > change, but it is mostly a cosmetic without any functional change. > > > > > > > > > > -#define AD7170_PATTERN (AD7780_PAT0 | AD7170_PAT2) > > > -#define AD7170_PATTERN_MASK (AD7780_PAT0 | AD7780_PAT1 | AD7170_PAT2) > > > +#define AD7170_PATTERN_GOOD 5 > > > +#define AD7170_PATTERN_MASK GENMASK(2, 0) > > > > > > #define AD7780_GAIN_MIDPOINT 64 > > > #define AD7780_FILTER_MIDPOINT 13350 > > > @@ -209,25 +207,25 @@ static const struct ad_sigma_delta_info > > > ad7780_sigma_delta_info = { > > > static const struct ad7780_chip_info ad7780_chip_info_tbl[] = { > > > [ID_AD7170] = { > > > .channel = AD7170_CHANNEL(12, 24), > > > - .pattern = AD7170_PATTERN, > > > + .pattern = AD7170_PATTERN_GOOD, > > > .pattern_mask = AD7170_PATTERN_MASK, > > > .is_ad778x = false, > > > }, > > > [ID_AD7171] = { > > > .channel = AD7170_CHANNEL(16, 24), > > > - .pattern = AD7170_PATTERN, > > > + .pattern = AD7170_PATTERN_GOOD, > > > .pattern_mask = AD7170_PATTERN_MASK, > > > .is_ad778x = false, > > > }, > > > [ID_AD7780] = { > > > .channel = AD7780_CHANNEL(24, 32), > > > - .pattern = AD7780_PATTERN, > > > + .pattern = AD7780_PATTERN_GOOD, > > > .pattern_mask = AD7780_PATTERN_MASK, > > > .is_ad778x = true, > > > }, > > > [ID_AD7781] = { > > > .channel = AD7780_CHANNEL(20, 32), > > > - .pattern = AD7780_PATTERN, > > > + .pattern = AD7780_PATTERN_GOOD, > > > .pattern_mask = AD7780_PATTERN_MASK, > > > .is_ad778x = true, > > > }, > > > -- > > > 2.21.0 > > > >