Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4214342pxt; Wed, 11 Aug 2021 00:07:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM3VVuLvu+56B4n4D0aKWAks9CibZhHOAoadvQ9n3g1qqjFjVgyT1Y7LHjtAndikbZ48nv X-Received: by 2002:a17:907:20b6:: with SMTP id pw22mr2267120ejb.512.1628665648759; Wed, 11 Aug 2021 00:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628665648; cv=none; d=google.com; s=arc-20160816; b=ujIoipoahv7fT/KVj3tfbs9PrOx2f88UBmuCUEZsv2XI+ikUO/Dpkl2HMx8NgyTC5K 7hxm19C3oxA1hfSQLLkH9sMFSnUJWQmsqyS7m11uv3lesbiQjqlm00jNP4KihnTjCch2 6gb2fHfgWo4Jwqzq3XW8S9iPDMpbgkSv62yNpiZ4w18KPOJk2SIHJBzDWpqd2QHKJOps ml7dDFKx8Genik1JJNhPZZa/dd24edW15MxBDDyEt7MIHnHV/iKLnmRfKtsoDFv3wBNH iz9c4D6xMJkXIGjUro82Pw8Od9XCP17lmVIYtXPFVE22HRnEjYamoP/pg0UJI+iK6oHc mWCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xzgav6eUnQmltf8HkdcWS198foTYa67bhyoLNro+l84=; b=MW8lUoDnUmCgo+PjdMjL/1j5PvNQzAkbCFvZT6Vy1bJi0zzEApF5lBBpJ+jeQQkv76 RjXxb9Vj5Bfra0PaCrmmkiIY+Y6HOlDVJnrHt2AMl9orFd0aNUFoXAI318WElPGQoNXC 71eNnwVWRU93ep+knQag/3Q4ZSvOZ57ccMmRNLaYZpA6Y2BHBdwPHQ2SI6g5y5rtz1y0 K7u2CHdUDs0njegGMDZsSd2inmC1FTKpc3EePSK1QwQq7zpLzyEjx2/QyfeUr0+EoQyp A/Ed01ZOAG6kb/ShdxX7GUpl1p7kER7V/bINS03GcmhZbp6KqWsGppWO9MnlHaPOqs8r wjiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="WYCt/2Bq"; 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 p14si1333240eju.82.2021.08.11.00.07.00; Wed, 11 Aug 2021 00:07:28 -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="WYCt/2Bq"; 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 S235058AbhHKHEt (ORCPT + 99 others); Wed, 11 Aug 2021 03:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234760AbhHKHEt (ORCPT ); Wed, 11 Aug 2021 03:04:49 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E641C061765; Wed, 11 Aug 2021 00:04:26 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id l11so1452266plk.6; Wed, 11 Aug 2021 00:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xzgav6eUnQmltf8HkdcWS198foTYa67bhyoLNro+l84=; b=WYCt/2BqlX22QNRrnllXEQcMGmu2Oz0+4wRl2uUVD6Mb2pcmozRVSJaDsgjplbD48v 3v0W7+0jNX8finaIFxZWJgmYllxvUDX9IqyMfhsmdcbibshAm+3n/WOp+WoR9sOxz2ww paNcBTn3GYHvUpB+G17QkdxFrMxT/koGcUROUv1KLRaYhw//1OgxwImNS59vw2frC0dG 0vLQjTDIEFgiLcav5nEPn+upsOigDdm5AXdyJalpP4RbcCc0t2TmIc+sOwc8meNXiGNo YQXhjDUk+W2/aFL5Lb2qwjcLAN56K6zQ06bO4pELxDQLTXT8GFcMZeolqHcXO7n3Zayb XJUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xzgav6eUnQmltf8HkdcWS198foTYa67bhyoLNro+l84=; b=McnCsSWGO5CjZB9BSa0/rxZR8/Tl/sMvF7BpdWf00nQko5KU+Of1fqJ1Qou2NLTxG6 tifYC++7CoYnZZ9Iz3/0BIPaZ1B0JCNYRPzrRiS22TCp4mArOLwrp+AdhHXRrVPzzxIn uosnMnYwPLqu2znQZyrAgOtN9IFjIvGlFRNhvHmXhKDP43nkskf39EV6BjXOxmjTeeMp 65qEzxegX2tiy6Vqc7Ex7b5sDuodZZlFAk4Ivt1RdnGa4Gsq6mJ4fPN3Z/kWMXxULXvC J/03C1Vp83TKGvE4akPoB2/Zxpd+guGVq4KEJVUajw4ed4cAWY1v+K6QNFgkXpmYC71M R8eQ== X-Gm-Message-State: AOAM531Wqq17oRyrl7gvfSSnRqVT+LmTKfV573wVM2E5MMvWHLVl2R5s mP47+tjFC0wf6IAg5JYbbWl7VOHFCjYTtVKvSmE= X-Received: by 2002:a17:90b:33c5:: with SMTP id lk5mr9253206pjb.129.1628665465692; Wed, 11 Aug 2021 00:04:25 -0700 (PDT) MIME-Version: 1.0 References: <20210809075745.160042-1-dmugil2000@gmail.com> <20210809075745.160042-3-dmugil2000@gmail.com> <20210811054558.GA3826@mugil-Nitro-AN515-52> In-Reply-To: <20210811054558.GA3826@mugil-Nitro-AN515-52> From: Andy Shevchenko Date: Wed, 11 Aug 2021 10:03:49 +0300 Message-ID: Subject: Re: [PATCH v2 2/2] iio: potentiometer: Add driver support for AD5110 To: Mugilraj Dhavachelvan Cc: "Bogdan, Dragos" , Darius , Rob Herring , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich , Guenter Roeck , Chris Packham , Slawomir Stepien , Krzysztof Kozlowski , Alexandre Belloni , devicetree , Linux Kernel Mailing List , linux-iio Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 11, 2021 at 8:46 AM Mugilraj Dhavachelvan wrote: > On Tue, Aug 10, 2021 at 03:49:52PM +0300, Andy Shevchenko wrote: > > On Mon, Aug 9, 2021 at 10:59 AM Mugilraj Dhavachelvan > > wrote: ... > > > + data->tol =3D data->cfg->kohms * (val & GENMASK(6, 0)) * 10 /= 8; > > > + if (!(val & BIT(7))) > > > + data->tol *=3D -1; > > > > Shouldn't you simple use corresponding sign_extend*()? > > > I'm not able see any sign_extend for 16 bit. Is there any other way? So, then add it in bitops.h the same way it's done for s32 and s64. ... > > > + if (!data->cfg) > > > + data->cfg =3D &ad5110_cfg[i2c_match_id(ad5110_id, cli= ent)->driver_data]; > > > > Not sure this is not a dead code since you are using ->probe_new(). > > > Even I'm suspecting that and also removing id_table. But I'm not sure of > it so just left as it is. I=C2=B2C ID table is good to have without direct use, but ->probe_new() is called if and only if there is a compatible string or ACPI ID match. In such case data->cfg may be NULL if and only if the corresponding table missed it, but this will be a bug anyway, so the above code will rather hide the bug. Hence, please remove it. --=20 With Best Regards, Andy Shevchenko