Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3473504rwd; Sat, 3 Jun 2023 06:04:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZtJnM7EER1Z9ZzUAJjUqIVD0KEkMpvJd8RZ+GSu+kKkwuIjQzswMQ9YyCV+N3g+sW2D8+ X-Received: by 2002:a05:6a00:1303:b0:64d:1185:243c with SMTP id j3-20020a056a00130300b0064d1185243cmr11388144pfu.5.1685797491420; Sat, 03 Jun 2023 06:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685797491; cv=none; d=google.com; s=arc-20160816; b=UQjnUniZmiJ0I4VDVLtjw4Ed23wUqpI+sx4CwE3R8+KUNcVYOsNdLPPAl+JSD0blsV 1/cJTVvZ8CVMYI21Z/slLmgq+JQNFvJK/O4xLhcTwEcXAtBYE0f1oOex30gp67MXnyty 9qr6us/DdXfqfLxBgBKM93i0FYQ51zDe7l/ip5PEcw1thIHPzNimi3mvHZQzzmgnNlVv EzrkTsY9NneYHjNgL0g4jsaNKtDHLD952fXmL8tvY+bdT84Vl343geQMW2kwSVVdMwvx +ge6cHohZThAI1i+V0CwR7onXwfh050ooYJ0uNQ/j5I0bBsJirvHx7v8p1IjyHkZ+0Mq DSqQ== 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:date:from; bh=F8VaPL70Lzvv9zCh/m0mt/Mqcn7Kcq6Qklx4Wk+ZcVU=; b=dyT3f30lykz5XpfWEs621qlvi/+ZAy8ZtLI1fHeQCYwAsyKm/I0MErRh6DubXpxApK h+c5bZ+jwBIRfPYUalGI/o5yN9uHp0FdMXoltYy1Ac9QiVxmVfU9MKNuG06HbCUGfDBF GVxbPmaqCqDEiti9cAuAXErgWNcawrK05387uhhatpNybROx1qLyDwq7IoNTsmVXNY8Y PNz14dH93XpMZPlFEj4p5Xfug0EhJceFBgFnyuQ1RqFWdK9Ce/+FrHj5sIxcxS6iLj/X TM01Ap7PKTG3fFqOPBQDDOPVyKV7wt/1Gmy4ppQVg64m90W08QA9jd/RGlD9mjP5+DLY K/IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020aa7982e000000b0063f18073138si2463762pfl.99.2023.06.03.06.04.38; Sat, 03 Jun 2023 06:04:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbjFCMDa (ORCPT + 99 others); Sat, 3 Jun 2023 08:03:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjFCMD3 (ORCPT ); Sat, 3 Jun 2023 08:03:29 -0400 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B9B9196 for ; Sat, 3 Jun 2023 05:03:27 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id a4cb2b86-0206-11ee-b972-005056bdfda7; Sat, 03 Jun 2023 15:03:25 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Sat, 3 Jun 2023 15:03:25 +0300 To: fl.scratchpad@gmail.com Cc: jic23@kernel.org, Lars-Peter Clausen , Michael Hennerich , Alexandru Tachici , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Cameron Subject: Re: [PATCH v3 3/5] iio: adc: ad7192: Use VRef instead of AVdd as reference voltage source Message-ID: References: <20230530075311.400686-1-fl.scratchpad@gmail.com> <20230530075311.400686-4-fl.scratchpad@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230530075311.400686-4-fl.scratchpad@gmail.com> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tue, May 30, 2023 at 09:53:09AM +0200, fl.scratchpad@gmail.com kirjoitti: > From: Fabrizio Lamarque > > Add missing vref-supply and fix avdd-supply used as if it were vref. > > AD7192 requires three independent voltage sources, digital supply (on > pin DVdd), analog supply (on AVdd) and reference voltage (VRef on > alternate pin pair REFIN1 or REFIN2). > > Emit a warning message when AVdd is used in place of VRef for backwards > compatibility. ... > + st->vref = devm_regulator_get_optional(&spi->dev, "vref"); > + if (!IS_ERR(st->vref)) { > + ret = regulator_enable(st->vref); > + if (ret) > + return dev_err_probe(&spi->dev, ret, > + "Failed to enable specified VRef supply\n"); > + > + ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st->vref); > + if (ret) > + return ret; > + } else if (PTR_ERR(st->vref) != -ENODEV) { > + return PTR_ERR(st->vref); > + } Wouldn't this be better? if (IS_ERR(st->vref)) { if (PTR_ERR(st->vref) != -ENODEV) return PTR_ERR(st->vref); } else { ... > if (ret) > return dev_err_probe(&spi->dev, ret, "Failed to enable specified DVdd supply\n"); > > - ret = regulator_get_voltage(st->avdd); > + One blank line is enough. > + if (!IS_ERR(st->vref)) { > + ret = regulator_get_voltage(st->vref); Why negative conditional? Usual pattern is to check for errors first, so if (IS_ERR(st->vref)) { dev_warn(...); ... } else { ret = regulator_get_voltage(st->vref); } > + } else { > + dev_warn(&spi->dev, "Using AVdd in place of VRef. Likely an old DTS\n"); > + ret = regulator_get_voltage(st->avdd); > + } -- With Best Regards, Andy Shevchenko