Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4215195pxt; Wed, 11 Aug 2021 00:09:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvxEXDmuaj77iPFBBpor32qyh9EldXE3cjmcuutjZT0Z0061XAbCSRytrGM/hFKyhpkAhP X-Received: by 2002:a05:6402:111a:: with SMTP id u26mr9638734edv.260.1628665740080; Wed, 11 Aug 2021 00:09:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628665740; cv=none; d=google.com; s=arc-20160816; b=Hcv7VDGSV4zEvQn1KHjMkw0x0sat7Cd4sspDrNnZXY9mhQQyalD0PsGNVahq/0XJyo 3ETeU7h4Cs5FeQk8EDT+TSjQFX5Jbo5eDKIfSIa6uAdPEBn0P72Mjy5S6PKJCD18gJT0 mdVUMEOX2tDZtDkjrE3Yu64hgh3VOJpIZEX0cdcpsIZr7swMYRsmGmRh3SOL3OsPZ+Yq LeHtAMbKR6/lc2x3LMhxjBemCZTx/BqxqDMQBKcbAdIn4Z0Avo9Ts6V3g7pfYfFLAbCY NdlEXTTowUoTi64XS2Ehl8NQ7dSh82vMHnZxIVTv5RdvAWsYax1yaqDR6tiaczQZ8k+F O7Yg== 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=UvcgK0+rQdblk0xtTCyiUYf9oJ8OzcTny0hyRS8C02A=; b=hgeWEC6Wm2vnbmhgCuBniEb5WTpqVji/R0O1qEQ/Wt9ZflLAY0Emn0q/E2C6bI72Ag 9THoB9FMZ0f7WvCiXAYG5SreasXiPnl8bMv1+ZgSWN1l35A8Wf4CIqWf7WZZZ+KiH0RB FQSy3+gOdGJJtCzDGPoWywWWAZWnTft6THLckIAqTJml7hDg0Yw7JVEpK2Lm77ZeY3Q1 qfivOjzKa8ExmUS6XNx0edLnELnn06WIc2TokX+w+kdP6/sM1mmhWtiycPbJWxDRO2Tz FxtUZ69zCyyKNvjgUcwmfbwbZrIwnuTCkdu/Rpfohm94h0ZQyDlnKnHLJsLhoFxZ6EQp M23g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="UZ/PRojW"; 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 gw9si12782442ejb.227.2021.08.11.00.08.33; Wed, 11 Aug 2021 00:09:00 -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="UZ/PRojW"; 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 S235109AbhHKHGm (ORCPT + 99 others); Wed, 11 Aug 2021 03:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235491AbhHKHGl (ORCPT ); Wed, 11 Aug 2021 03:06:41 -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 D9900C061765; Wed, 11 Aug 2021 00:06:17 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id g12-20020a17090a7d0cb0290178f80de3d8so3074962pjl.2; Wed, 11 Aug 2021 00:06:17 -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=UvcgK0+rQdblk0xtTCyiUYf9oJ8OzcTny0hyRS8C02A=; b=UZ/PRojWKXnWpO1OGqce9RHvhChvopo2iBq56x4sMiuiQ1+itve2g5JDEulc28YJjs 6vUIFouSplyRPuTyNZtRHK79pJx+eUNjRy/adoh3dVbjI6rTvD9lvocwy5AFziWOW0NT Kp4fn3ZTjydQ2/rGsn3WnrM0J0tO5DTPs3DmUrtZkgRaFEGKq68CIa0nFocvjlywsyDJ 29r8BF1w30xXq02Q1bYcV6iMZ9MbeueS7l7mS0amfxauUkJtveHpRzd0FT0jHXVdmsxO 7GKErXZoViIVKim1KHzeYr+AsZLDGtAPIZNDdYYtH58DDD1rJGfzVH6Z3N4KWd+z0qhO yAtg== 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=UvcgK0+rQdblk0xtTCyiUYf9oJ8OzcTny0hyRS8C02A=; b=tlnjY8v6OLOUtKEytTaZZL58H/p+FKFv79wCXDXQ4KsXZY3z3d0G3LD0mbold3NfQ1 6za/jfp5evX9Rze7flGoBYEzDGjk1U8zgMboImVI4nKSMLnhAoNNGUix3doTQJWOWmBS 0qkrOrbuzfPtgxTP3IkCOfe+JyNCWoUUN+fHex6QWK4giq05s1IdKtMC15ByaDRafBrd Ai/PP9aLvD9ZpqlY/wMp5sfWP+k1fSGBZfnTK8E45SSL9iw3StOZ+J9tW+WcyrDFKDWx NqXii1cQWNrAlE5uGa7hc06VXDDC1zZk+knfPxrY67NTu1tKuwB5STXxE/J363DvaWlX 6bgg== X-Gm-Message-State: AOAM532Z7pfvgrrjWJIumveQ5mYszNXeWvcU4NFOhjQJRrpd617YPN1l 2Z3DjmIBK193rtb41Wc+jHWvsbbJCrCUI/YtVCM= X-Received: by 2002:a17:90b:33c5:: with SMTP id lk5mr9260109pjb.129.1628665577419; Wed, 11 Aug 2021 00:06:17 -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: From: Andy Shevchenko Date: Wed, 11 Aug 2021 10:05:41 +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 10:03 AM Andy Shevchenko wrote: > 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. In case you are afraid that this will delay patches and you are in a hurry, you may define it locally (but in the very same way, so somebody can make it generic). Nevertheless, I think this one can be added directly to the generic header, it will definitely have more than one user. > ... > > > > > + if (!data->cfg) > > > > + data->cfg =3D &ad5110_cfg[i2c_match_id(ad5110_id, c= lient)->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 o= f > > it so just left as it is. > > I=C2=B2C ID table is good to have without direct use, but ->probe_new() i= s > 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