From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EF72C6FA8C for ; Tue, 6 Sep 2022 14:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239709AbiIFOAU (ORCPT ); Tue, 6 Sep 2022 10:00:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240901AbiIFN7D (ORCPT ); Tue, 6 Sep 2022 09:59:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E538282FB6; Tue, 6 Sep 2022 06:42:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 807DD61547; Tue, 6 Sep 2022 13:41:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8540CC433D6; Tue, 6 Sep 2022 13:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471708; bh=S3xBB7T+bXoRget2ouEuihIFOiu46uEWYzkUacTy5yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l8gTLBLfWr/PZG0TO8JpAS6iOle8Hde1zgYUHHQDU2yzT4AM+d2yWjRjto60SnC9z GmSGaHB1M3rkl8h1NiQtpqoAcfag6X7g5yeoTu/XaFXpWkYxE6Er3/NieXP5VMWQLr tUpOtQBuUHgqKxRP20NBoZ5Q3UqtA9x8wpnBaLvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcus Folkesson , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.19 012/155] iio: adc: mcp3911: make use of the sign bit Date: Tue, 6 Sep 2022 15:29:20 +0200 Message-Id: <20220906132829.963449288@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marcus Folkesson [ Upstream commit 8f89e33bf040bbef66386c426198622180233178 ] The device supports negative values as well. Fixes: 3a89b289df5d ("iio: adc: add support for mcp3911") Signed-off-by: Marcus Folkesson Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220722130726.7627-2-marcus.folkesson@gmail.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/mcp3911.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c index 1cb4590fe4125..f581cefb67195 100644 --- a/drivers/iio/adc/mcp3911.c +++ b/drivers/iio/adc/mcp3911.c @@ -113,6 +113,8 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev, if (ret) goto out; + *val = sign_extend32(*val, 23); + ret = IIO_VAL_INT; break; -- 2.35.1