Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp691203ybi; Fri, 14 Jun 2019 01:36:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwa/kSsjYPc8fZfRlqR6s8jKQO/6W1FCMtTUfSgwsm5DUDfhNdvVH9xMYPT003sIvPHk8RM X-Received: by 2002:a17:902:740c:: with SMTP id g12mr38100114pll.128.1560501416477; Fri, 14 Jun 2019 01:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560501416; cv=none; d=google.com; s=arc-20160816; b=Y6qjM0pKWFxs4KOLU66cfAtdv6u08Ppt2aB04yoHEZSbLntuwGjuCw51RFwX9u4Gb/ PTlwOJzySMjEv/SxFbAP0lS+K5qj55DHWoti3rqZZ6vhMNbOYK9ZNKljsuK1boF25kW+ uPeTIvrAq9mom/2tUSNBfo0tcFqUk1gW9KlDhiqKl7jIReocJ0HRJ5EYoJUqTm1iHu5d 5OSuoxQXCPgOwOyVKNZ2YttDUfjMvRTOB7Ib8/HvNXlweiwRD66Kong6lIpCDaG+e7b/ WSNh8bVbO1vibl+/fEvoPQVu6dy0SgTEJFxPZA0yeB6wDlUn6Ni9hzkw4HgpY30UPx+b 4vJg== 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=D0NVZKz4HHynjy2wFcBe2/zlFfIvKBlIJXWXov/hqPA=; b=DNzqcj8ozEHGV/n1gSEeZwZ4iJibOS7jLTRIOtjDj13x1hEyKXmmSknceG1qp2hNA6 lb4AqdxnkoyPuCLl1gsPUc6PnQ3B132tY5jdhdlueKmjUT9yE3vOd4yY5suK18J6iF3T 9JEL10EEKZ1SnB2PhFusMjwYSJVZpKBCv+w7PM+Q1DvaMgg30xp13vim3cZiumpu42sO nhAUUj9+NkVut0E60++hYfkT/Fz9h+4i173gNTYUCd3A4ER8XivuOmZ/wveigEkLI836 wj2V8wEXN8ZsBymmsAABlSdSgNZfIjqGrd3CP+WU9PgozhyYq80oPrQJo/xhCEuIHdM+ 65fA== 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 h2si1755429plh.380.2019.06.14.01.36.41; Fri, 14 Jun 2019 01:36:56 -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 S1726930AbfFNIg0 (ORCPT + 99 others); Fri, 14 Jun 2019 04:36:26 -0400 Received: from inva021.nxp.com ([92.121.34.21]:59562 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbfFNIgY (ORCPT ); Fri, 14 Jun 2019 04:36:24 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 3281B2005D5; Fri, 14 Jun 2019 10:36: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 76A512005F5; Fri, 14 Jun 2019 10:36: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 4E1CB402CA; Fri, 14 Jun 2019 16:35:56 +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, horms+renesas@verge.net.au, olof@lixom.net, jagan@amarulasolutions.com, bjorn.andersson@linaro.org, leonard.crestez@nxp.com, 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: Fri, 14 Jun 2019 16:37:45 +0800 Message-Id: <20190614083747.28762-3-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190614083747.28762-1-Anson.Huang@nxp.com> References: <20190614083747.28762-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..14a6161 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