Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4252681pxt; Wed, 11 Aug 2021 01:19:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4NvxFQLP1Qo1FocI99bE7FEIwxJN2eA2IFFXDKwrRBxmdoVK+v5jNMirNHfQXphps78np X-Received: by 2002:a05:6402:caf:: with SMTP id cn15mr9974543edb.236.1628669961169; Wed, 11 Aug 2021 01:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628669961; cv=none; d=google.com; s=arc-20160816; b=zlXtMZwy3BYP26tcsor0z0vV+L5VVYKRzM8Apwu1qhKeSI9qtpoWpmY5StjU2lhNee JRfuMg0XfunSKe1h1wCyxYlCkLn+ADAzE4xSonSmKel1Soa0jes4cYlES4RPa/6jbwR2 RspfLBlXPgQS3kgI7pT+Hrezu6r2WmSe/zlHbeakGM1g7d1s+LXjvUIF76d10S1bSAk6 pm+YA/N9/AN6GedxC1uuUFFg+9Ky9tfs6WLxtD0bLWnqJZC0AUbEOxcRQtpVkwBKbGB1 67RqTvZzT+jTMnjHkDZ0yUPuJ1yKiF2+vVhxDMeYTr08DuzVIJqRsPDZ8/7W/RUWGI3Z trJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=dUpACG8aiUQKUG+rkp01YuOY1SDfByf1trncBtx1z7c=; b=TTPyviefbZQYIs1agyQhdXdHDD4XNuxx1ork8LDP2l429C4sNN3MlX0IQnz9FUOFqP xfgK/AkTQJzl4+BNmVMm8EkWK1a+czhxLDqzr7YFfp5K9fdG8GINd7lLLWTVz2JJxsS1 /vClCxhKXIGWRmz7Xo5j0M0m41hmb/E77JHn8trr8dIaFV/wh8PmfYWbeMRDQVaw63jl so5GJCp72QyZZ8qwEgqedPmUJSFMnaiDp7g1nzV0Cs/mHxNNY1tI/mDLXkaF8NA9yYt/ qKpxKO7xv7YTI0cEf6SiFUUvzwsQZm6EfZafqrrVQBEnHguI20xtm0Bu5NdpvQEC6jlA Rk1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@metafoo.de header.s=default2002 header.b=ds9Nrz6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metafoo.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf27si9391321edb.374.2021.08.11.01.18.55; Wed, 11 Aug 2021 01:19:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@metafoo.de header.s=default2002 header.b=ds9Nrz6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metafoo.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235137AbhHKIPu (ORCPT + 99 others); Wed, 11 Aug 2021 04:15:50 -0400 Received: from www381.your-server.de ([78.46.137.84]:54956 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235053AbhHKIPt (ORCPT ); Wed, 11 Aug 2021 04:15:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=dUpACG8aiUQKUG+rkp01YuOY1SDfByf1trncBtx1z7c=; b=ds9Nrz6zHCpeudTBYLZWmxaPs6 XBTPus2B+JHGUjVVUrYMQGJb5tLCuIRZR7YqtCkAlJNzWNAYVQBDHqpswMrJEz+cq6lWpNXVCO5lH uGTohanqNiQRvqT5dKXLxFxPxJL4ZBtlUVidO4E4bepmSnZ6cCL/hCA/seUeYvvzG2y5OTu4/YHYJ dQVgi8TZ+k/W1KWL1gUP14kTQbR7K6ICcn/M6hV7f1IxALf6SpI8hK48ICQ9SwctLREwoACbBoIab alq3P6WVHT/Zkf737PKgKOHv13S3v9ACiQKdVviYh1Y8sq9vvPiVif04d4Lqu6rTFfQrhMVMZsCCe QE6e4lpw==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mDjOH-00017W-Sp; Wed, 11 Aug 2021 10:15:09 +0200 Received: from [62.216.202.4] (helo=[192.168.178.20]) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDjOH-0006Xj-HU; Wed, 11 Aug 2021 10:15:09 +0200 Subject: Re: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110 To: Andy Shevchenko , Mugilraj Dhavachelvan Cc: "Bogdan, Dragos" , Darius , Rob Herring , Jonathan Cameron , Michael Hennerich , Guenter Roeck , Chris Packham , Slawomir Stepien , Krzysztof Kozlowski , Alexandre Belloni , Alexandru Ardelean , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org References: <20210809075745.160042-1-dmugil2000@gmail.com> <20210809075745.160042-3-dmugil2000@gmail.com> From: Lars-Peter Clausen Message-ID: <013bcb79-c496-44d8-2e93-57eb57834ee0@metafoo.de> Date: Wed, 11 Aug 2021 10:15:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.2/26259/Tue Aug 10 10:19:56 2021) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/10/21 2:49 PM, Andy Shevchenko wrote: > >> + data->tol = data->cfg->kohms * (val & GENMASK(6, 0)) * 10 / 8; >> + if (!(val & BIT(7))) >> + data->tol *= -1; > Shouldn't you simple use corresponding sign_extend*()? The data is encoded a sign-magnitude. sign_extend() works for two's complement numbers.