From patchwork Thu Mar 2 11:01:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13157091 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9CEDC6FA8E for ; Thu, 2 Mar 2023 11:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=usozQDcO+XtF9NOONDUSGwPfkhUQdyyyDr+LR9xXDWA=; b=Go2RGSvuuFzyqA KYcK3FA67lD35okk2g0n+UO24t/V64wR4vUs2n+B/ARz5i2GwMn5BWht6ravZBilHD/skEZrohdfb yJHUiBL3k9SEzWL5gntR9Hp0nFS7ncE0Qs19uI0xiZ5cRQ/VAAyeRSKyl2IkmPkgMiyjo19dw5f+D xPfe88GE6XjTHUTgMXT5h0xeyhPF64vF0qNpwr+VRZJJf/hjX1ZMU/VJ4p5wdNXK7PyCLGg9Uy9mG e7QmBMG7rKlfhs9/ndCemWIGS+vAkQKudI7fSgw2Ds73429gBSkokhMGPH5RKq/8PTJWG4hNERzTd CxLD/Q9H89vI1bVcaDng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXghH-001nEd-PH; Thu, 02 Mar 2023 11:02:03 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXggw-001n6o-BG for linux-arm-kernel@lists.infradead.org; Thu, 02 Mar 2023 11:01:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1677754902; x=1709290902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hyWxrfmSizpBS+n92kWqaBMSXOT85gSrHaQamS5MXSQ=; b=yxxq3QIjbn1P4N/9B1urL1D34n3oCucqVmmp1JWxwxO70rECgvP/A/Ck fdkjWBni3sVOaUIIMdoQ90DzgO6nkDxDXalMDKKdny4182whcHsxRRluq 0o/1INj+nrRFLow2PhEe8VvJFPy0BO97zKtETH5Z4Cn9H890DAedv0OCm P5qlNLRrLeqkOCbWsj9tFEfj/OBzCNxBJ6iLdGc6XWJ4tQqtnx58HJpr/ jlbXUF3SF3cKdgrR/HTzUbhhl+QznRtxXj5tllvE9VYry/3y83aJt1xBo 48PdIDMlolBdHsXlFc3otNNwaaoVn+9dEV56n45nnFv0uKCstRnmvDSPN w==; X-IronPort-AV: E=Sophos;i="5.98,227,1673938800"; d="scan'208";a="199564352" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Mar 2023 04:01:34 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Mar 2023 04:01:33 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Mar 2023 04:01:30 -0700 From: Claudiu Beznea To: , , , CC: , , , Claudiu Beznea Subject: [PATCH 1/4] pinctrl: at91-pio4: use devm_clk_get_enabled() Date: Thu, 2 Mar 2023 13:01:13 +0200 Message-ID: <20230302110116.342486-2-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230302110116.342486-1-claudiu.beznea@microchip.com> References: <20230302110116.342486-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230302_030142_512415_79A8231F X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use devm_clk_get_enabled() to simplify the code. Signed-off-by: Claudiu Beznea --- drivers/pinctrl/pinctrl-at91-pio4.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 39b233f73e13..0aceb723f94c 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -1098,7 +1098,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) if (IS_ERR(atmel_pioctrl->reg_base)) return PTR_ERR(atmel_pioctrl->reg_base); - atmel_pioctrl->clk = devm_clk_get(dev, NULL); + atmel_pioctrl->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(atmel_pioctrl->clk)) { dev_err(dev, "failed to get clock\n"); return PTR_ERR(atmel_pioctrl->clk); @@ -1219,25 +1219,19 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) i, irq); } - ret = clk_prepare_enable(atmel_pioctrl->clk); - if (ret) { - dev_err(dev, "failed to prepare and enable clock\n"); - goto clk_prepare_enable_error; - } - atmel_pioctrl->pinctrl_dev = devm_pinctrl_register(&pdev->dev, &atmel_pinctrl_desc, atmel_pioctrl); if (IS_ERR(atmel_pioctrl->pinctrl_dev)) { ret = PTR_ERR(atmel_pioctrl->pinctrl_dev); dev_err(dev, "pinctrl registration failed\n"); - goto clk_unprep; + goto irq_domain_remove_error; } ret = gpiochip_add_data(atmel_pioctrl->gpio_chip, atmel_pioctrl); if (ret) { dev_err(dev, "failed to add gpiochip\n"); - goto clk_unprep; + goto irq_domain_remove_error; } ret = gpiochip_add_pin_range(atmel_pioctrl->gpio_chip, dev_name(dev), @@ -1254,10 +1248,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) gpiochip_add_pin_range_error: gpiochip_remove(atmel_pioctrl->gpio_chip); -clk_unprep: - clk_disable_unprepare(atmel_pioctrl->clk); - -clk_prepare_enable_error: +irq_domain_remove_error: irq_domain_remove(atmel_pioctrl->irq_domain); return ret;