Received: by 10.213.65.68 with SMTP id h4csp238874imn; Fri, 30 Mar 2018 04:43:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/PE6Em+UFLMfeMiN21aJss7DXFJ++e8lzMI2s6d3xstm0kDYhZ7O0KQHsVDWVvOh2lEmRu X-Received: by 10.99.190.75 with SMTP id g11mr8271543pgo.127.1522410187793; Fri, 30 Mar 2018 04:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522410187; cv=none; d=google.com; s=arc-20160816; b=y6aUEH78SCgn/bwTCSvEbAeM7gLH0ABNQ4B3BlpdUSX9Lo4TiMZ24C6CSViK+hrsUB gnDgB4XZxUQgQc812eoce2CygKAdgC9nQZ+KVjakJtUAgrBm8AVDm7d/I1RFUvvKk7FS UNzXvoaNMCZ6EfVzYI+fRg3kh8U9A1aUB7JMjnq0xGTJ7HdcRBz6nqMDwQl2UPd4FSnH NY/G+UjLV9g7fOm4J3X/qcBWyurpcofV/rZFaQZNvjvTLi7Ipg5zDSHH2fPvEl+kNo5k xEtA0qBDprdUvPzzcgItL/kcboydNJ/FnBZvJn2aROyCKQyq14PSaynveSpdScPt4xB4 XXWA== 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 :dmarc-filter:arc-authentication-results; bh=n5cV/OZ5N4SaIelrhxESwes03Dm7m0agLKfTY/L36Mc=; b=MKEpZY85sm0W4LGziLsB6+ce5k166ujRL6EfD3yL/nWLU0YUEbs4Omi2yn5HX4rJfr KYiPWOBg1iz9fivd+MbpcnyuoHHNrU4xMFqmI+8lu8KHnoorpvtzcR4s5o/KhbL/4ARN wnb2AZjNG5MYwPhGCW9A4ns4vZb6Vfz3uHX4ZwSArDyqD16QN08X98SLScxW8LPbxWUX l60ZCSg4WCJ1uEP4bCNnND/3+c/WDyf2SVZOzb5mY59kHuFmJZKSF4bu6dvTRelSqAPs g8XWdcN+1vy/NoKCcwo9yjy0btIgOHxvpis6wXsDIg2ciZ+VAF1M2p136cf+0sHzfYMw hrcw== 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 t18si6244831pfi.319.2018.03.30.04.42.52; Fri, 30 Mar 2018 04:43: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; 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 S1752216AbeC3Lka (ORCPT + 99 others); Fri, 30 Mar 2018 07:40:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:39178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751191AbeC3Lk1 (ORCPT ); Fri, 30 Mar 2018 07:40:27 -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 D33892175B; Fri, 30 Mar 2018 11:40:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D33892175B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Fri, 30 Mar 2018 12:40:21 +0100 From: Jonathan Cameron To: Shreeya Patel Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, Michael.Hennerich@analog.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, daniel.baluta@gmail.com Subject: Re: [PATCH v6 5/6] Staging: iio: adis16209: Use GENMASK Message-ID: <20180330124021.1c6c30ca@archlinux> In-Reply-To: <5d43c34c95f3b58f5b79254ae67bf7a080f39a92.1522306893.git.shreeya.patel23498@gmail.com> References: <5d43c34c95f3b58f5b79254ae67bf7a080f39a92.1522306893.git.shreeya.patel23498@gmail.com> X-Mailer: Claws Mail 3.16.0 (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 Thu, 29 Mar 2018 14:51:19 +0530 Shreeya Patel wrote: > Use GENMASK to improve readability and remove the local > variables used to store intermediate data. > > Signed-off-by: Shreeya Patel See below. Fixed up and applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > > Changes in v6 > -Introduce this new patch in the series. > > drivers/staging/iio/accel/adis16209.c | 19 ++++++++----------- > 1 file changed, 8 insertions(+), 11 deletions(-) > > diff --git a/drivers/staging/iio/accel/adis16209.c b/drivers/staging/iio/accel/adis16209.c > index ed6d7c7..cc50667 100644 > --- a/drivers/staging/iio/accel/adis16209.c > +++ b/drivers/staging/iio/accel/adis16209.c > @@ -112,25 +112,22 @@ static int adis16209_write_raw(struct iio_dev *indio_dev, > long mask) > { > struct adis *st = iio_priv(indio_dev); > - int bits; > - s16 val16; > - u8 addr; > + int m; > + > + if (mask != IIO_CHAN_INFO_CALIBBIAS) > + return -EINVAL; > > - switch (mask) { > - case IIO_CHAN_INFO_CALIBBIAS: Looks to me like the indenting is now incorrect. The next block should be one less tab in. > switch (chan->type) { > case IIO_ACCEL: > case IIO_INCLI: > - bits = 14; > + m = GENMASK(13, 0); > break; > default: > return -EINVAL; > } > - val16 = val & ((1 << bits) - 1); > - addr = adis16209_addresses[chan->scan_index][0]; > - return adis_write_reg_16(st, addr, val16); > - } > - return -EINVAL; > + > + return adis_write_reg_16(st, adis16209_addresses[chan->scan_index][0], > + val & m); > } > > static int adis16209_read_raw(struct iio_dev *indio_dev,