Received: by 10.223.185.116 with SMTP id b49csp5515893wrg; Wed, 7 Mar 2018 13:10:08 -0800 (PST) X-Google-Smtp-Source: AG47ELvUsz4/FTyDZijGeDRdpx6jEFR+OFQg9ZFXOwZu6Rc6AT6aX/npUMbHECcnJCxkEoOMkVqF X-Received: by 2002:a17:902:9686:: with SMTP id n6-v6mr13807444plp.331.1520457008690; Wed, 07 Mar 2018 13:10:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520457008; cv=none; d=google.com; s=arc-20160816; b=JuetcVGMA51PiPgezMnqZ8bdKGUmWNRTa5yjAW0CPhbCzcyrDCyjB6x4fzJCVTz3t9 047Ey7SXik/bt9WM3tZFR8v7hDT59FAPKbtHXJcR4TM51iOYUBfpxvpHnPvs8pmu5cUe 5ypMw8JL6pRjzLU3WLQ07gxLDtjqTmdFqEYqjvOF973F9Cz7x5sK1pYGtSUkNewJD91k XMdfZ/DPsk3DYuB0Q2CJKbBNxYr/AT51FWN7+ciaI246HjLImTtFwKs62PbVhaWnnRG5 x0osLRe8wg8TjypJIxGvD7O97e+PIi9/AeEZm46Xx5562MFIfAm/B7OcEZ7v06o4ZWXV iGGQ== 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=AaYeLeNiTYdpqEBd6ymhEIAtr1XQPpGg/dL4u180yQU=; b=YDqAAq+kY3mF6Ilth2y87Ksjtftcros9mKIgG0kGb1eYu3kZEPBQLUyrfd77bsBmOO CSdefafGMP9AegUIwcqyz26RQQgvVpeWmf+rCcPOJKpd/YimOXgIqnLL+DjStR5OExHp yq5yLB0IDilnG0dEVrrFb8YL8r/JitZHrZBbEAa2yrHtqqkX/DA6yFVkKDonjW1fefiO XYPR3PpmLNYxeH+7Jwmn6/xPTo8Wl/BVaz0jQuGUny75BH2pYX7AiMf+1x0ulTquFiC+ MQdx4OEia6FPIE4wgxz9OdX1qXFvp/ZrzQ9IGfqROixSJQHBdUuvRORjO2C0U1qlI9hC KBLw== 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 u76si11762362pgb.725.2018.03.07.13.09.54; Wed, 07 Mar 2018 13:10:08 -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 S933591AbeCGVIx (ORCPT + 99 others); Wed, 7 Mar 2018 16:08:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:37528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754333AbeCGVIt (ORCPT ); Wed, 7 Mar 2018 16:08:49 -0500 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 4620E2172D; Wed, 7 Mar 2018 21:08:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4620E2172D 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: Wed, 7 Mar 2018 21:08:44 +0000 From: Jonathan Cameron To: Shreeya Patel Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, daniel.baluta@gmail.com Subject: Re: [PATCH v3 4/4] Staging: iio: adis16209: Use sign_extend32 function Message-ID: <20180307210844.621d6130@archlinux> In-Reply-To: References: 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 Sun, 4 Mar 2018 18:15:06 +0530 Shreeya Patel wrote: > Use sign_extend32 function instead of manually coding > it. > > Signed-off-by: Shreeya Patel Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > > Changes in v3 > -After split patch. > > drivers/staging/iio/accel/adis16209.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/iio/accel/adis16209.c b/drivers/staging/iio/accel/adis16209.c > index 9cb1ce0..a8453bf 100644 > --- a/drivers/staging/iio/accel/adis16209.c > +++ b/drivers/staging/iio/accel/adis16209.c > @@ -212,9 +212,8 @@ static int adis16209_read_raw(struct iio_dev *indio_dev, > ret = adis_read_reg_16(st, addr, &val16); > if (ret) > return ret; > - val16 &= (1 << bits) - 1; > - val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); > - *val = val16; > + > + *val = sign_extend32(val16, bits - 1); > return IIO_VAL_INT; > } > return -EINVAL;