Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4472197rwb; Tue, 6 Sep 2022 08:02:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6h10VqFAGtjWP9BaEd1GK/6wYttXfA+ykniuEyG0UwSDdynWvjOcuQ6Inv/XGZMIF7Hp2/ X-Received: by 2002:a65:6a49:0:b0:42c:299d:b0aa with SMTP id o9-20020a656a49000000b0042c299db0aamr37243299pgu.54.1662476533489; Tue, 06 Sep 2022 08:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476533; cv=none; d=google.com; s=arc-20160816; b=XmxMfBxI1t/+kQ4L4e0TuZUM9A2KB9Zj6E+wkM6ryWNwPdf9LtjP5x0sVn3FhdyqE1 SVwVZwZpfbWA6VpCXhMCKQ/fdcXdnv1tfjgnrhoOHJlJOwzBaSR9ub0nmUSeMPAQHXVX fhu+P1mLIn/3Wjp+AyV2ZGtXvXbSSib5N45kH+qgXd5UM0HV/Lr3MpsbBJvU9tFnLsFb Ba7Z+aUKCWoKeCZJkAnkWtV5rLkG97stdf/BpDlamiHlb7zQstPRtXjAJe41jrZr4se/ 1xFlZJc0d9DVdvdKXUQWusR7hEV5z6C34SwhE7/kb/N5F8AwBuGViSKMG9/Pkjqx+qln klvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8XkFzsEsGfcHj0ryTJOjcWszRojnvi3Qd5Fx8KGDy3g=; b=0RtlC8tnE7xxCMHP0b1bVUSXvG85C43ClHPFlR0vDQETlcCKa2T1h1B8ZYEya0zyi1 8BI231qwhG8Fq0Uc/fQyCW3zuIoDI5kx7GxXuVn6OCqHAx+90uutuuFKGwhwGaop6X3o DsbS89c26VZU4gO5LhLaFELyEaAQnAfqPIcZBjDLZHz3JDQI3IODhqx0i76PJxIWdAl5 vk1RaKVcflGuc8D/wIwlO8ybtHeUOeqFLeAF7ocoOmRqLvjX/PFvK0NccMlf1wPjIM2C AxLZt7+Sfo1kOOO+yIv6kBIYboymGHkV3t47s0BOLk0gc9thNMtJXb17EpkwWxj0Uphe pl6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1REMIIak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 199-20020a6302d0000000b00434277cd636si10469193pgc.414.2022.09.06.08.02.02; Tue, 06 Sep 2022 08:02:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1REMIIak; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240559AbiIFNdc (ORCPT + 99 others); Tue, 6 Sep 2022 09:33:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240517AbiIFNc6 (ORCPT ); Tue, 6 Sep 2022 09:32:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B8677E92; Tue, 6 Sep 2022 06:32:44 -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 ams.source.kernel.org (Postfix) with ESMTPS id 70DD7B81636; Tue, 6 Sep 2022 13:32:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC014C433D6; Tue, 6 Sep 2022 13:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471162; bh=wqHPCUBxx7Rg50w87XTOL2OcwHMiKLPe+qwpIghfDmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1REMIIakHORyUhNfjTN1zmoxsh3TgcZszyzLyiqLvyp6Q1s+zRiPr1gRWv8SdazkT Ek/0iLw5h9TJ8zFBujBEkKImJj7Fj+hI4MOiDyOY6/d7xCvjruFprah6zOLJBLVNiD OMcZpmU1evWFzlpWxfNW417r7wX1wvnpmRaxBcZo= 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.10 06/80] iio: adc: mcp3911: make use of the sign bit Date: Tue, 6 Sep 2022 15:30:03 +0200 Message-Id: <20220906132817.200137615@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132816.936069583@linuxfoundation.org> References: <20220906132816.936069583@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 e573da5397bb3..81eeb00842112 100644 --- a/drivers/iio/adc/mcp3911.c +++ b/drivers/iio/adc/mcp3911.c @@ -111,6 +111,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