From patchwork Thu Nov 1 07:18:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10663571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AD0D13B5 for ; Thu, 1 Nov 2018 07:18:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BC752B87C for ; Thu, 1 Nov 2018 07:18:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F3A82B84F; Thu, 1 Nov 2018 07:18:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C22BB2B845 for ; Thu, 1 Nov 2018 07:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727848AbeKAQUQ (ORCPT ); Thu, 1 Nov 2018 12:20:16 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:46145 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727816AbeKAQUQ (ORCPT ); Thu, 1 Nov 2018 12:20:16 -0400 Received: by mail-lf1-f68.google.com with SMTP id o2-v6so13475085lfl.13; Thu, 01 Nov 2018 00:18:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hrkfELyO0oWl12o0CBLuPFh+dPbPG/uCyHIj0CD4238=; b=C2kpe/loCGh4DTiBddp9vep5X/GcZ/k/xCJCH3TjnyqIg0/ucK7L+Td3eQp1KSLoCd XkhZYVqUy2R8/AQ4ZH+JX4xmjg7NNFdLdIvaDNXmukUujdwxzNfTvJYH7UQn26g5xLJM zlSROCjDMYdloIByEKYlwBupdclkoo1qAV9TyeOiZs/nYLyS5V7o8XDy9MVUEwEvdJ27 0r7GxALvlUgeyWvA/gBS4SHB15Ii/LtwmHUSyR1Pba9ov231Vq64wN9h3o6sAZzEdy4G GKE7rCkKBDExR0cD4ls7PGjP+pCoWXbtwuLkuqYF3qcdxuw4H9I04kvfSXTWPIFaDcGW jlrw== X-Gm-Message-State: AGRZ1gJ9k8ddIVykymftXLcvj2I7ZbfNJSruCTTSDDI+bChmHa7PG6Um tMG5lCcMOLjP+TxCsbTmna8= X-Google-Smtp-Source: AJdET5frtVQAlMvqsXw2QCEUOz8vxaRI6IUnoS9LlFAXC2HkMq9EZlGtO2cCmFso/rblYY/VENavvg== X-Received: by 2002:ac2:4159:: with SMTP id c25-v6mr3895596lfi.19.1541056706925; Thu, 01 Nov 2018 00:18:26 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id s14-v6sm674461lfk.59.2018.11.01.00.18.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 00:18:26 -0700 (PDT) Date: Thu, 1 Nov 2018 09:18:11 +0200 From: Matti Vaittinen To: Jonathan Corbet , Michael Turquette , Stephen Boyd , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Russell King , Andy Gross , David Brown , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Andrey Smirnov , Sebastian Reichel , Guenter Roeck , Rob Herring , Matti Vaittinen , Huang Shijie , Akshu Agrawal , "Rafael J. Wysocki" , Daniel Kurtz , mazziesaccount@gmail.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com Subject: [PATCH v2 1/8] clk: clkdev/of_clk - add managed lookup and provider registrations Message-ID: <1ab16de50fe98a8cdbc0aebc8eced41d7c04f14d.1541054985.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With MFD devices the clk properties may be contained in MFD (parent) DT node. Current devm_of_clk_add_hw_provider assumes the clk is bound to MFD subdevice not to MFD device (parent). Add devm_of_clk_add_hw_provider_parent to tackle this issue. Also clkdev registration lacks of managed registration functions and it seems few drivers do not drop clkdev lookups at exit. Add devm_clk_hw_register_clkdev and devm_clk_release_clkdev to ease lookup releasing at exit. Signed-off-by: Matti Vaittinen --- Documentation/driver-model/devres.txt | 3 + drivers/clk/clk.c | 28 ++++++-- drivers/clk/clkdev.c | 122 ++++++++++++++++++++++++++-------- include/linux/clk-provider.h | 11 +++ include/linux/clkdev.h | 4 ++ 5 files changed, 136 insertions(+), 32 deletions(-) diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt index 43681ca0837f..fac63760b01c 100644 --- a/Documentation/driver-model/devres.txt +++ b/Documentation/driver-model/devres.txt @@ -238,6 +238,9 @@ CLOCK devm_clk_put() devm_clk_hw_register() devm_of_clk_add_hw_provider() + devm_of_clk_add_parent_hw_provider() + devm_clk_hw_register_clkdev() + devm_clk_release_clkdev() DMA dmaenginem_async_device_register() diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index af011974d4ec..9bb921eb90f6 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3893,12 +3893,12 @@ static void devm_of_clk_release_provider(struct device *dev, void *res) of_clk_del_provider(*(struct device_node **)res); } -int devm_of_clk_add_hw_provider(struct device *dev, +static int __devm_of_clk_add_hw_provider(struct device *dev, struct clk_hw *(*get)(struct of_phandle_args *clkspec, void *data), - void *data) + struct device_node *of_node, void *data) { - struct device_node **ptr, *np; + struct device_node **ptr; int ret; ptr = devres_alloc(devm_of_clk_release_provider, sizeof(*ptr), @@ -3906,10 +3906,9 @@ int devm_of_clk_add_hw_provider(struct device *dev, if (!ptr) return -ENOMEM; - np = dev->of_node; - ret = of_clk_add_hw_provider(np, get, data); + *ptr = of_node; + ret = of_clk_add_hw_provider(of_node, get, data); if (!ret) { - *ptr = np; devres_add(dev, ptr); } else { devres_free(ptr); @@ -3917,8 +3916,25 @@ int devm_of_clk_add_hw_provider(struct device *dev, return ret; } +int devm_of_clk_add_hw_provider(struct device *dev, + struct clk_hw *(*get)(struct of_phandle_args *clkspec, + void *data), + void *data) +{ + return __devm_of_clk_add_hw_provider(dev, get, dev->of_node, data); +} EXPORT_SYMBOL_GPL(devm_of_clk_add_hw_provider); +int devm_of_clk_add_parent_hw_provider(struct device *dev, + struct clk_hw *(*get)(struct of_phandle_args *clkspec, + void *data), + void *data) +{ + return __devm_of_clk_add_hw_provider(dev, get, dev->parent->of_node, + data); +} +EXPORT_SYMBOL_GPL(devm_of_clk_add_parent_hw_provider); + /** * of_clk_del_provider() - Remove a previously registered clock provider * @np: Device node pointer associated with clock provider diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 9ab3db8b3988..f6100b6e06fd 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -401,6 +401,25 @@ static struct clk_lookup *__clk_register_clkdev(struct clk_hw *hw, return cl; } +static int do_clk_register_clkdev(struct clk_hw *hw, + struct clk_lookup **cl, const char *con_id, const char *dev_id) +{ + + if (IS_ERR(hw)) + return PTR_ERR(hw); + /* + * Since dev_id can be NULL, and NULL is handled specially, we must + * pass it as either a NULL format string, or with "%s". + */ + if (dev_id) + *cl = __clk_register_clkdev(hw, con_id, "%s", + dev_id); + else + *cl = __clk_register_clkdev(hw, con_id, NULL); + + return *cl ? 0 : -ENOMEM; +} + /** * clk_register_clkdev - register one clock lookup for a struct clk * @clk: struct clk to associate with all clk_lookups @@ -420,20 +439,10 @@ int clk_register_clkdev(struct clk *clk, const char *con_id, { struct clk_lookup *cl; - if (IS_ERR(clk)) - return PTR_ERR(clk); - - /* - * Since dev_id can be NULL, and NULL is handled specially, we must - * pass it as either a NULL format string, or with "%s". - */ - if (dev_id) - cl = __clk_register_clkdev(__clk_get_hw(clk), con_id, "%s", - dev_id); - else - cl = __clk_register_clkdev(__clk_get_hw(clk), con_id, NULL); - - return cl ? 0 : -ENOMEM; + if (!IS_ERR(clk)) + return do_clk_register_clkdev(__clk_get_hw(clk), &cl, con_id, + dev_id); + return PTR_ERR(clk); } EXPORT_SYMBOL(clk_register_clkdev); @@ -456,18 +465,79 @@ int clk_hw_register_clkdev(struct clk_hw *hw, const char *con_id, { struct clk_lookup *cl; - if (IS_ERR(hw)) - return PTR_ERR(hw); + return do_clk_register_clkdev(hw, &cl, con_id, dev_id); +} +EXPORT_SYMBOL(clk_hw_register_clkdev); - /* - * Since dev_id can be NULL, and NULL is handled specially, we must - * pass it as either a NULL format string, or with "%s". - */ - if (dev_id) - cl = __clk_register_clkdev(hw, con_id, "%s", dev_id); - else - cl = __clk_register_clkdev(hw, con_id, NULL); +static void devm_clkdev_release(struct device *dev, void *res) +{ + clkdev_drop(*(struct clk_lookup **)res); +} - return cl ? 0 : -ENOMEM; +static int devm_clk_match_clkdev(struct device *dev, void *res, void *data) +{ + struct clk_lookup **l = res; + + if (!l || !*l) { + WARN_ON(!l || !*l); + return 0; + } + return *l == data; } -EXPORT_SYMBOL(clk_hw_register_clkdev); + +/** + * devm_clk_release_clkdev - Resource managed clkdev lookup release + * @dev: device this lookup is bound + * @con_id: connection ID string on device + * @dev_id: format string describing device name + * + * Drop the clkdev lookup created with devm_clk_hw_register_clkdev. + * Normally this function will not need to be called and the resource + * management code will ensure that the resource is freed. + */ +void devm_clk_release_clkdev(struct device *dev, const char *con_id, + const char *dev_id) +{ + struct clk_lookup *cl; + int rval; + + cl = clk_find(dev_id, con_id); + WARN_ON(!cl); + rval = devres_release(dev, devm_clkdev_release, + &devm_clk_match_clkdev, cl); + WARN_ON(rval); +} +EXPORT_SYMBOL(devm_clk_release_clkdev); + +/** + * devm_clk_hw_register_clkdev - managed clk lookup registration for clk_hw + * @dev: device this lookup is bound + * @hw: struct clk_hw to associate with all clk_lookups + * @con_id: connection ID string on device + * @dev_id: format string describing device name + * + * con_id or dev_id may be NULL as a wildcard, just as in the rest of + * clkdev. + * + * To make things easier for mass registration, we detect error clk_hws + * from a previous clk_hw_register_*() call, and return the error code for + * those. This is to permit this function to be called immediately + * after clk_hw_register_*(). + */ +int devm_clk_hw_register_clkdev(struct device *dev, struct clk_hw *hw, + const char *con_id, const char *dev_id) +{ + int rval = -ENOMEM; + struct clk_lookup **cl; + + cl = devres_alloc(devm_clkdev_release, sizeof(*cl), GFP_KERNEL); + if (cl) { + rval = do_clk_register_clkdev(hw, cl, con_id, dev_id); + if (!rval) + devres_add(dev, cl); + else + devres_free(cl); + } + return rval; +} +EXPORT_SYMBOL(devm_clk_hw_register_clkdev); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 60c51871b04b..a6663f084cf1 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -916,6 +916,10 @@ int devm_of_clk_add_hw_provider(struct device *dev, struct clk_hw *(*get)(struct of_phandle_args *clkspec, void *data), void *data); +int devm_of_clk_add_parent_hw_provider(struct device *dev, + struct clk_hw *(*get)(struct of_phandle_args *clkspec, + void *data), + void *data); void of_clk_del_provider(struct device_node *np); void devm_of_clk_del_provider(struct device *dev); struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, @@ -953,6 +957,13 @@ static inline int devm_of_clk_add_hw_provider(struct device *dev, { return 0; } +static inline int devm_of_clk_add_parent_hw_provider(struct device *dev, + struct clk_hw *(*get)(struct of_phandle_args *clkspec, + void *data), + void *data) +{ + return 0; +} static inline void of_clk_del_provider(struct device_node *np) {} static inline void devm_of_clk_del_provider(struct device *dev) {} static inline struct clk *of_clk_src_simple_get( diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h index 4890ff033220..ccb32af5848b 100644 --- a/include/linux/clkdev.h +++ b/include/linux/clkdev.h @@ -52,4 +52,8 @@ int clk_add_alias(const char *, const char *, const char *, struct device *); int clk_register_clkdev(struct clk *, const char *, const char *); int clk_hw_register_clkdev(struct clk_hw *, const char *, const char *); +int devm_clk_hw_register_clkdev(struct device *dev, struct clk_hw *hw, + const char *con_id, const char *dev_id); +void devm_clk_release_clkdev(struct device *dev, const char *con_id, + const char *dev_id); #endif From patchwork Thu Nov 1 07:18:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10663581 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B581213A4 for ; Thu, 1 Nov 2018 07:19:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94DCA2B98F for ; Thu, 1 Nov 2018 07:19:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88EED2B9AE; Thu, 1 Nov 2018 07:19:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 378AB2B98F for ; Thu, 1 Nov 2018 07:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727996AbeKAQUs (ORCPT ); Thu, 1 Nov 2018 12:20:48 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:38145 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727816AbeKAQUs (ORCPT ); Thu, 1 Nov 2018 12:20:48 -0400 Received: by mail-lf1-f65.google.com with SMTP id p86so11298603lfg.5; Thu, 01 Nov 2018 00:19:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=d5tCTzkMuA5kwQPkvyBXAPtmNWoajWA+W8o5G1slWkE=; b=Vuk97GICyzmMJAman7480Bi8Di8nHHmEO42SqvdlwviXM0f0wRGWof0/+SX9JOUmf5 hRg9TkPvdvGMR19nCGUAN3cCiDdT25g75rTrMj0Q9JbB6YsJXhzgcDEVwKYNHqRD/HSR jmPHSS8r7SVUt1zJ+K9oqeMG7XTFSCuPz8Y6p7foSmmrRNgXi6oSoT3Xn5qwtOxaj79p raCSSpuud/QzoLLZDxXgaCoIIsGBTvbgyJVwa+0/ZmX2E8+pKLEu1Xk+R6udJAKhevqO V3QRgekLmRDBzfmCq9aaqQSVl613MYl01wFhCJHCk3k68J4yjvhGpqQnctWNWQuPwxZJ fRNQ== X-Gm-Message-State: AGRZ1gL9YQpI+10DtNTiFAD0z+o5s14IzEiwDFRuyGQbxX0n3NcpiLas 2WP4BfC6L2T/azkVMaGxaiE= X-Google-Smtp-Source: AJdET5ffwX8vOzP6bgn5x1XUVAea3riNhiXgo1qlofeDfFA+LmyGt9fhNeARFX7jsvkEz7Kj3imUAw== X-Received: by 2002:a19:9209:: with SMTP id u9-v6mr3887615lfd.26.1541056739722; Thu, 01 Nov 2018 00:18:59 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id f14-v6sm4612058lff.84.2018.11.01.00.18.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 00:18:59 -0700 (PDT) Date: Thu, 1 Nov 2018 09:18:45 +0200 From: Matti Vaittinen To: Jonathan Corbet , Michael Turquette , Stephen Boyd , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Russell King , Andy Gross , David Brown , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Andrey Smirnov , Sebastian Reichel , Guenter Roeck , Rob Herring , Matti Vaittinen , Huang Shijie , Akshu Agrawal , "Rafael J. Wysocki" , Daniel Kurtz , mazziesaccount@gmail.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com Subject: [PATCH v2 2/8] clk: clk-max77686: Clean clkdev lookup leak and use devm Message-ID: <83e985f2f60a68f89fac777aa29c55b1edb8769f.1541054985.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP clk-max77686 never clean clkdev lookup at remove. This can cause oops if clk-max77686 is removed and inserted again. Fix leak by using new devm clkdev lookup registration. Simplify also error path by using new devm_of_clk_add_parent_hw_provider. Signed-off-by: Matti Vaittinen Reviewed-by: Krzysztof Kozlowski --- drivers/clk/clk-max77686.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c index 02551fe4b87c..b1920c1d9b76 100644 --- a/drivers/clk/clk-max77686.c +++ b/drivers/clk/clk-max77686.c @@ -235,7 +235,7 @@ static int max77686_clk_probe(struct platform_device *pdev) return ret; } - ret = clk_hw_register_clkdev(&max_clk_data->hw, + ret = devm_clk_hw_register_clkdev(dev, &max_clk_data->hw, max_clk_data->clk_idata.name, NULL); if (ret < 0) { dev_err(dev, "Failed to clkdev register: %d\n", ret); @@ -244,8 +244,8 @@ static int max77686_clk_probe(struct platform_device *pdev) } if (parent->of_node) { - ret = of_clk_add_hw_provider(parent->of_node, of_clk_max77686_get, - drv_data); + ret = devm_of_clk_add_parent_hw_provider(dev, + of_clk_max77686_get, drv_data); if (ret < 0) { dev_err(dev, "Failed to register OF clock provider: %d\n", @@ -261,27 +261,11 @@ static int max77686_clk_probe(struct platform_device *pdev) 1 << MAX77802_CLOCK_LOW_JITTER_SHIFT); if (ret < 0) { dev_err(dev, "Failed to config low-jitter: %d\n", ret); - goto remove_of_clk_provider; + return ret; } } return 0; - -remove_of_clk_provider: - if (parent->of_node) - of_clk_del_provider(parent->of_node); - - return ret; -} - -static int max77686_clk_remove(struct platform_device *pdev) -{ - struct device *parent = pdev->dev.parent; - - if (parent->of_node) - of_clk_del_provider(parent->of_node); - - return 0; } static const struct platform_device_id max77686_clk_id[] = { @@ -297,7 +281,6 @@ static struct platform_driver max77686_clk_driver = { .name = "max77686-clk", }, .probe = max77686_clk_probe, - .remove = max77686_clk_remove, .id_table = max77686_clk_id, }; From patchwork Thu Nov 1 07:19:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10663589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AA7A13A4 for ; Thu, 1 Nov 2018 07:19:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBE6F2B9CD for ; Thu, 1 Nov 2018 07:19:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB6CE2B9AE; Thu, 1 Nov 2018 07:19:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96F842B99D for ; Thu, 1 Nov 2018 07:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727854AbeKAQVX (ORCPT ); Thu, 1 Nov 2018 12:21:23 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37110 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727816AbeKAQVX (ORCPT ); Thu, 1 Nov 2018 12:21:23 -0400 Received: by mail-lj1-f195.google.com with SMTP id c4-v6so17165406lja.4; Thu, 01 Nov 2018 00:19:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yodtWAaw5BTk3hbCqBw9o101omzQN2QDRD/joFnNkiA=; b=GV61w+fX4F0AYAYu4/LmO29b/vTkWYlx1op5fvEe77g8hrijTxtBvcAaVO3XDXOQV2 0n85XwGf5vKqdzgNzhV+bcQjl0m4/JmrYe+7mw+zVvxc4fmsK5LGBYRvyIpyqtNsoRnh Er8bYk75rvFPr+UVHdqPfbR3nil/Km7ohvl+xscpjdyA8zhmCUpCIey1TifQb83/bjDj 633XYpqhh7Wv3gk8OeE0ftMVictcrJocW7bL+gy2PJ4Q+qqe7WW/hwsjX2wdx/jr0hjm RHTKFD04Xm80Q7N2XS5zXaNq7/znVpkwlDphDdKEr3hjDAQer2glCAPkkn9ePe2iNauB 9EHg== X-Gm-Message-State: AGRZ1gLjCY4jmKyYMK/1TA1enTOpLYVtw0VqjZ0X7gJjsUP6pimvahSu xHOvTsOf1RfkQCHtsNf1glk= X-Google-Smtp-Source: AJdET5eUuISbkUGNn72cxrLKDqXMAfSvg/3aJ2eYCd4be5+L8XJkHeHpMYROEMUbhtnFkEkjQBnxJw== X-Received: by 2002:a2e:4408:: with SMTP id r8-v6mr4407134lja.21.1541056775260; Thu, 01 Nov 2018 00:19:35 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id w13-v6sm3340046lfc.61.2018.11.01.00.19.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 00:19:34 -0700 (PDT) Date: Thu, 1 Nov 2018 09:19:22 +0200 From: Matti Vaittinen To: Jonathan Corbet , Michael Turquette , Stephen Boyd , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Russell King , Andy Gross , David Brown , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Andrey Smirnov , Sebastian Reichel , Guenter Roeck , Rob Herring , Matti Vaittinen , Huang Shijie , Akshu Agrawal , "Rafael J. Wysocki" , Daniel Kurtz , mazziesaccount@gmail.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com Subject: [PATCH v2 3/8] clk: clk-s3c2410-dclk: clean up clkdev lookup leak Message-ID: <8e396e22b328f35538a01193797fbd0d001f885d.1541054985.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm variant of clkdev lookup registration in order to avoid clkdev lookup leak at device remove. Signed-off-by: Matti Vaittinen --- drivers/clk/samsung/clk-s3c2410-dclk.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c2410-dclk.c b/drivers/clk/samsung/clk-s3c2410-dclk.c index 0d92f3e5e3d9..07798debfec4 100644 --- a/drivers/clk/samsung/clk-s3c2410-dclk.c +++ b/drivers/clk/samsung/clk-s3c2410-dclk.c @@ -309,16 +309,17 @@ static int s3c24xx_dclk_probe(struct platform_device *pdev) goto err_clk_register; } - ret = clk_hw_register_clkdev(clk_table[MUX_DCLK0], "dclk0", NULL); + ret = devm_clk_hw_register_clkdev(&pdev->dev, clk_table[MUX_DCLK0], + "dclk0", NULL); if (!ret) - ret = clk_hw_register_clkdev(clk_table[MUX_DCLK1], "dclk1", - NULL); + ret = devm_clk_hw_register_clkdev(&pdev->dev, + clk_table[MUX_DCLK1], "dclk1", NULL); if (!ret) - ret = clk_hw_register_clkdev(clk_table[MUX_CLKOUT0], - "clkout0", NULL); + ret = devm_clk_hw_register_clkdev(&pdev->dev, + clk_table[MUX_CLKOUT0], "clkout0", NULL); if (!ret) - ret = clk_hw_register_clkdev(clk_table[MUX_CLKOUT1], - "clkout1", NULL); + ret = devm_clk_hw_register_clkdev(&pdev->dev, + clk_table[MUX_CLKOUT1], "clkout1", NULL); if (ret) { dev_err(&pdev->dev, "failed to register aliases, %d\n", ret); goto err_clk_register; From patchwork Thu Nov 1 07:19:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10663595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D506A13A4 for ; Thu, 1 Nov 2018 07:20:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3C2B2BBA7 for ; Thu, 1 Nov 2018 07:20:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B16CF2BBFA; Thu, 1 Nov 2018 07:20:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FADF2B9CD for ; Thu, 1 Nov 2018 07:20:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbeKAQVv (ORCPT ); Thu, 1 Nov 2018 12:21:51 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:46408 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbeKAQVv (ORCPT ); Thu, 1 Nov 2018 12:21:51 -0400 Received: by mail-lj1-f195.google.com with SMTP id x3-v6so17160065lji.13; Thu, 01 Nov 2018 00:20:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=COmn/EezDX/GWsah2t8NJRxiKg5KtxdFjJeZJYU4E4A=; b=Lb/URk0SWipRrwkLENGZMY+odU1ImpkJRbav8JtwI1QqkRE3xCw0vIBwyujF68SDxF GWbjjXE6iCWRoBzEZXFmt5O3X17Aaj8LnxQ5nR44PNev0nTaZmlDla4Jzy77FYIDOzWv Uv9tkivkhXRDJ+vzYo/1z0PtBD0HX08s94yssgGFJYAeMQ8EF3SU0uaIYinOMy6LyzB+ P5vkecnZ46WzVslIeTDOloiMXtfdYUjzyiJIdEYY1V2T6r6sZ6txREd+GvYFxsNzey1I QN5hccD3vEloSODWIVgf8P9xeqIoUGJsps/tEx5ldNOwjic+j+JXKCQzyufbaEQ0eD1G pQ9A== X-Gm-Message-State: AGRZ1gLfFWcT8DZZ9pEw4UQcedJRFxMbgXqL8vv0voAGa6h2cuThRdP8 9LCSRWcPC5fvckY1fVCDvOo= X-Google-Smtp-Source: AJdET5dbBu6/6HNqM4lOnlLDkviqHw5Hcqrx59D528L/oO8JWWPh6wz73Uh4svbCjTCjKVFBg2hFlw== X-Received: by 2002:a2e:6503:: with SMTP id z3-v6mr3898709ljb.153.1541056802566; Thu, 01 Nov 2018 00:20:02 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id s126-v6sm2524051lja.4.2018.11.01.00.20.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 00:20:01 -0700 (PDT) Date: Thu, 1 Nov 2018 09:19:53 +0200 From: Matti Vaittinen To: Jonathan Corbet , Michael Turquette , Stephen Boyd , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Russell King , Andy Gross , David Brown , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Andrey Smirnov , Sebastian Reichel , Guenter Roeck , Rob Herring , Matti Vaittinen , Huang Shijie , Akshu Agrawal , "Rafael J. Wysocki" , Daniel Kurtz , mazziesaccount@gmail.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com Subject: [PATCH v2 4/8] clk: clk-st: avoid clkdev lookup leak at remove Message-ID: <37078c99cc7d7de6847a3bbdf0cc67fbd7281efd.1541054985.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm based clkdev lookup registration to avoid leaking lookup structures. Signed-off-by: Matti Vaittinen --- drivers/clk/x86/clk-st.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/x86/clk-st.c b/drivers/clk/x86/clk-st.c index fb62f3938008..32d8df9bd853 100644 --- a/drivers/clk/x86/clk-st.c +++ b/drivers/clk/x86/clk-st.c @@ -52,7 +52,8 @@ static int st_clk_probe(struct platform_device *pdev) 0, st_data->base + MISCCLKCNTL1, OSCCLKENB, CLK_GATE_SET_TO_DISABLE, NULL); - clk_hw_register_clkdev(hws[ST_CLK_GATE], "oscout1", NULL); + devm_clk_hw_register_clkdev(&pdev->dev, hws[ST_CLK_GATE], "oscout1", + NULL); return 0; } From patchwork Thu Nov 1 07:20:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10663605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A653E13B5 for ; Thu, 1 Nov 2018 07:20:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 886202BA35 for ; Thu, 1 Nov 2018 07:20:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CAA12BA63; Thu, 1 Nov 2018 07:20:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B4372BA68 for ; Thu, 1 Nov 2018 07:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727966AbeKAQWW (ORCPT ); Thu, 1 Nov 2018 12:22:22 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:42328 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbeKAQWW (ORCPT ); Thu, 1 Nov 2018 12:22:22 -0400 Received: by mail-lf1-f67.google.com with SMTP id q6-v6so13488119lfh.9; Thu, 01 Nov 2018 00:20:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KJKi78f3BmTlbgbFoV5YXjiBkX7wj5R8W+WOr3C0zec=; b=DBw9X+6/tqDY6z2NiDIHzqxeMVWidla0ho9Yw8W2TDNFIM5ekNQ4Yx0TMW8MU1vEjY ryEfR9JEXn6Ve3TVA/BJcOCJXHxFXRw9hZbgfroVzhf+s9hvDEQPdYRzEEunFzxe4wJC h4dfekfnIe9lPtw9NSv5+L9qbC+6NSyTNnL20FN58nZ0PMWqxD2x928fC1uNv12PJgr7 RiH8Ges+2r8XN3EshE8qSJei77ocJSBRy7bxMa68LpBPsht4yQ2nVsOo0AJKjfbk5IS/ TlsuqmC1UO3I0YBJgr/xKrMwS8HOAJTA2gKHrPlqfhgXpmstsHZ40jL8637b4sYdWykt 1QWQ== X-Gm-Message-State: AGRZ1gLtGbsMgJnlNmTRFZ0BLiqZju2a52dZqlLidRPU6j7Et9hMdJmL iNmCjvOhYjlH9w3yXX0eTTk= X-Google-Smtp-Source: AJdET5dAOVKivRGpFyMwJ0rc2aWE1+zCj+Mct0ZJ7P9yPLK4ADxnHxz6ml/uPyWRtu2zrsPJaeEk9w== X-Received: by 2002:a19:a086:: with SMTP id j128mr3438420lfe.93.1541056833783; Thu, 01 Nov 2018 00:20:33 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id u26-v6sm753622lji.85.2018.11.01.00.20.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 00:20:33 -0700 (PDT) Date: Thu, 1 Nov 2018 09:20:20 +0200 From: Matti Vaittinen To: Jonathan Corbet , Michael Turquette , Stephen Boyd , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Russell King , Andy Gross , David Brown , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Andrey Smirnov , Sebastian Reichel , Guenter Roeck , Rob Herring , Matti Vaittinen , Huang Shijie , Akshu Agrawal , "Rafael J. Wysocki" , Daniel Kurtz , mazziesaccount@gmail.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com Subject: [PATCH v2 5/8] clk: clk-hi655x: Free of_provider at remove Message-ID: <3b6742f090502f1f75cba283bc6d29e8ccbd92d3.1541054985.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP use devm variant for of_provider registration so provider is freed at exit. Signed-off-by: Matti Vaittinen --- drivers/clk/clk-hi655x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-hi655x.c b/drivers/clk/clk-hi655x.c index 403a0188634a..394d0109104d 100644 --- a/drivers/clk/clk-hi655x.c +++ b/drivers/clk/clk-hi655x.c @@ -107,8 +107,8 @@ static int hi655x_clk_probe(struct platform_device *pdev) if (ret) return ret; - return of_clk_add_hw_provider(parent->of_node, of_clk_hw_simple_get, - &hi655x_clk->clk_hw); + return devm_of_clk_add_parent_hw_provider(&pdev->dev, + of_clk_hw_simple_get, &hi655x_clk->clk_hw); } static struct platform_driver hi655x_clk_driver = { From patchwork Thu Nov 1 07:20:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10663613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 478C217D5 for ; Thu, 1 Nov 2018 07:21:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25CCB2BC12 for ; Thu, 1 Nov 2018 07:21:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19C552BA51; Thu, 1 Nov 2018 07:21:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAC852BC13 for ; Thu, 1 Nov 2018 07:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728088AbeKAQWx (ORCPT ); Thu, 1 Nov 2018 12:22:53 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41093 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbeKAQWw (ORCPT ); Thu, 1 Nov 2018 12:22:52 -0400 Received: by mail-lj1-f193.google.com with SMTP id z80-v6so11111602ljb.8; Thu, 01 Nov 2018 00:21:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JJ40AdSZPMkqm7Da3QKXJd/JQH4MrVzdTvQwG7toy0o=; b=eCTr/dn/LQ7azuQobhL6qLI3S9G7jC+IG1rI7XhR5VQeClX3GAblN4V68zhkWwmGfp ckoXuyYKk9h4xeyFcd6qu7D9Mlbx5oPvHi2hWZjyHjImoYAbY5MOFlixU7NdfK8eZ5dN eNgHrd8T9t3EZ3tJWQGPxGm18zn+Xb3+3PIW0Ej0K9gtOLKdX6fy/2LTF6sbMGf5y5Vj zIfm4PnplGF/ZRc7V9d4FSV8NSambVK+WPbVCCSwCQkVwm2VMV5J/kqZWpt+AKf4j4dv 86gaQ4QpsNzeredwOT419lzwkqnsZfjjolK6Ryx9SzO2rxVjMYCp55i+BXWhPg/8uad0 zZiA== X-Gm-Message-State: AGRZ1gLCgGILTS2TZlszh5q4L9kAHOMmMfKrwPdulO9MMQLlfiPquJvZ IJiAsuSjCzanfnPYPblwGa0= X-Google-Smtp-Source: AJdET5cu+rRXC6h2rM7WDbSFA0lNTibQFCyHDMlVuURHX7Wicw5b9lFNL6eZGCZ8Xv0F44A35XLGNw== X-Received: by 2002:a2e:9059:: with SMTP id n25-v6mr1037215ljg.155.1541056863606; Thu, 01 Nov 2018 00:21:03 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id d6-v6sm4442562lfk.83.2018.11.01.00.21.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 00:21:03 -0700 (PDT) Date: Thu, 1 Nov 2018 09:20:49 +0200 From: Matti Vaittinen To: Jonathan Corbet , Michael Turquette , Stephen Boyd , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Russell King , Andy Gross , David Brown , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Andrey Smirnov , Sebastian Reichel , Guenter Roeck , Rob Herring , Matti Vaittinen , Huang Shijie , Akshu Agrawal , "Rafael J. Wysocki" , Daniel Kurtz , mazziesaccount@gmail.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com Subject: [PATCH v2 6/8] clk: rk808: use managed version of of_provider registration Message-ID: <1a8f1bf8bc4fd3871ba8c87b4ea656d1dc2e870c.1541054985.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify clean-up for rk808 by using managed version of of_provider registration. Signed-off-by: Matti Vaittinen --- drivers/clk/clk-rk808.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c index 6461f2820a5b..177340edaae5 100644 --- a/drivers/clk/clk-rk808.c +++ b/drivers/clk/clk-rk808.c @@ -138,23 +138,12 @@ static int rk808_clkout_probe(struct platform_device *pdev) if (ret) return ret; - return of_clk_add_hw_provider(node, of_clk_rk808_get, rk808_clkout); -} - -static int rk808_clkout_remove(struct platform_device *pdev) -{ - struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent); - struct i2c_client *client = rk808->i2c; - struct device_node *node = client->dev.of_node; - - of_clk_del_provider(node); - - return 0; + return devm_of_clk_add_parent_hw_provider(&pdev->dev, + of_clk_rk808_get, rk808_clkout); } static struct platform_driver rk808_clkout_driver = { .probe = rk808_clkout_probe, - .remove = rk808_clkout_remove, .driver = { .name = "rk808-clkout", }, From patchwork Thu Nov 1 07:21:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10663623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4A6A17D5 for ; Thu, 1 Nov 2018 07:21:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 951302BA51 for ; Thu, 1 Nov 2018 07:21:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87D262BC25; Thu, 1 Nov 2018 07:21:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 479B62BA51 for ; Thu, 1 Nov 2018 07:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728019AbeKAQXX (ORCPT ); Thu, 1 Nov 2018 12:23:23 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36334 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbeKAQXW (ORCPT ); Thu, 1 Nov 2018 12:23:22 -0400 Received: by mail-lj1-f193.google.com with SMTP id s15-v6so17190103lji.3; Thu, 01 Nov 2018 00:21:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=+s3r/08+Ga/YxLK3dh6bw5wWfEcqvsWpac0ppTzEu1E=; b=M3UNei3gNrsLK7Ll71W4dLaMnmENd+HV+MpF6U1G4pEneVfOzgreCM0GYCuT20nBCi WzZTXw3RNkCD3xGjv8rGEXr+VUEDc+O/ZRbnRMVOYbrJ2qyyr3ik4aABDz5m7yED2fTB r6aXkzqYowOCy3vjI7/974hMPh9TIkw5upsOtmdtp9cXTP01oMnC3Td4XMDUQQzGxpVb trGE73cK9YQ30FRH4Hs63hiv/i4qiBquMolsNUbaMI4F2mxCWFFPEB4HQuiW9c/LhYJC W3J/NK4ZmX+YcQZ8waE7PZu3RbnXJZsCM8B9fvdtOi6SGhotDlqV15FWUoB/ButSCCAz b7+g== X-Gm-Message-State: AGRZ1gI+jOSAc+6FQAesjI7OwjmNvB+v1gqQy7xxe5OdupqzHp0BQWEG z8p1DSWH23OeL47Z4t2VZX8= X-Google-Smtp-Source: AJdET5cbjSe5RSBpNuhidRAzzSDJ220q+tEvN1OF/1U/L0HgDVgFi3uuCSUG8j147fDEEGG3k84Jlg== X-Received: by 2002:a2e:b1d1:: with SMTP id e17-v6mr1827218lja.16.1541056894002; Thu, 01 Nov 2018 00:21:34 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id r7-v6sm4037234ljr.21.2018.11.01.00.21.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 00:21:33 -0700 (PDT) Date: Thu, 1 Nov 2018 09:21:20 +0200 From: Matti Vaittinen To: Jonathan Corbet , Michael Turquette , Stephen Boyd , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Russell King , Andy Gross , David Brown , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Andrey Smirnov , Sebastian Reichel , Guenter Roeck , Rob Herring , Matti Vaittinen , Huang Shijie , Akshu Agrawal , "Rafael J. Wysocki" , Daniel Kurtz , mazziesaccount@gmail.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com Subject: [PATCH v2 7/8] clk: clk-twl6040: Free of_provider at remove Message-ID: <4119302cc34182967ae79169e8eb34c59ffcebaf.1541054985.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP use devm variant for of_provider registration so provider is freed at exit. Signed-off-by: Matti Vaittinen --- drivers/clk/clk-twl6040.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-twl6040.c b/drivers/clk/clk-twl6040.c index 25dfe050ae9f..e9da09453eb2 100644 --- a/drivers/clk/clk-twl6040.c +++ b/drivers/clk/clk-twl6040.c @@ -108,9 +108,8 @@ static int twl6040_pdmclk_probe(struct platform_device *pdev) platform_set_drvdata(pdev, clkdata); - return of_clk_add_hw_provider(pdev->dev.parent->of_node, - of_clk_hw_simple_get, - &clkdata->pdmclk_hw); + return devm_of_clk_add_parent_hw_provider(&pdev->dev, + of_clk_hw_simple_get, &clkdata->pdmclk_hw); } static struct platform_driver twl6040_pdmclk_driver = { From patchwork Thu Nov 1 07:21:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10663631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DD8413B5 for ; Thu, 1 Nov 2018 07:22:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DD562BC17 for ; Thu, 1 Nov 2018 07:22:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B7DD2BC30; Thu, 1 Nov 2018 07:22:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BA6D2BC37 for ; Thu, 1 Nov 2018 07:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727997AbeKAQXx (ORCPT ); Thu, 1 Nov 2018 12:23:53 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46577 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbeKAQXx (ORCPT ); Thu, 1 Nov 2018 12:23:53 -0400 Received: by mail-lj1-f193.google.com with SMTP id x3-v6so17164259lji.13; Thu, 01 Nov 2018 00:22:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UWFrztTGBGBvTlJ4yv0DEf/05EQvWoHnl+hl24Atexs=; b=BFsAvKuS++fK5voOACLR+1NloG/Q+EN0q9jPXXdYh+VruwIvDea1B2lz8FyyZPxMLE 2552QsVY6y9s+aiwJIJavW4tqcthPcPcDunXTLgKHR+xhhhjZM5nITf/aMz7WkF3taDN JCXsuVZxI67PqcXb8TQEZEdzDPXmKafO3ViAutaVk0eyA6TjNXgra9wb4vILTsYXOs1x 26+t5OyciUoY+TS+ncd9G/MPhRWSBLUdRlcF/pDwIQsqIEouUNlYpKWsEl2drXEGPnrB GxguQ8fE759pnURgbnE0w659pmUztcImcbktAD0SyqKXcH/MIVCu+Y4wd7E5H7jEi7qv BP1g== X-Gm-Message-State: AGRZ1gI/Ar35EKNtUnptpIPxhF7MON8Ci+AoZITFlc+31FFtk9OFPvRB vrGU2lllvQt8Otu+ZkCQW7E= X-Google-Smtp-Source: AJdET5eLVYg0nZSW1QuJupUecVJ92xhWQDqHlc1uFz9IPWq4XLZgxzSqkoz8rcTr/beMBrsmX+gP/Q== X-Received: by 2002:a2e:8845:: with SMTP id z5-v6mr3903121ljj.98.1541056923882; Thu, 01 Nov 2018 00:22:03 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id g73-v6sm345390lje.24.2018.11.01.00.22.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 00:22:03 -0700 (PDT) Date: Thu, 1 Nov 2018 09:21:51 +0200 From: Matti Vaittinen To: Jonathan Corbet , Michael Turquette , Stephen Boyd , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Russell King , Andy Gross , David Brown , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Andrey Smirnov , Sebastian Reichel , Guenter Roeck , Rob Herring , Matti Vaittinen , Huang Shijie , Akshu Agrawal , "Rafael J. Wysocki" , Daniel Kurtz , mazziesaccount@gmail.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com Subject: [PATCH v2 8/8] clk: apcs-msm8916: simplify probe cleanup by using devm Message-ID: <2e6cd9f1afae4f9e1216a6178a6987b11614f9c7.1541054985.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP use devm variant for of_provider registration. Signed-off-by: Matti Vaittinen --- drivers/clk/qcom/apcs-msm8916.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index b1cc8dbcd327..f4e0c136ab1a 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -96,8 +96,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) goto err; } - ret = of_clk_add_hw_provider(parent->of_node, of_clk_hw_simple_get, - &a53cc->clkr.hw); + ret = devm_of_clk_add_parent_hw_provider(dev, of_clk_hw_simple_get, + &a53cc->clkr.hw); if (ret) { dev_err(dev, "failed to add clock provider: %d\n", ret); goto err; @@ -118,7 +118,6 @@ static int qcom_apcs_msm8916_clk_remove(struct platform_device *pdev) struct device *parent = pdev->dev.parent; clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb); - of_clk_del_provider(parent->of_node); return 0; }