Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp962230imd; Thu, 1 Nov 2018 08:13:01 -0700 (PDT) X-Google-Smtp-Source: AJdET5emoQYbbmE9bp/gUq57mOtBqrixsAdgik67fKkVyo+/iUGGbZimbjHfAs7uMLP++3vOHjE4 X-Received: by 2002:a17:902:a988:: with SMTP id bh8-v6mr5892784plb.193.1541085181698; Thu, 01 Nov 2018 08:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541085181; cv=none; d=google.com; s=arc-20160816; b=TwA7q3oU7git7rUwsFKyKTdCvK1GcHlYv0CoRsKe6hvCc45RIyLj5jc0RY+ErPgsVp 6fZX8S9nMPL0zPbPi1q/IgDNVC+PQ24QYTh9jt47mqk9XoLa6qzVXRisTAjlGENwWuvp Xr7bVjxEHoDRmek39VAmcsdqMCXqnStJT9esYmZ5NgXzM+gVBZL10zODcj8qXa2m95bp 9ma6F8ia+SwJJlUHDPgWQvUcEtlU9bfgQK8m6Aqr9m2C9cA6dkSTxrC47fh1GOIP3j+8 HXzZ15fwM1WXR6KmkYiNf78tll9YDnZWPnGllCxpa9rws6ghpMN7UlHH3V4/XEN3yZBI ilew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Hb5bfSM9LfGVJtNRyin3nTAOn6v8C2JaBjYTLsc+xu4=; b=zEXli8vKGCsLBq8TEkiSTZSHpr3D01uDVBowZWXWiqNoxBp5TqiqeWht8rPz8I4FpC FSeHQBAEz0HoIKl8cPZ/wrMpD7sm5Xl4X38M+0w9JOoUJIbCFT2RbCt0eKnLGOHCOUcK iK/T7N/IoniQohhX5YRLD4Zro2iR1c+A5SFixCNJAKcSGPVNBNz983eG0nStlyqBoUZL i8lKcS88c1UtIhwwgtP8Pfk4Md8Puf+H8WebqY3NZa2UBFHjT0IFhV5slry7YQJozYGu 1AzljtNZp0E1uTrnC5qS/RWMEkTrNJBohT5sfcABo6f8NiJLuQrgWS3ge6BNms+HfeuG lkog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TsGxe7qO; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j129-v6si20083965pfb.201.2018.11.01.08.12.46; Thu, 01 Nov 2018 08:13:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TsGxe7qO; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728943AbeKAXoM (ORCPT + 99 others); Thu, 1 Nov 2018 19:44:12 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:47007 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728680AbeKAXoL (ORCPT ); Thu, 1 Nov 2018 19:44:11 -0400 Received: by mail-lf1-f65.google.com with SMTP id o2-v6so14343966lfl.13; Thu, 01 Nov 2018 07:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hb5bfSM9LfGVJtNRyin3nTAOn6v8C2JaBjYTLsc+xu4=; b=TsGxe7qORmYTWS5nlJp4OR9COczVldjviSrzwZ28F4WZaDcH6i19LP2xwp8PUSwX4Z q6mQ7OhurcTtfkhlYQ8LzuTVTP9nhYBTrVEW5rXBi/rYADZ3DP6v364rWohuBRkM2JPX 47SPoof5gEF2COpDLP7J2dp4KPZrsLvWg6JSHUmlgOsd/CCkYFCiZWrrbKudDmyuqi8l eYmaXn9XaG2KOTBfv7F7EXrpajRq/tS9V91IsqMpKg8VMPw/VhmT095kN5PpJ6Ix3UHu uD08iyDjj+MPSGieBRx04kuve6B+zuy4bt7rFGz/OO0sBuVoPxe/i0T3rOAnFMki/Dkv YZ3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hb5bfSM9LfGVJtNRyin3nTAOn6v8C2JaBjYTLsc+xu4=; b=aY1VooRgdvuCqKTbrzXjKKZfmbl0PoieDI3IMSsfFxb7mHWAlNoO11p0tu7bGQXWQT C9d8XMxvA+GNNwBMTvCRAgsknErZ8rqs0+wkNWyh0raWjTzabE4TtUV5crbHTONa9hby 2LZZQzdPNANf5rZYBXnzHC1JNjWew8zjRl9NNy4nC9pXlAcnufEBlQ2GAO+hnTLCnH7o 2vMQeT4irJvUFy1W0Je1+UO3RkAgrQV1VG09oiF1gzHP2yq2ck9+bdvUUHBpISn0wjEP VR991xbiex/UNcWEXo6qIY3ZXKOwPjQPF80CrvcFRGNerxH5Y/O83OOcKlN6j8FTlsN4 sGUQ== X-Gm-Message-State: AGRZ1gLS3pmS1duMYlQXdlu2aa11o6FS/bP7ldhRDAdbRkbOo9SB5jpb f19eeVFOCecqtZw3xOIyJWI= X-Received: by 2002:a19:5a05:: with SMTP id o5mr4860813lfb.140.1541083254176; Thu, 01 Nov 2018 07:40:54 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id a9sm404870lfa.19.2018.11.01.07.40.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 07:40:52 -0700 (PDT) From: Ricardo Ribalda Delgado To: Stephen Boyd , Alan Tull , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH 4/5] clk: fixed-rate: Use devm_of_clk_add_provider Date: Thu, 1 Nov 2018 15:40:43 +0100 Message-Id: <20181101144044.11495-5-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181101144044.11495-1-ricardo.ribalda@gmail.com> References: <20181101144044.11495-1-ricardo.ribalda@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use devm_clk_add_provider. It will take care of clk un-registering. Signed-off-by: Ricardo Ribalda Delgado --- drivers/clk/clk-fixed-rate.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c index 6d6475c32ee5..2678b7bd68ac 100644 --- a/drivers/clk/clk-fixed-rate.c +++ b/drivers/clk/clk-fixed-rate.c @@ -158,7 +158,8 @@ void clk_hw_unregister_fixed_rate(struct clk_hw *hw) EXPORT_SYMBOL_GPL(clk_hw_unregister_fixed_rate); #ifdef CONFIG_OF -static struct clk *_of_fixed_clk_setup(struct device_node *node) +static struct clk *_of_fixed_clk_setup(struct device *dev, + struct device_node *node) { struct clk *clk; const char *clk_name = node->name; @@ -173,12 +174,16 @@ static struct clk *_of_fixed_clk_setup(struct device_node *node) of_property_read_string(node, "clock-output-names", &clk_name); - clk = clk_register_fixed_rate_with_accuracy(NULL, clk_name, NULL, + clk = clk_register_fixed_rate_with_accuracy(dev, clk_name, NULL, 0, rate, accuracy); if (IS_ERR(clk)) return clk; - ret = of_clk_add_provider(node, of_clk_src_simple_get, clk); + if (dev) + ret = devm_of_clk_add_provider(dev, of_clk_src_simple_get, clk); + else + ret = of_clk_add_provider(node, of_clk_src_simple_get, clk); + if (ret) { clk_unregister(clk); return ERR_PTR(ret); @@ -192,7 +197,7 @@ static struct clk *_of_fixed_clk_setup(struct device_node *node) */ void __init of_fixed_clk_setup(struct device_node *node) { - _of_fixed_clk_setup(node); + _of_fixed_clk_setup(NULL, node); } CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup); @@ -200,7 +205,6 @@ static int of_fixed_clk_remove(struct platform_device *pdev) { struct clk *clk = platform_get_drvdata(pdev); - of_clk_del_provider(pdev->dev.of_node); clk_unregister_fixed_rate(clk); return 0; @@ -214,7 +218,7 @@ static int of_fixed_clk_probe(struct platform_device *pdev) * This function is not executed when of_fixed_clk_setup * succeeded. */ - clk = _of_fixed_clk_setup(pdev->dev.of_node); + clk = _of_fixed_clk_setup(&pdev->dev, pdev->dev.of_node); if (IS_ERR(clk)) return PTR_ERR(clk); -- 2.19.1