Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp87791pxb; Thu, 12 Aug 2021 11:24:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcNpoXfmQ92z57xzxcqWVZIlSpCQec5xhZ1W3xr4eksQEPToDDqGybubXYUV0O66sArOp9 X-Received: by 2002:a5d:9486:: with SMTP id v6mr4076501ioj.163.1628792663407; Thu, 12 Aug 2021 11:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628792663; cv=none; d=google.com; s=arc-20160816; b=t6iHCzuOUDYmZcmTu9uDDN6jxH47l0TcwszqoSw4v0Ql1UoAEvB+/VREVOmSZ9+Sjs 4TOSXxWPi8YVun9PFGvYEPxuF0X4s6r9jsiEfSKQ6OgG/WaAZmncqcU/t5ZOSbXIZf1N sjkzKJFvmC+Jago+XGU2ScYW2AM8zvNmCkKiQh6kicpCIkjt5iAbKumBmIQXC/yjZSgq KiNAAu67/pgsMAbqtk7ZvLK0JRjFYe4ltanKQF0dKwEAm763HovAtt/Z/qi1dTiG6LUN v7dBzHcy3z2L8p9Ljycvu+pzaXhCGffQvQylHnMatRnpI0c8Q9EVO2k0jdAeghEYWO8/ jQOA== 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=6VeB2NYn9eofqF8nKLlfBx5n8WuLurLWCP0jk+U/zuA=; b=L+cp4/t+CFlI3V4EYfy2hazNfA/k91n5Phi8PonHzXNwlrIOrGJwKpHBMiphsKLKjS a+GqULVjIkD8i5xZxfnNL/JIUWFKY6Wlbm0YL927D+VUUJuB4loV1aZ5kzOEP07O0Fxq K1b+z13a8bMWaE1X5b4BONaF/852xy9i8mba5kG6KLkwyCZfxFB4kwu2iT7/UUD/D5HO dMLwW+xQB6ekvNtZf9XqRY3O7pG1+7kHicCJeQV9ziEQxO15aQg6KF1+0SptVoePtstO /Sem+UfEG3kiHNZNKvoPPXvSpKr5w/SPqYQmMqNGI2XZlXgfzA41P5CCgca69moR5nbI o6kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ghY/Y1TQ"; 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 e17si4264794iot.103.2021.08.12.11.24.11; Thu, 12 Aug 2021 11:24: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="ghY/Y1TQ"; 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 S233314AbhHLQyO (ORCPT + 99 others); Thu, 12 Aug 2021 12:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233324AbhHLQyH (ORCPT ); Thu, 12 Aug 2021 12:54:07 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00FADC061756; Thu, 12 Aug 2021 09:53:42 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id s22-20020a17090a1c16b0290177caeba067so16288422pjs.0; Thu, 12 Aug 2021 09:53:41 -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=6VeB2NYn9eofqF8nKLlfBx5n8WuLurLWCP0jk+U/zuA=; b=ghY/Y1TQp4mbwP3V8+T9dU92Ev6OQB08h8E15tZpjc0UaFPXq68bNfe6aco9QHEyPw Y2imqp0byCXMCOuDMEH2vZQAGWNXKZ10V2R6SohOnx5zZEfoH4PAuu7KtapgMMIcIBYr i7AkSDIWe6l5B5nW3ZJPQEqz9Pe5p+9GRcf7MdHF0TqUpFh7VU7Ysj7NJJ3krV5S6THq tVACBPm/xjbTy9ftkShGWGBras8mNu0LWxfDa3TEfyAQHqc3qoCGiwbKqPMzJolW9rwv QG6kT3o3LH32Hh1krZWX9Zv7hUNuBn7Zc30xnxrKK7fezWBwpu4BQp7tSXgdh6IQvTve f6Hw== 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=6VeB2NYn9eofqF8nKLlfBx5n8WuLurLWCP0jk+U/zuA=; b=tdK22KdPvvtWZsHtobJhQL7XWx1WqJZxjfcMPcm3EQ8bjZcPcnVE0Kgh7k5Nb8Yooa vx/ah/4qBAYvtyBqLgJibon/GE8P2jUaLro2bfqd3lindQl5YbXv0q9iCBuxNbwEJJXk ZnXhkvEyn4Hy8HrClZpYNK4K0O4se9B0otM0tbv21gZHISe4Hln7qFN18lBpqXFGMHzg yLWWN1qDLgqWid8uPNvLzjDUnbie3ZAnazvEYBcRizfta/p39BRCyEz98CnpATsdAwH0 X+ubJHgAWe1hL2TcH8Z/ebJvAm3YZ23aMMToFG59uufPhKXtSrjf9Nv4CjDceJs2DtSO QZLw== X-Gm-Message-State: AOAM5315sKz44YiXfRTB8NyOKPV6ITXvcU5zd+9wjcaVC22CJ0AxkVUU A2U3a7jXRyQKtRQH05b55GI= X-Received: by 2002:a17:90b:1b0c:: with SMTP id nu12mr5199932pjb.163.1628787221448; Thu, 12 Aug 2021 09:53:41 -0700 (PDT) Received: from mugil-Nitro-AN515-52 ([2409:4072:60f:dfd:8405:dea5:a2d4:3c2c]) by smtp.gmail.com with ESMTPSA id u13sm4015501pfh.123.2021.08.12.09.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 09:53:40 -0700 (PDT) Date: Thu, 12 Aug 2021 22:23:27 +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: <20210812165327.GA4542@mugil-Nitro-AN515-52> References: <20210809075745.160042-1-dmugil2000@gmail.com> <20210809075745.160042-3-dmugil2000@gmail.com> <013bcb79-c496-44d8-2e93-57eb57834ee0@metafoo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > -- > With Best Regards, > Andy Shevchenko