From patchwork Wed Aug 10 11:31:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 12940476 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 AE179C00140 for ; Wed, 10 Aug 2022 11:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231288AbiHJLb7 (ORCPT ); Wed, 10 Aug 2022 07:31:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232068AbiHJLbe (ORCPT ); Wed, 10 Aug 2022 07:31:34 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7439D6DF96; Wed, 10 Aug 2022 04:31:33 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id x19so12538260lfq.7; Wed, 10 Aug 2022 04:31:33 -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=orgHsxCL/eDSeRNUzdbN1mK+oxAKvucrAmf97xEKdZ4=; b=aQBbvfoxFa5ZcvxCLanORYq1fw6LPa6LJS0OX6FJ0JtBpG5jUfth69xuLBOg1Pb36N W/3oXgvSrJxxSowDotXK1W7QR/tQX+wOJ3vc4ZGNP50sdBTohycLImlEEdHbKEBuf6MC JDEqLFaQ55xdrfizREF5egPILUc0JxUeBxHGr1fIVbur0jVNRixK97P/J6FvCi3W0bl/ nVGWZFxHEAsOeqCKKqYc0OzbCU9uunyxjcDwiCxvsWOMqVzjq8xc69l946Q6IWAuQHF9 xtbIuMg/I1lCvB7wvfHTh1n7CSw6HjBr/3kT7LuX25ZQH0TEdPtlJG17wzbGaE0jSWen f/Cg== 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=orgHsxCL/eDSeRNUzdbN1mK+oxAKvucrAmf97xEKdZ4=; b=nAkYku9lWJOk0KuKTmL2DIeq/QAXf9AHLU4gLL83+FgVLHfD26OE6gL25kA1NpQULJ ilUQLhyAxvIh1j21BgXostRqF6YGw3IXf3PO/iCcJ7mn5BsSFLRwhLEI4dZakuNNBOfC Ymz/LQ21n8aEc5Mp0Wc8kcvNvchcw3utwbVcLcL5P6RebbP7yPtqCiDqKpd9vX43Esnv fTnIcIhCXjfTLxG9MM3EHA3FBvQLamTatdOCkIJgoN8VQq8EJUD8s7u3yURTpLVUAS11 NuD6WZyrCgYnqGB2+Etd1yw1MWgcXvoUQjcX7cJC0Unc2Jafxz55FYKu1hIFMLTmn9CR Yr6w== X-Gm-Message-State: ACgBeo0BEIcXALls2yF3ryx48fM0NFYB0A1EXprdx9iEw9q7MqZqj68h CMaBpfDJ+4r+VEzJ+dQOHLCh6M+8xzhwgQ== X-Google-Smtp-Source: AA6agR7JBR57kzyt+os6biJsAEIfgSQ8d2KfZwIU6MqbBsmV7bTr8/YkqnI+aQiMYBwj/s8+hOWD6g== X-Received: by 2002:a05:6512:32c5:b0:48b:969a:9c24 with SMTP id f5-20020a05651232c500b0048b969a9c24mr6704678lfg.300.1660131091804; Wed, 10 Aug 2022 04:31:31 -0700 (PDT) Received: from fedora ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id f18-20020a19ae12000000b0048b998be041sm300359lfc.309.2022.08.10.04.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 04:31:30 -0700 (PDT) Date: Wed, 10 Aug 2022 14:31:16 +0300 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 4/7] clk: cdce925: simplify using devm_regulator_get_enable() Message-ID: <7daaf2e66cc72d646e88a93e8cca39e104ef6505.1660127865.git.mazziesaccount@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Simplify the driver using devm_regulator_get_enable() instead of open-coding the devm_add_action_or_reset(). A (minor?) functional change is that we don't print an error in case of a deferred probe. Now we also print the error no matter which of the involved calls caused the failure. Signed-off-by: Matti Vaittinen --- drivers/clk/clk-cdce925.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/clk/clk-cdce925.c b/drivers/clk/clk-cdce925.c index ef9a2d44e40c..6350682f7e6d 100644 --- a/drivers/clk/clk-cdce925.c +++ b/drivers/clk/clk-cdce925.c @@ -603,28 +603,15 @@ of_clk_cdce925_get(struct of_phandle_args *clkspec, void *_data) return &data->clk[idx].hw; } -static void cdce925_regulator_disable(void *regulator) -{ - regulator_disable(regulator); -} - static int cdce925_regulator_enable(struct device *dev, const char *name) { - struct regulator *regulator; int err; - regulator = devm_regulator_get(dev, name); - if (IS_ERR(regulator)) - return PTR_ERR(regulator); - - err = regulator_enable(regulator); - if (err) { - dev_err(dev, "Failed to enable %s: %d\n", name, err); - return err; - } + err = devm_regulator_get_enable(dev, name); + if (err) + dev_err_probe(dev, err, "Failed to enable %s:\n", name); - return devm_add_action_or_reset(dev, cdce925_regulator_disable, - regulator); + return err; } /* The CDCE925 uses a funky way to read/write registers. Bulk mode is