Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp337866pxb; Mon, 16 Aug 2021 06:38:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfKAoqWivsULkslsxC4Cgmip5/7XISiv3nmyfk7+YvT1Fh/i95ga08QRfK6mwJL6K7tYBO X-Received: by 2002:a5e:990e:: with SMTP id t14mr7643097ioj.75.1629121082358; Mon, 16 Aug 2021 06:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629121082; cv=none; d=google.com; s=arc-20160816; b=kV0vEkMrysEa7hdHJ5qSvoEQOgmj5EY5/ka7rvixVRs5UDP0flMw9uTOU0rfm3wjTK d5Pz7GpQ7Ppx2CH865kcCzx5VZStdiMtgXbRrlylXMq9v/lYvV1W2LhtLtxPuEgBLOae KDAAsa1TiFN0YdMp3TfwpVocod9pIrZmPl9dffBFoFCYziLjfhyE7U13gWvGROcIZQOk zar9MRIqQz2R6FmZu6KGo8qEuS+QWAY3/jKIfzGfKiVJ98ZSsO5q5m3GyQukfs9X31Hs t6gPckGMBGFhiK3jugOUzd4n1QaXo0B6a2RDTTXQ/J3+jwBEZgW0pyiW0m0HG2O2JhAG V1LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/pA1pAvAiNe/l0P1Vz8nn+khgB1MLduCxo2hSicfh7Q=; b=Dxk0z3Ieh6deUVwEZBLyDBnolnh8CthvJW1dES24TeVtVTSijRy3DTYgk/j1w14p2U p3aXxnZ8XbfqKPNkcUME0jU2UhLpY3/BUEsT1UQbi+jnQ+syOzJHgiAo5dy0f8SxtRqV EW5AWmgewmdnqiQ9zCyNyK0ZwwGd4fk6+dJtzC4mv1sL6dtV9lciql5JB7iD2xefgbFy aH6Nfq7116zN+jgnZklBRZ3z30UM91+WaE5vvFqTvDBYmwfzbN+vN6wMcoNxcaCYw8iE 4RoFgVnedHtwse1Sd3uF6Mqjhp/WcpLX0pqoYUHIR7zbd27Dv8OsQRdUmbfQiHe0YeH4 FTRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="CZTJ9/tr"; 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 o16si7313873ils.161.2021.08.16.06.37.51; Mon, 16 Aug 2021 06:38:02 -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="CZTJ9/tr"; 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 S230094AbhHPNhj (ORCPT + 99 others); Mon, 16 Aug 2021 09:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240145AbhHPNhM (ORCPT ); Mon, 16 Aug 2021 09:37:12 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40E6C03402C; Mon, 16 Aug 2021 06:13:38 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id j12-20020a17090aeb0c00b00179530520b3so11875538pjz.0; Mon, 16 Aug 2021 06:13:38 -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; bh=/pA1pAvAiNe/l0P1Vz8nn+khgB1MLduCxo2hSicfh7Q=; b=CZTJ9/tr6sTzcdg62crIK6nxhx5RjmcKkPytcvB4Ebqx9DZ7zpMU38A777/0mvBOdI AOEKtBayrZRUO8zegV04pY36A1zgUU/EipY1j7kps9R296PLf/TwigOqAGYiH8xu5WsP 24RgNmlhHIWeFpAs0+pI4deYlBHhRmrG8ObIXI6CfyWgYVi8EpDmaVFjfdNJBCQwBMmL C+tf6vxmK/4HbkMd048VVMhB5NtbYguSuVVFjEuNWEHuzgYVKkC6nmfNzD25Mccvsuby I4mRKOu1L3QDiUFWdvPP6yuimmEmMnxt3wZTu1QbnplbpMy/liJ2e6S8nzXqJnggp2xV NyVQ== 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; bh=/pA1pAvAiNe/l0P1Vz8nn+khgB1MLduCxo2hSicfh7Q=; b=fu69OhiiO0SkZyJYMVs8VeMap9BTwv8uvStndUOYlx2JQm0fOiTAeuHnaKj1iAPvce zRN1QzpF8Keuk4gku9UXjISu2sJ7lit00HZmrA0XaVCn12xKgjagoliAoFA3mF+r6QZd t7jk/f7q0FGyGkgvAjisXFuRdxFiDrm/mGIk7v4WRjevo2ClZ7jpLDhdHep70oli32TR /VZj7NPOIEIiEDjnqy9AcHeP97Yk4EuuaSP99zTzrccsDPxFllAzdlpts/1l2erRetTk Yfj7guORgzQg+RAWMLprsU8o4odM4SrlQ7lKIrTPwv85FfieGdsCuFkmgYgNtJVpjIhd v4YQ== X-Gm-Message-State: AOAM531QNMNfvb4M/27QhC/El+EyGYmy2AeimpV2xmh8VqF2QnO0BDO2 Oh7MQJq2Fv20QFO7NSXBi9JlP/r/tcHJaxdv8v4= X-Received: by 2002:a65:5ccd:: with SMTP id b13mr16007694pgt.203.1629119618351; Mon, 16 Aug 2021 06:13:38 -0700 (PDT) MIME-Version: 1.0 References: <20210815213309.2847711-1-liambeguin@gmail.com> <20210815213309.2847711-4-liambeguin@gmail.com> In-Reply-To: From: Andy Shevchenko Date: Mon, 16 Aug 2021 16:12:58 +0300 Message-ID: Subject: Re: [PATCH v6 3/5] iio: adc: ad7949: add vref selection support To: Liam Beguin Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Charles-Antoine Couret , =?UTF-8?B?TnVubyBTw6E=?= , Linux Kernel Mailing List , linux-iio , devicetree , Rob Herring Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 16, 2021 at 4:07 PM Liam Beguin wrote: > On Mon Aug 16, 2021 at 8:48 AM EDT, Andy Shevchenko wrote: > > On Mon, Aug 16, 2021 at 3:39 PM Liam Beguin > > wrote: > > > On Mon Aug 16, 2021 at 4:04 AM EDT, Andy Shevchenko wrote: > > > > On Mon, Aug 16, 2021 at 12:35 AM Liam Beguin > > > > wrote: ... > > > > > + tmp = 4096000; > > > > > + ret = device_property_read_u32(dev, "adi,internal-ref-microvolt", &tmp); > > > > > > > > > + if (ret < 0 && ret != -EINVAL) { > > > > > > Hi Andy, > > > > > > > > > > > What does this check (second part) is supposed to mean? > > > > The first part will make it mandatory, is it the goal? > > > > > > > > > > device_property_read_u32() will return -EINVAL if the property isn't > > > found in the devicetree. > > > > > > This checks for errors when the property is defined while keeping it > > > optional. > > > > Don't assign and don't check the error code of the API. As simply as > > that. > > I'm not against getting rid of it, but I was asked to check for these > errors in earlier revisions of the patch. Okay, I leave it to you, guys, to decide, just note that the usual pattern for optional stuff a) either check for (!ret); b) or ignore the returned value completely. > > > > > + dev_err(dev, "invalid value for adi,internal-ref-microvolt\n"); > > > > > + return ret; > > > > > + } -- With Best Regards, Andy Shevchenko