Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1148270rwl; Fri, 7 Apr 2023 10:37:53 -0700 (PDT) X-Google-Smtp-Source: AKy350araPvueQRLYWZdqbIN/g0wV2c7ugskkIaYLq3HZwtZNW8AviZEzBY/pnjRIRiRlqLK7JyE X-Received: by 2002:a05:6a20:8c16:b0:e7:7844:9029 with SMTP id j22-20020a056a208c1600b000e778449029mr3098070pzh.53.1680889073192; Fri, 07 Apr 2023 10:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680889073; cv=none; d=google.com; s=arc-20160816; b=MDeA2ukov58ejI+JCx+3merm5Izl8baJkknAsbScFA2K9Saun4V1q5pSD6U8QHeBa2 Zvnfqd2Z5YcJ0FoihnZ5yFdWbZPhI/HoLxiLs6BCR5Q4rfCao3/ZRDUWYlSBRHkCm9gq jMVsKQEikUD760oS1QIt77Q4FB91/Zdc5svc9UFsfKgTuzGz39SXuGK3mG6BYXiomYZ3 2D5Eee2s1QQI0eeMYYz93jvXoOTKrlZ424pfMofyIbcIr42V3KX6IuC4lfhbvbcbmDW+ F0FYOWbEQ3TZ0SNtScXJ/Dg/wlU67ryrOtqyVzTY4qAEENsMdGDC4RCxiNAJBFhHQkQp 9+pA== 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 :dkim-signature; bh=r7eDI4UP04AEfcUSo5P2lE2liTr4g1wuKauQK/Imx5I=; b=PhRJRimmuX5QJMIJEqNXQvUeRfQXYobHPQtgnEme0+1mo7JaQUMlKT7DoQmaSz0j1b CLppAQ3Fjx4W9Ev0JjugILis6ahMYkkS7SFxjRaABrCllW7ELs8+o7KLkTq9ypghVi1y y9hezsdSAz25abtHnPKXuwmMjxg1FYlAKTFGQ95esAT9NXdryFEtbP0NZlERXLFevGLT osECqBKfwHc2eAfv/+nw1SDR1GmdSwBo6z6Tw4XT4ITZwneaE4k7JObbTD0BSlacu/l0 W0DKZowywWNTN+yxFZ04l5sxkQR2JXoJX/8tvnqRtzlHyHo363ao2RiTi1/vSUjGzr9g jhkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VHUNZdR2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h186-20020a636cc3000000b004fbffa7d04dsi3916783pgc.863.2023.04.07.10.37.40; Fri, 07 Apr 2023 10:37:53 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VHUNZdR2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229808AbjDGRbD (ORCPT + 99 others); Fri, 7 Apr 2023 13:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjDGRbB (ORCPT ); Fri, 7 Apr 2023 13:31:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09A71AD0A; Fri, 7 Apr 2023 10:31:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91AA26125C; Fri, 7 Apr 2023 17:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05371C433D2; Fri, 7 Apr 2023 17:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680888660; bh=ApDacg564yr5uR1+DT8HL2ziSN/TMUAvPNtZ6acpD3w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VHUNZdR24huVQ3g2RLjQ1xdAaKubYbmcrRB2kQPYzhpspIc4v06WFLP+PS8ylUO51 08qSoDjKIUCw2cA1FlPWJjVYGomByikHqHy0WmwyT8QOGlMojM3dsL2qT4sTzh7ecM aAUZqV9KkGmw2wglP+snCPhkOOhMtFt+7CflxUjJS85QtRoiQztPO2UxC0xJH/Xqg7 /zT8VlGzCCspVKWpOXgtvJ0vn/2oE4joc83/d7Cw0OIwg+cmei7eW/JGTqmnTPsEGk qMr9aFovFQQsSGHNY2JKntiBj81kWzFvGRFHC96f+HEKEkfMUlhQMZhDjczaU8aV15 bCBPnA9xIGDXw== Date: Fri, 7 Apr 2023 18:46:16 +0100 From: Jonathan Cameron To: Lars-Peter Clausen Cc: Nicolas Frattaroli , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] iio: dac: mcp4922: get and enable vdd regulator Message-ID: <20230407184616.2fd2d52a@jic23-huawei> In-Reply-To: References: <20230405140114.99011-1-frattaroli.nicolas@gmail.com> <20230405140114.99011-3-frattaroli.nicolas@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 On Wed, 5 Apr 2023 07:21:00 -0700 Lars-Peter Clausen wrote: > On 4/5/23 07:01, Nicolas Frattaroli wrote: > > [...] > > + state->vdd_reg = devm_regulator_get(&spi->dev, "vdd"); > > + if (IS_ERR(state->vdd_reg)) { > > + ret = dev_err_probe(&spi->dev, PTR_ERR(state->vdd_reg), > > + "vdd regulator not specified\n"); > > + goto error_disable_vref_reg; > > + } > > + ret = regulator_enable(state->vdd_reg); > > + if (ret) { > > + dev_err(&spi->dev, "Failed to enable vdd regulator: %d\n", > > + ret); > > + goto error_disable_vref_reg; > > + } > The two above can be combined into `devm_regulator_get_enable()`. This > will also take care of automatically disabling the regulator on the > error path and on remove. I'm not keen on the ordering of probe wrt to remove that results from mixing devm and not. Note that already happens because of the gets vs enables so another reason to take this driver fully devm_ based. Jonathan > > + > > spi_set_drvdata(spi, indio_dev); > > id = spi_get_device_id(spi); > > indio_dev->info = &mcp4922_info; > > [...] > >