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: 63346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4173637wrd; Thu, 2 Mar 2023 03:14:08 -0800 (PST) X-Google-Smtp-Source: AK7set+cS5FzFvowZRStbCkqR4pbKudC8IFUP3ezCLQqgr9J2gDq+CjwFPEzJV/TFUP0+Jlofvi5 X-Received: by 2002:a50:fc0e:0:b0:4c0:1120:a167 with SMTP id i14-20020a50fc0e000000b004c01120a167mr2004036edr.32.1677755648195; Thu, 02 Mar 2023 03:14:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677755648; cv=none; d=google.com; s=arc-20160816; b=ENYpnOyU72sNL3gm1w2s7ypSY2zShwzyr+ih+myli9LElIdQ7oB0XhlphVxynVeT0u 1jAredG9b/PirOYw+JCb2BfgTQxk2f2dhsmOJOI83NuEXlYHZ7zYthClccZa7dnWqb06 oPN8nFWmkGIdb7lmC5cy08Ds8y0BmGc7iMLyPlAcr9og0xb9e2s/2LPNN8gOXVmb+1nH bPSNXlzAr/q/a02oGRp2+Pqw3vsbuwAFaEp2xc+HFahgizIAL3rBXZSJkg7aTM4CD7ba 4xAwW9ImMSW917XlKbbDNp8mxWTX38eOqKYEKspwFcyKDd0KKpcfRzBdjImEQJjQFjPS kWxA== 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:date:subject:cc:to:from :dkim-signature; bh=rMwbsO/rbhkzdk1XM3AdVybikP4fH2gM551yJCKrLcU=; b=cbMpb1lSeZUBr9wIDp9++IlmRPCVfy/IpMRN54e6KJ2ndZS6oKF2tsyaZ6sIjylosL OvVRoVYn9q9RypaUqxRDPnch8198KbL17VbgqRolLRKMaOgPs9G45t4/ClBN7tSA2uNe gXZAihkTTcuKgbshZKqJqYl6YZaVs5XIeq+fwnuvw8u1vUdBbWcRjfcLrfU+VgwwR55M vRIUvaI1BfIp651mC8fmM8Jra9M4GpGoYmOorQcis3Cv9meddlFfFIttKSVZ3j6ZFQ75 XIWdqkj4DSgrWD/kLRNjDcr9IVE+oS6ECMxxkx88NHrlxaqvv8B+2hZULGTDMkgAYyua ZrTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ryLkpByo; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm20-20020a170906c05400b008d672111f11si2053717ejb.479.2023.03.02.03.13.45; Thu, 02 Mar 2023 03:14:08 -0800 (PST) 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=@microchip.com header.s=mchp header.b=ryLkpByo; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230081AbjCBLB4 (ORCPT + 99 others); Thu, 2 Mar 2023 06:01:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjCBLBt (ORCPT ); Thu, 2 Mar 2023 06:01:49 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29197457DB; Thu, 2 Mar 2023 03:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1677754895; x=1709290895; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hyWxrfmSizpBS+n92kWqaBMSXOT85gSrHaQamS5MXSQ=; b=ryLkpByoZuydQnf0QOQtP53i2Cf2DFYDICH+2sH6oTN8i82XmCmJxFdw Uu6okBb6qeLWEqYNZyjAmfef3PfGtWougzkyNOrjqPsg3UhZ3VZDREyyG og3IIcdfVai/lQYBvUXOO83TSojkWFuo8rnKPpno19hkhjK2xtT/Y88ql +ZTNHMYeygfN6rDJEoc+lJ+5DJmv6jHwGOaOV4u3i2NJNpBLVMiSFsDJn /rN3E0VUyHOiv3B1tDUXRkou5uFSgy+dwbNwXjcx5vxoq1BIZJHS7hFrU pr4cmqy20p7UgxyM4OMte2TNL8HpCHgHnD1FUBrpDSmvlQq4cap79uBeF 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759254306808548858?= X-GMAIL-MSGID: =?utf-8?q?1759254306808548858?= 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;