Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp96638pxy; Sat, 14 Aug 2021 01:22:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiPKtinC5n/loNPZXssjc6+fZEEAQEbemQsiG3rlJDqGjmKhEbYlNxaahi04IXIfsGEJft X-Received: by 2002:a05:6402:1606:: with SMTP id f6mr903154edv.111.1628929343410; Sat, 14 Aug 2021 01:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628929343; cv=none; d=google.com; s=arc-20160816; b=o33BFGqRLZ9E1k0iHBJffbkR/EeMpoDq9SZgT0iVDOigHi42LLBrYjXYmw2ERyfCN5 rkunfLzwF9Hx8srB2dL/759HCyAYw2FVmDevSJVdsxef7ihM5t3W6/7ykP29xxhrccJr ydIq2iPwxE/nKlswEOrMynzsVXgO5nZYeqgYv8z+pnfdqSKnMsXuIRpFMIHjMovYJtUC TViOZK6hGmuyXB5hcYeZzbXlpN/aMiFpsmLmC9vJJ/uW6YJWrSghl7FlEcyTRqjdH/hb 4R093MBE3e2mLaTYBggXD13vIE8ZGYBgT0UJyaD/FJ0SsmEIxhMu3id9QO3gRv18B9e6 Xbbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AlwkvMA5TKL93cZfm6M/CQUNPE2+oYy9JxRaVYzYyAg=; b=xSBMzi3A+YFUsVOolM2tDDuUryJtOmSinA1U+ZJuPe3n/LjT0iNDICuJ1zeNpxBCiZ yVRqslt9epMQtGxy9LU79hHyz4af5f/kc8zaqStt9A8C+bOjx1YvTgaM8rX1hnTwPVfK EEWTvJcvYnPjV+2bUupu6hguLlZ+2hGd5BXlCTDI3tPfN5dHsa5q3D22nG07FrEcVieP gr/QKm5Ydn3KQJTphE1mQKATfXUqAhvfOiNiwC0F5+ttdLChy2C9mAjAGg4RPN51Gaqh POLi/EmL4Dv0STv8oisVFjME3u1gDS8APTU1IoOUaHYgEzbcucDgN9s8jv7PBVhAR99D dtTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="FD/+MbNA"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si4299371edh.461.2021.08.14.01.21.59; Sat, 14 Aug 2021 01:22:23 -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=@gmail.com header.s=20161025 header.b="FD/+MbNA"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237508AbhHNISn (ORCPT + 99 others); Sat, 14 Aug 2021 04:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237299AbhHNISm (ORCPT ); Sat, 14 Aug 2021 04:18:42 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 249E3C06175F; Sat, 14 Aug 2021 01:18:14 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id n13-20020a17090a4e0d00b0017946980d8dso5268093pjh.5; Sat, 14 Aug 2021 01:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AlwkvMA5TKL93cZfm6M/CQUNPE2+oYy9JxRaVYzYyAg=; b=FD/+MbNAvOYFb7/jptc9n+3gwgnj1+DzxQhYXtrzYQN8kw5RT7yCjsxTtRMyvvRcgv ZnIXGVm1BU8koYL79u5bKmkaQJLvjSFD5L+WkR+t0qkMoG0GBgTqVDPylbnJPAFlAxEt DkydKSy3pnTCwRASf08koslXni/OQsjgxgekQ2HC/NFcHZleoRl1YOjOORupFF5Nv9n2 Rb1082VcCqad+Ha3MAVL6E2Kx6FIximf/E2v+UGhXU4QTYAvJ+DZgz9MYsEqoLpucDGN jNX0MN8FvpEgCqsVmUpm3WD813ZoNIc5fyoHhOUActmErmMMFBEO+VF/l2MUYCHx12E6 LGYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AlwkvMA5TKL93cZfm6M/CQUNPE2+oYy9JxRaVYzYyAg=; b=If01E0o6JPWxPVo9FzxNHAs6C1u/FTLuX7FeJS0qAsVukUQJU+pb1++lQ2GvcLSvgz +3NvmAtbUSzgO4f8faX2BRfPCVXxVKswNHy0Sdm9gHw3fkhUtJracm6Vt0ySVO5YoGYN pdGBA8LVpl9q/IMZX9mjKobrGHUznQsEeUDf/C74t/kRpR9dncmKCTCqL5Cg4ieOhw/l eh0yDYBlvfJ+0o96zHtoWkjF+DlZCsuGzBmeGOOIqyLANn5UlC5m+oxD1dqy8cT7lXwq WAVEA9UzOMmzZWxBoKCL+ANa3e6mGgx+UhV7n/LiAkx13TlQoWYxAjpti94KlXaU20R0 NVxw== X-Gm-Message-State: AOAM530senXLns3p02GI5gqgb9lmmGbVI+8umrwnH6go8ZV0/k/f8Bwd wV/5jLsUcFQr2Iv2WzA5bYk= X-Received: by 2002:a63:303:: with SMTP id 3mr5889661pgd.439.1628929093503; Sat, 14 Aug 2021 01:18:13 -0700 (PDT) Received: from mugil-Nitro-AN515-52 ([2409:4072:608b:6e91:963e:30ac:c1d8:e28]) by smtp.gmail.com with ESMTPSA id y62sm4655325pfg.88.2021.08.14.01.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Aug 2021 01:18:12 -0700 (PDT) Date: Sat, 14 Aug 2021 13:48:02 +0530 From: Mugilraj Dhavachelvan To: Andy Shevchenko Cc: Lars-Peter Clausen , "Bogdan, Dragos" , Darius , Rob Herring , Jonathan Cameron , Michael Hennerich , Guenter Roeck , Chris Packham , Slawomir Stepien , Krzysztof Kozlowski , Alexandre Belloni , Alexandru Ardelean , devicetree , Linux Kernel Mailing List , linux-iio Subject: Re: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110 Message-ID: <20210814081802.GA11128@mugil-Nitro-AN515-52> References: <20210809075745.160042-1-dmugil2000@gmail.com> <20210809075745.160042-3-dmugil2000@gmail.com> <013bcb79-c496-44d8-2e93-57eb57834ee0@metafoo.de> <20210812165327.GA4542@mugil-Nitro-AN515-52> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210812165327.GA4542@mugil-Nitro-AN515-52> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 12, 2021 at 10:23:41PM +0530, Mugilraj Dhavachelvan wrote: > On Wed, Aug 11, 2021 at 07:06:43PM +0300, Andy Shevchenko wrote: > > On Wed, Aug 11, 2021 at 11:15 AM Lars-Peter Clausen wrote: > > > 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. > > > > Good catch! > > I'm wondering if it's a good idea to have a sign_magnitude_to_int() > > helper or so? > > > So, What should I do now? > Will send v3 with other changes and add this change in v4. Hope it's okay. > > -- > > With Best Regards, > > Andy Shevchenko