From patchwork Fri Aug 19 19:19:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 12949117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DB69C32773 for ; Fri, 19 Aug 2022 19:19:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350882AbiHSTT5 (ORCPT ); Fri, 19 Aug 2022 15:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351371AbiHSTTU (ORCPT ); Fri, 19 Aug 2022 15:19:20 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED1BFF4F; Fri, 19 Aug 2022 12:19:08 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id l1so6776390lfk.8; Fri, 19 Aug 2022 12:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=AANLxeJ0LpA7gGpSl1Si3QPJ6JAdv159yU2e2glG7p8=; b=DsvV8zNJOqwTBy5DNUpgWBkMYnMY5LZZwKR79UqkxspV1lqtqz3+WHbLFY9l/tQIGn 2C0XuxGAZ9AtM08pWBu2/uMDCtkNlICuR2SSN2gzsh5vAljxtJBI/m79Qi757gsTj6dA 82E9gFLnqgPB0pLzcLYCb+D6SFDYQSjeJGWyZYij3dMxtO1m0YFp4z82uIrFLCYgSMOj sJb/I6jjHGvWq1qKKDOx4+ckdtDQZUW38H4kO+UYdOQmEyqii8i1IqnleyP11OKveFww LB8rNoJnCMq3VfZbF3SpN9399ul+MVM+xMUmsNXQDCShjl4YGB4iIHwnCE0bXxEECfLR VZbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=AANLxeJ0LpA7gGpSl1Si3QPJ6JAdv159yU2e2glG7p8=; b=o9sQBA12lb0EpYS2u1h8WpDLebWcmZmaDollXpsyoXKOLoE9vOraYDfPqFi8BKyLer qopRvqqaKPKYecbZpxCPAHAW17NBA5eZ7BTSclXH1SdMcAnAtqDhZqly9MVrSEb5jAm3 PsITmTYMJusnj+mnJYX7z8bSWwnEv2IjH6qH4Gt+NbklySvZxbtB/Tad9Jh8iG625Kkq qfIIQVRJU55vjKlyQkeeEMA0hjSH32ZP+VmhDTt2cQbQQ7uytzS2dA+S8niaAkDmMwET qrYmw+Od523X8roS9KPydDaQgkWraAYFj2+p1CaPWDwPuISDmDQ+wuWTPSGhahEdqDQN Mntw== X-Gm-Message-State: ACgBeo2MIQQUIWyu2J1010bOCdTBahsNdEdRD86l/OvL50ujYd9IypJ7 enOxPR0qsgESdROG4rzhlHw= X-Google-Smtp-Source: AA6agR51+Y9+XrHdyIIEGtNp4Q/w/K7E3YqgGy2J+KZPVECydq1v4p4Cw5CW4w4QIEU3eTwkM5wpDA== X-Received: by 2002:ac2:4da2:0:b0:492:c6a9:f430 with SMTP id h2-20020ac24da2000000b00492c6a9f430mr1683375lfe.96.1660936747173; Fri, 19 Aug 2022 12:19:07 -0700 (PDT) Received: from dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::1]) by smtp.gmail.com with ESMTPSA id a16-20020a056512391000b0048aa9d67483sm736249lfu.160.2022.08.19.12.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 12:19:06 -0700 (PDT) Date: Fri, 19 Aug 2022 22:19:01 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Alexandru Tachici , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 06/14] iio: ad7192: Simplify using devm_regulator_get_enable() Message-ID: <9719c445c095d3d308e2fc9f4f93294f5806c41c.1660934107.git.mazziesaccount@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Use devm_regulator_get_enable() instead of open coded get, enable, add-action-to-disable-at-detach - pattern. Also drop the seemingly unused struct member 'dvdd'. Signed-off-by: Matti Vaittinen --- v2 => v3 Split to own patch. --- drivers/iio/adc/ad7192.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index d71977be7d22..8a52c0dec3f9 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -177,7 +177,6 @@ struct ad7192_chip_info { struct ad7192_state { const struct ad7192_chip_info *chip_info; struct regulator *avdd; - struct regulator *dvdd; struct clk *mclk; u16 int_vref_mv; u32 fclk; @@ -1015,19 +1014,9 @@ static int ad7192_probe(struct spi_device *spi) if (ret) return ret; - st->dvdd = devm_regulator_get(&spi->dev, "dvdd"); - if (IS_ERR(st->dvdd)) - return PTR_ERR(st->dvdd); - - ret = regulator_enable(st->dvdd); - if (ret) { - dev_err(&spi->dev, "Failed to enable specified DVdd supply\n"); - return ret; - } - - ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st->dvdd); + ret = devm_regulator_get_enable(&spi->dev, "dvdd"); if (ret) - return ret; + return dev_err_probe(&spi->dev, ret, "Failed to enable specified DVdd supply\n"); ret = regulator_get_voltage(st->avdd); if (ret < 0) {