Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp728582img; Thu, 28 Feb 2019 07:00:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IYU/96VL+BRapjAti+tnwgnPZ2CdEZwKjFXcF8qEaWYa4cKtDWQybzxPjsFpxQXS33KFAsX X-Received: by 2002:a62:560f:: with SMTP id k15mr7730917pfb.231.1551366056719; Thu, 28 Feb 2019 07:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551366056; cv=none; d=google.com; s=arc-20160816; b=spHHUTy6P5l4OuzkpFxoeqNiM6q0t/0u7vDr9Wn+Equ0AN2xjpLoGowFC8ff9nWuYe z/nDVqQgndEvSyBOEXwitTa1kHlhoss6d4g7CttPSw4vj0RWOhnj+s9K9LplvrW6JrZ8 +ucr4ZumD//k/NZVLdFyQq5z8Q09N4GU01mAnAT9ILtw3GE4NvVqUDQVTx8XpWqKA7Qc Ygu7C9nP5dkevZUbO8CaxL8CNLQumEHeRsplbxC4iqX6pjbbsu8vhxo/fGtVsrvOZRU6 pM6CwccvNNypApsZhfTpzA3UELSY7xh5iE/jKbj27TnDsljJesGGNZwAMhhDaf6w46VF h2Iw== 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=T7e+fs7V+yeM3EHke7E+9+CDMITg0TvBzaawUe6DGE8=; b=cT1G93VGFhNhy3W2zIIpkrf0/IXd3aVRvT/5+9sjbaCtOgrk8LfdDaUI1J6xemnKpA hOmRGXOcn4VFNth6ZYTdyw8y2d5get7NUhcqGuix7ABbc2oLDH+7cgA/7/cQDqODYk8d cCcL1SeAg4+Kw3y59FVhMZHMh8jbHUYcB5wKhAq4Ho/fwCQRCa5yJ/Y3B0CsfWHnJRs/ Yo7wnDo2QqmecydjKueTz4v6p8MCRNYul50KGweUwhZ58M8fH3bqsPyx+hhw9lmI8KX9 mGPXCF9DIxewAl8gxfRXZcvOF936in/YGwjvhx4ILdEzJKjLW/pruN1ed9HMXJdwbt6l HjBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KkaLNZlL; 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 q20si17243500pgl.268.2019.02.28.07.00.40; Thu, 28 Feb 2019 07:00:56 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KkaLNZlL; 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 S1732796AbfB1OYk (ORCPT + 99 others); Thu, 28 Feb 2019 09:24:40 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:40216 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbfB1OYk (ORCPT ); Thu, 28 Feb 2019 09:24:40 -0500 Received: by mail-qt1-f193.google.com with SMTP id j36so23629840qta.7; Thu, 28 Feb 2019 06:24:39 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=T7e+fs7V+yeM3EHke7E+9+CDMITg0TvBzaawUe6DGE8=; b=KkaLNZlLNvaSNKFwYsREkTpos9mfrvRMlZpcoK7BV/ChTlT31olFWCOpqY43KizRq0 fZhqUXszAgPEw0iuH74ETCL5vPtAPT1wZMteBnPJ7oWvHaHGu+vGjCos6gtYZg25n6Eh xfkPDxFcJi5Ve+aTE/U7Kr4kCaFvt06xm/KS9ntn+qroRHgmQBtREbhSAG05BdZEMptI eE0bQwXkB7lc0cGvBKj4JY+6O/uZtkLtbfIbsKYxWUmCA5lsND3Tm7/VEMyy8+SQ4HM8 NC4gMd/qq+/Ed7qQuFiJTdtKcClchkghHj9CnzGKw+geuENpPAsABD4ouoNsRc+Ve7e+ Vzjw== 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=T7e+fs7V+yeM3EHke7E+9+CDMITg0TvBzaawUe6DGE8=; b=Q6j1iO4LfpI1wcTGqUWQxMla21td0GG0XPIeYfdq/dN/52O3AihkrQ7naZAbjTV/wi 0WEcGIwSXnoU5IU0kjV+O99zY6+MBKjbiuXkWeMt9b8qJlu3jk2jVFTu85IWjjeEW6ov n+Zu1ZpW6b4vmCNZfixbm9NpiHA7dDwYWTYSKwqP7fGwUXLd0Qyy5fLNHeak9vndq3rT m3Kc4rOctqzrPgcoxrkmK8rRYoZSkpbCLEy/CbmnOspDmYuJhdyKKvQRYvtA9JI5x++P DWyJoKS10H3PYeC7pKt2Xbv+oK6Wm02Sj+XdvB+wPrKJc6ydwkufzd33FKBundNAw1UM 3AbA== X-Gm-Message-State: APjAAAU4H5D670xUXlII+i1+2YCE6KcQTYLamw8Wvl98sLysnFCa5su8 1XGQc56LprdT10LI/UdW4eE= X-Received: by 2002:ac8:734a:: with SMTP id q10mr6509687qtp.106.1551363878724; Thu, 28 Feb 2019 06:24:38 -0800 (PST) Received: from renatolg ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id 24sm14133433qtu.17.2019.02.28.06.24.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 06:24:38 -0800 (PST) Date: Thu, 28 Feb 2019 11:24:32 -0300 From: Renato Lui Geh To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, stefan.popa@analog.com, alexandru.Ardelean@analog.com, giuliano.belinassi@usp.br, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com, devicetree@vger.kernel.org Subject: [PATCH v4 3/9] staging: iio: ad7780: set pattern values and masks directly Message-ID: <9c8331166124ec2bd52794a9c9f844bfb70d1cd9.1551358569.git.renatogeh@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -#define AD7780_PATTERN (AD7780_PAT0) -#define AD7780_PATTERN_MASK (AD7780_PAT0 | AD7780_PAT1) -#define AD7170_PAT2 BIT(2) +#define AD7780_PATTERN_GOOD 1 +#define AD7780_PATTERN_MASK GENMASK(1, 0) -#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