From patchwork Fri Aug 19 19:20:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 12949121 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 EB35AC32771 for ; Fri, 19 Aug 2022 19:20:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350276AbiHSTUd (ORCPT ); Fri, 19 Aug 2022 15:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351331AbiHSTUN (ORCPT ); Fri, 19 Aug 2022 15:20:13 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 067896D9E6; Fri, 19 Aug 2022 12:20:11 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id z6so7286193lfu.9; Fri, 19 Aug 2022 12:20:10 -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=Pb/vY0IBh75ZxywBj3v0sp843PBbdLtQyqNhmT3+yDY=; b=Lc6bZjFhO4FgG/ECahM5tfFzfVv7QznDYxYW+vyWZl5wUwNh+9D5my2vtz1wPmRHDi RdZEUfILboDCP2srh+Kr3JiH5wfUBTbQqETUemABjxBJWHaHZhDhQ6Jo0gI0cxkyx3Xd CrY/AyciFVtr+dUP67Iqu56O0hQTxAb0m9NlrrCNpdx0YbgdIL2yKOVaum3/tG3KPixR fnJarH/DYbmMnpaJxA6jDzjb4PT+0lXIWjTNDCOWD7xoxRagwXikcTQV7mBP8lowElRH ourck/o6z8bQJ589jOeT1O4gpJjC0992rXG19RsJB6Hqt99xzoSSLgYK18SrMnOWr1YA y47g== 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=Pb/vY0IBh75ZxywBj3v0sp843PBbdLtQyqNhmT3+yDY=; b=v+6BEClQVoTntpU9d56dWOjZB73JErVUkq1HRWefKKwLEDiiGpbtvFev6EkcoD1aU0 dBi7OljGqsTjsEt98+SWeem/LrLSZrTDKu7FgyDLvtaMvmg+Qleu8prs9y3I0ibAfxW5 ELeP9MDbFVSQoLTCG9wnRBp8xpcpL0bapLWvkt7Nz6H3MuG9/g+aenYn+uXh8gHekqVS X2uwAsdq5W4dWErIquW/fRadPbo0IaxchBQeo+/eXI6ETJGreOxckYdjdkMS3fZDLirT qnNzFFIku9WDjFuUgj/Aov4z5yUbJFoBRcISqW2Vwe6XqQ+J0dgJkfpmGeDL/TVNyJ9n KCpQ== X-Gm-Message-State: ACgBeo1bo0FfRQDlMH3B0JC7aZkkbv5XxBD0UqTRljI3MapxV1rDLqMB 0ObbwU7jGnyxcAGvhCkxjZA= X-Google-Smtp-Source: AA6agR6sSl5AeA+spE/uhfMLz4mNqOIZlUn5Ia6HGVZ+eGY6fNoTHtAREYsO/rTgc07wCXPidRCxzQ== X-Received: by 2002:a05:6512:3d20:b0:48b:9e72:fb42 with SMTP id d32-20020a0565123d2000b0048b9e72fb42mr3149772lfv.299.1660936809121; Fri, 19 Aug 2022 12:20:09 -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 t22-20020ac25496000000b0048b0c8fb31asm734602lfk.159.2022.08.19.12.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 12:20:08 -0700 (PDT) Date: Fri, 19 Aug 2022 22:20:03 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 10/14] iio: ad7476: simplify using devm_regulator_get_enable() Message-ID: <33070d66b9b976acac1cee5570facef9278b6b61.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 Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(), add_action_or_reset(regulator_disable)' and use the devm_regulator_get_enable() Signed-off-by: Matti Vaittinen Acked-by: Nuno Sá --- v2 => v3: New patch --- drivers/iio/adc/ad7476.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 94776f696290..80aebed47d1f 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -368,16 +368,7 @@ static int ad7476_probe(struct spi_device *spi) } if (st->chip_info->has_vdrive) { - reg = devm_regulator_get(&spi->dev, "vdrive"); - if (IS_ERR(reg)) - return PTR_ERR(reg); - - ret = regulator_enable(reg); - if (ret) - return ret; - - ret = devm_add_action_or_reset(&spi->dev, ad7476_reg_disable, - reg); + ret = devm_regulator_get_enable(&spi->dev, "vdrive"); if (ret) return ret; }