Received: by 10.223.185.116 with SMTP id b49csp2338717wrg; Mon, 5 Mar 2018 00:44:30 -0800 (PST) X-Google-Smtp-Source: AG47ELs5HDTTt2v8NWd3uMEmMmwiZqNp5PsEgW9I5SputcA5XUpVXAKwKq1N4E2GkHUN7N3/TyO8 X-Received: by 2002:a17:902:b690:: with SMTP id c16-v6mr12610675pls.264.1520239470227; Mon, 05 Mar 2018 00:44:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520239470; cv=none; d=google.com; s=arc-20160816; b=OqRwRRG8yJtSHPDZmdXdYwlMWqlx4Rj9NIQUMGErBBYog6YYXhIJ86srEf0XA8+B2i kv+sJ2XMqwV8dKkY4Xj2HA0ZamuU2PHXldn+wjVsk+zTUdHtU2yCWXNbjuXMdcCufuy9 3UU7b9Vg/8IUgh6mgl35zPXYCn5U5lBQeSeWTh3+3MGY1tqA3I1fAoMIX2hbWZ6aVIHr xuESmwlCCXPdKftn/6p1IA7OLLFq0Emd4cxRuo76ihONUV3yVY+0ukEvQ9P4jdHbCOn5 oZbaZ0tLEdRPf+RPQum9yxDp7f3fKOrIbaV1J763aI59PYY5Vi9qZ515718HRLOOvcr7 woEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=EGCDau63+EqEJyB1KfD9OSG+sTSEwe4dxQr1MQzqa5A=; b=fRLmGatTzKpFz3JJPYKxxYL0wkc/9xwjJNPB/R0PMMQuXHK11G6JQ7Z0riYzrPBwyF 6cYxcTv9DDHyblpRBSeno6Ig4e4IWW4JRMZqv8yslbcLrojx68g6Xz40EXbdUZzciomE mF4jSCn7wMBy6TWzolzy2q8bjkM/Sf9CZJF+3ThN+ql3qn/SJUPFsoWEeR865Urbginq wloCcsvt+0lQSafY9drItLmQDOWgwpFmqNAU4yOvuczSZnFzQXbaimBM9f39qcNLmuUX CsCL2vPbcX9FbUBTf/7uUw4TfSr3i6CYXIehLF89FVCt08sz3MjQzYtwhwOi2CPKAMZg HHmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lZRE9kNW; 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 n6-v6si2661035plp.574.2018.03.05.00.44.15; Mon, 05 Mar 2018 00:44:30 -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=lZRE9kNW; 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 S1752504AbeCEHug (ORCPT + 99 others); Mon, 5 Mar 2018 02:50:36 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:43926 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933008AbeCEHua (ORCPT ); Mon, 5 Mar 2018 02:50:30 -0500 Received: by mail-pg0-f67.google.com with SMTP id e9so6510606pgs.10; Sun, 04 Mar 2018 23:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EGCDau63+EqEJyB1KfD9OSG+sTSEwe4dxQr1MQzqa5A=; b=lZRE9kNWjWVPaznODg33KtBkLEF5NnqCcaMXdtpITOfiIrHNtYskXnvrh7cPpRxGiG h2gAeJBUEoP2WEWXKqy1oxF0HSBxkJnBY+BUswqJV67xGOM0GBZU9U5j9ZfjZtNsQ7CH cFEfCqlvfBSgLjliCmQ/3+FpgM77fzDHIGD1Kygemf9lTLVPI1JS9PUS9524WkMPT6Jd T3KSpZ2ZCUZG5ruvdITFP/uVlqN1r6+vUDRFOb0ncXltLq4ezvuOfcZH120FM41iKOat zcaCqTUw4SG7k38zJ2K7tXiHuXwbMzatIV5OEbcqe/5mgHIHROXQhT044/NQdbZlqyV4 Xcjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EGCDau63+EqEJyB1KfD9OSG+sTSEwe4dxQr1MQzqa5A=; b=tagtgqi1g0tvnGTO4Z9NVeYOB/TZjYIH841ODD1GlasR2p8m/xHN4CYVnOfa/bnIlu z1x2FoqI21AH+840bVQgxylvl1g833XgKRGQE5MQptwTZrm81qPK0ddSLXvEq8vxvIHK VSWru3EyTlkgtybkDjkB1ScSvkE9lvNg/aB58Gvrvx1d2jfWozp89yfRQe37iT7xz1sk 34gAlXuAt/ToXKJtcMJys2T3SigoZ/gPZS9FX/Z99ZN/v/p+M6GPqvvhDem7hGzPEl9i OxLce+wziU4ii2ozg1MTRxihKqvPsyKjC0mXiVKNcJR3EQMTeACL6NhaX03HZ7Y4CI+r qvZA== X-Gm-Message-State: APf1xPAiwTdvWjRtUxTaAuIeeW+taysTCc0yKQMfy1xf15ntgKvOwz0s 48g3YD+Tovr1XWxJWoJrYHI= X-Received: by 10.98.200.131 with SMTP id i3mr14601934pfk.40.1520236230066; Sun, 04 Mar 2018 23:50:30 -0800 (PST) Received: from localhost.localdomain ([103.46.193.14]) by smtp.gmail.com with ESMTPSA id 125sm21674256pff.114.2018.03.04.23.50.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Mar 2018 23:50:29 -0800 (PST) From: Himanshu Jha To: jic23@kernel.org 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, Himanshu Jha Subject: [PATCH 09/11] Staging: iio: accel: Use sign_extend32 function Date: Mon, 5 Mar 2018 13:19:28 +0530 Message-Id: <1520236170-14668-10-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520236170-14668-1-git-send-email-himanshujha199640@gmail.com> References: <1520236170-14668-1-git-send-email-himanshujha199640@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use sign_extned32() for 32 bit sign extending rather than hard coding the same. Signed-off-by: Himanshu Jha --- drivers/staging/iio/accel/adis16201.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c index 307d4ab..8d795e2 100644 --- a/drivers/staging/iio/accel/adis16201.c +++ b/drivers/staging/iio/accel/adis16201.c @@ -159,9 +159,8 @@ static int adis16201_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; } -- 2.7.4