Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2915829pxb; Sun, 29 Aug 2021 07:33:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziqu09XdGCmJ55pDNPJfZGx6+puSnXFDiQYz136AD+JznVlK6saO3tSR0VMDMsrmd8wxhP X-Received: by 2002:a02:ad17:: with SMTP id s23mr12202644jan.135.1630247636818; Sun, 29 Aug 2021 07:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630247636; cv=none; d=google.com; s=arc-20160816; b=bjlsgS9WmTmeJVO8Ohd1XishPR9WpIzfJwtfEYY5fkVPwo/Y70GsLRWAzWYgkKQVwy xQRTTsPt4ZG60lS8Xq7yy7rSWqjLDSuyc2DZaIvd48mI3HryESDxlD7z45CxraSUHCw2 XDtWYrPAZ8ob73S/6SNsUG4iLNtFlTnb5fumEdZdl0cpg5BR52Tv14ReZmLR9qn0Dp23 AfdExZxYRFs8+R5VssloHSra5lrTX2jR2qboQwGBn2UZ4eyY9zGYus9hhN9mP842KCUs lYmsXgrkvZyK5xwWRKHDzMeDvuSgVVkSF3YBbS7vd6wTdCSveYd29bXX3ZGYKqFDAMRZ kfHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=WzZ0aBLA7VB6mAEiBfhbtAdUN9OT3Rdrn0qWakk2i48=; b=J4MbwK4kW9DNCWPHt/B7vHkQge4zErPg6ANmLnHp15Y214YjPP6B1F06rhhoWtswB9 UQwruVBOIntnKFpN+aVKu7BTxXgnHFBQYrjSAnjskNtlQo0xV1WFgEDaJESG1RsY+4Gq QRMbK38ErhGKImaVGJSFQsKlNrnbJKcMM876aNc0dRhPbSXUMM9dfzI9JfB9quZ7j6dg 7dZzzEZzmscOeQZU9KIbt+82MWJZ4w0RPzCfO2PpSvHhrA5Otg0kOmxvop+pKRsIMbPP 7nQXXSfuwoL8ahTm9H3ecY5uH8AuQksJDhzWE9vNJB7gDdbDWP0MewqETkapDMSXcikl +hFQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si11869142iot.52.2021.08.29.07.33.37; Sun, 29 Aug 2021 07:33:56 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235478AbhH2OdV (ORCPT + 99 others); Sun, 29 Aug 2021 10:33:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:44870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235459AbhH2OdT (ORCPT ); Sun, 29 Aug 2021 10:33:19 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B5866023D; Sun, 29 Aug 2021 14:32:24 +0000 (UTC) Date: Sun, 29 Aug 2021 15:35:39 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: Liam Beguin , Lars-Peter Clausen , Michael Hennerich , Charles-Antoine Couret , Nuno =?UTF-8?B?U8Oh?= , Linux Kernel Mailing List , linux-iio , devicetree , Rob Herring Subject: Re: [PATCH v6 3/5] iio: adc: ad7949: add vref selection support Message-ID: <20210829153539.3b2cf037@jic23-huawei> In-Reply-To: References: <20210815213309.2847711-1-liambeguin@gmail.com> <20210815213309.2847711-4-liambeguin@gmail.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Aug 2021 16:12:58 +0300 Andy Shevchenko wrote: > 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. Hmm. My thinking (I suspect I asked for it to be checked, but can't remember :) was that I'd really like to know if a device tree contains a property but that property is invalid for some reason. The docs give a bunch of reasons beyond the property not existing (which is unhelpfully described as just 'invalid parameters'). I guess that's a bit far fetched. Let's drop the check as Andy suggests. Dropped that check and applied to the togreg branch of iio.git, initially pushed out as testing for 0-day to poke at it. + we are about to enter merge window so I don't want linux-next to pick it up just yet! Jonathan > > > > > > > + dev_err(dev, "invalid value for adi,internal-ref-microvolt\n"); > > > > > > + return ret; > > > > > > + } > >