Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp287195ybi; Tue, 18 Jun 2019 22:53:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVEokUdyu1RgB52kxII8aQI29Fg+VrEjyUCs7OdVaMUAI+thWprqKInhExZStgxDmpYM3s X-Received: by 2002:a17:90a:cf0d:: with SMTP id h13mr9263089pju.63.1560923584460; Tue, 18 Jun 2019 22:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560923584; cv=none; d=google.com; s=arc-20160816; b=LRa1PdKDLyHYITknZgf1vcbo2Q5XVwviEpRSCGmQZZTzf0nW8ulQo2HAX2XIjwWplq w/T/Zy1JuT29UV4Hx+LGAboI0jd/B3H1rrXB8lXHUYNs+oDnkQQ6lvFtZr2MHY7z+nNa xgybZ2jo4qnWM9bPY9vcgEH9mrPxLI1lXzfNHre0qZiryS9T1BD79Qzw8w+nbOjCwXlL MX1lFdcmrkTah3P5EdqPkC3XEcMvV5S3i8UPgKVww1izfruElSgrnsjBX20RySQmGjeX aCL4I9+OJ83YNuYF1GJjk8r2RZu4eU8OTPQ7EXqrOygd9OCS2OqblldjxZcSUe30VAeD F+Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=O30x6B38hIoxBCS0+pdOTkvF0+8uuZC2aQ7VCk1vYOM=; b=0c4raD4NS/lhVekatVo+p2Pe22hOHEmh1ZbxkhRA1L2VntBQApcShyAvWmIhe2owI7 wTU+yC076lfiPU1uq0ZEfrJbQBa6pGxeRdyL8Rqm8B20RqotxcAvv/PxKGUBJVXmwMMM EJF1rvUqufRLKzwhYXBvEr5d7AXegm6T1xeBRn/JKl4NLEfVwxz5atXgWK06MxnfIxOH kMl2qewwbF/Dzfl6BaD0wsbg20QiMHz3pWEr4BUh+XeTWGtWnAm5KR5YK2SGVMCUvBeg 49qRxeB8u/1OwTKMi9MX98TrFaXJZXFIRHsU65Z1B5hKW9fUurK9H2gVWnkGzedCX2v5 K9ZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si15519484plj.124.2019.06.18.22.52.49; Tue, 18 Jun 2019 22:53:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730954AbfFSFv1 (ORCPT + 99 others); Wed, 19 Jun 2019 01:51:27 -0400 Received: from inva021.nxp.com ([92.121.34.21]:47522 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbfFSFvZ (ORCPT ); Wed, 19 Jun 2019 01:51:25 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id EDB8C200166; Wed, 19 Jun 2019 07:51:22 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 71836200E3B; Wed, 19 Jun 2019 07:51:10 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 12C67402F7; Wed, 19 Jun 2019 13:50:57 +0800 (SGT) From: Anson.Huang@nxp.com To: mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, catalin.marinas@arm.com, will.deacon@arm.com, maxime.ripard@bootlin.com, olof@lixom.net, horms+renesas@verge.net.au, jagan@amarulasolutions.com, leonard.crestez@nxp.com, bjorn.andersson@linaro.org, dinguyen@kernel.org, enric.balletbo@collabora.com, aisheng.dong@nxp.com, ping.bai@nxp.com, abel.vesa@nxp.com, l.stach@pengutronix.de, peng.fan@nxp.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH V5 3/5] clk: imx: Add API for clk unregister when driver probe fail Date: Wed, 19 Jun 2019 13:52:45 +0800 Message-Id: <20190619055247.35771-3-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619055247.35771-1-Anson.Huang@nxp.com> References: <20190619055247.35771-1-Anson.Huang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang For i.MX clock drivers probe fail case, clks should be unregistered in the return path, this patch adds a common API for i.MX clock drivers to unregister clocks when fail. Signed-off-by: Anson Huang --- New patch. --- drivers/clk/imx/clk.c | 8 ++++++++ drivers/clk/imx/clk.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c index f241189..8616967 100644 --- a/drivers/clk/imx/clk.c +++ b/drivers/clk/imx/clk.c @@ -13,6 +13,14 @@ DEFINE_SPINLOCK(imx_ccm_lock); +void imx_unregister_clocks(struct clk *clks[], unsigned int count) +{ + unsigned int i; + + for (i = 0; i < count; i++) + clk_unregister(clks[i]); +} + void __init imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn) { diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 19d7b8b..bb4ec1b 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -12,6 +12,7 @@ void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count); void imx_register_uart_clocks(struct clk ** const clks[]); void imx_register_uart_clocks_hws(struct clk_hw ** const hws[]); void imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn); +void imx_unregister_clocks(struct clk *clks[], unsigned int count); extern void imx_cscmr1_fixup(u32 *val); -- 2.7.4