From patchwork Fri Nov 2 12:34:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10665399 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 C11F017DF for ; Fri, 2 Nov 2018 12:35:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8C1F2B399 for ; Fri, 2 Nov 2018 12:35:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B8332B25A; Fri, 2 Nov 2018 12:35:22 +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 EFEF02B399 for ; Fri, 2 Nov 2018 12:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbeKBVmQ (ORCPT ); Fri, 2 Nov 2018 17:42:16 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:46094 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbeKBVmQ (ORCPT ); Fri, 2 Nov 2018 17:42:16 -0400 Received: by mail-lf1-f65.google.com with SMTP id o2-v6so1201654lfl.13; Fri, 02 Nov 2018 05:35:11 -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=i+KZ9+62AmBi6LwLI4MDe8trUcZvmkQ3tsEjwOIjYlM=; b=rKrGSDma0YH3HwEjKMllm2mfB4B87NVuqp18TDFF71NrHg2yzWbwzZ6OvytcEAnzJD lvyGxQbQ3ur3NCGUu7ctWcwlOpv48BdxUA2ZrT+HAQTbCtM96SYiHLwiIVI6WiU4LR/Q R67J5YQIDIqxBMmzE377nWzfW0G54u5LiRTkE+T+r0IQ9WTx26kFIJpJBgpkusbI73ae cpBuEY7Te+Ww09ZeVwI8zpTy7idyt+YxforfIcRNcJCibtLWwchVAKzhRO/uzFrh6wiI zXBhKzVKDANtS2SOsvFKrN/1n8YRM1WK5vWv2z9G0SRZCFKNolJYcPnPeuO5Bm07GZaa 1YZA== X-Gm-Message-State: AGRZ1gJEGjUGdUApq0k0Th974B+WLyHkNEOiMvEzxQZRZCIsKIt+dta1 S3GjPl/6QWDYaQPL1oZuM+E= X-Google-Smtp-Source: AJdET5ekL+rqBiWy+f43HQiSZGs4Wf/P2izmKoxyjfRRn6q2+4yTzzfzbxxoEWw9VOQunRKqdgPNcg== X-Received: by 2002:a19:2906:: with SMTP id p6mr4801931lfp.17.1541162110450; Fri, 02 Nov 2018 05:35:10 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id m64-v6sm403821lfm.89.2018.11.02.05.35.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 05:35:09 -0700 (PDT) Date: Fri, 2 Nov 2018 14:34:55 +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 v3 1/7] clk: clkdev/of_clk - add managed lookup and provider registrations Message-ID: <1ab16de50fe98a8cdbc0aebc8eced41d7c04f14d.1541161503.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 Fri Nov 2 12:35: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: 10665403 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 C22CB14E2 for ; Fri, 2 Nov 2018 12:36:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC4BB2B3A1 for ; Fri, 2 Nov 2018 12:36:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A00112B3C2; Fri, 2 Nov 2018 12:36:12 +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=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 28A722B3A1 for ; Fri, 2 Nov 2018 12:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727633AbeKBVnI (ORCPT ); Fri, 2 Nov 2018 17:43:08 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:43544 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbeKBVnI (ORCPT ); Fri, 2 Nov 2018 17:43:08 -0400 Received: by mail-lf1-f68.google.com with SMTP id u18so1206337lff.10; Fri, 02 Nov 2018 05:36: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=Y5x+Ok5Ed4t9w7g5J7qXI1OurGBp0O2MAJGG1HebFLU=; b=KGzoUCvm5/2b6dA7Lmnls17L74Q6oNK3aZbWxXuPgMPbPdCgXogibv51WoUiOvdP30 NxJN9bOQt8tNHNMwuo40R9CkrRdxondpNgGENWWNfsnnlJ6YkLPgIjW+eeNRbIf7lbDD oiK9RuSWwh1oqsLHbAbbn1heirMVt8NLcz+NcGPclXX9q1hgwInlc8R+LkoKNUvhd8uI hZI6kJmcR1I56pxDTcZMmucSlbEr3vMy38JNRGH7yZSUtqag6SDmhb9CqjO9BdfQEtNd lckhYUdtbfQTpqLt0zX1FwOWgtrlNI9wbIZ2wt/RTDIrb01T16mNGFh9x1rC/oQNekha JsRw== X-Gm-Message-State: AGRZ1gLaQhs1eNBGH9WDbFz5BmPuh9N1z1mSQis5VL0eTaoFh+ztCjvh UoIK46AFknMmgb1aHtO5KPc= X-Google-Smtp-Source: AJdET5dlM7Gl67fYKCTdLIuaFdbAX7CuFNVR37Z6KObOdFlosdpkknsAqp9MQje21OG0cpsW28nYRQ== X-Received: by 2002:a19:48d0:: with SMTP id v199mr6949047lfa.104.1541162163233; Fri, 02 Nov 2018 05:36:03 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id a63-v6sm5537119ljf.54.2018.11.02.05.36.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 05:36:02 -0700 (PDT) Date: Fri, 2 Nov 2018 14:35: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 v3 2/7] clk: clk-max77686: Clean clkdev lookup leak and use devm Message-ID: <0be8b4ce5554e8539a458cc6152facc88a3e1804.1541161503.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 | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c index 02551fe4b87c..51a46179f6f8 100644 --- a/drivers/clk/clk-max77686.c +++ b/drivers/clk/clk-max77686.c @@ -235,8 +235,9 @@ static int max77686_clk_probe(struct platform_device *pdev) return ret; } - ret = clk_hw_register_clkdev(&max_clk_data->hw, - max_clk_data->clk_idata.name, NULL); + 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); return ret; @@ -244,8 +245,9 @@ 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 +263,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 +283,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 Fri Nov 2 12:36: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: 10665413 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 2F6B117D5 for ; Fri, 2 Nov 2018 12:36:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A2922B3BA for ; Fri, 2 Nov 2018 12:36:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CF0E2B3C2; Fri, 2 Nov 2018 12:36:37 +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 BFF3B2B3E2 for ; Fri, 2 Nov 2018 12:36:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbeKBVni (ORCPT ); Fri, 2 Nov 2018 17:43:38 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:39518 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbeKBVni (ORCPT ); Fri, 2 Nov 2018 17:43:38 -0400 Received: by mail-lf1-f67.google.com with SMTP id n18so1215628lfh.6; Fri, 02 Nov 2018 05:36:33 -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=XHBuXIz+/k/o9sHwadx6Xj4e5igjCAket6IT5Fa5bu0=; b=F2C8pG9shyle2xQWJdlcVNYU8Ry0BME+nJgb4y11H6UlAaItLV+MqxVVOgxKDZ86bI 3ULMxNX1WRBtUSfKu/VhMpf/UXf+tu4uteErgkx4PZLqHYPscQfRLyWzjVpsjV8V6+B1 +y35Nfw+K9+iqroWZ/YdHH/5PGnvdjDnrvlCZH2h6Sx7/sUM4MzlBfY528yUBE+8Cde/ uUyce7uTUtT9RV1foeyt6iwqKeeZC95qY+BqHZ98oYbFFfn2DhHyomg5XdQdLn6KjUoi RPxOCKYDpAcH1iOQ5o7hw2RhgUot5ARw/MXnnT+dAsX85hpw8e812ioFBqsjhgB+V9OS nKNw== X-Gm-Message-State: AGRZ1gI3WjZ4F51BO7w6tU6nQjJkKpEnBm5KSePI8tce7Mz0WZjgfE11 OBl2LaLRk++je/ZA2MMaIUI= X-Google-Smtp-Source: AJdET5f98WmhOgjNCCnLbQqOo8CLgXCsjGIuZLUhIOODJZO3xhN5eWHpj2rx7Fh8LSIu5G+mG87uzw== X-Received: by 2002:a19:d04f:: with SMTP id h76mr6541421lfg.52.1541162193044; Fri, 02 Nov 2018 05:36:33 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id t77-v6sm5708146lfi.63.2018.11.02.05.36.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 05:36:32 -0700 (PDT) Date: Fri, 2 Nov 2018 14:36: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 v3 3/7] clk: clk-st: avoid clkdev lookup leak at remove Message-ID: <5f79250d8055016b3a3c815e478ece889b8f80d2.1541161503.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 Fri Nov 2 12:36:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10665421 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 E1CFC17DF for ; Fri, 2 Nov 2018 12:36:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE0ED2B3C8 for ; Fri, 2 Nov 2018 12:36:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C17512B3EF; Fri, 2 Nov 2018 12:36:59 +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 7EBF22B3D6 for ; Fri, 2 Nov 2018 12:36:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726104AbeKBVoB (ORCPT ); Fri, 2 Nov 2018 17:44:01 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:40690 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbeKBVoA (ORCPT ); Fri, 2 Nov 2018 17:44:00 -0400 Received: by mail-lj1-f196.google.com with SMTP id t22-v6so1599323lji.7; Fri, 02 Nov 2018 05:36:56 -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=GkHc1XDfS2zAEG1O6tNrzFVGgOycf/0Y3wU3cQalzu0=; b=uEVtIclc9yPI9UN+2HdS/esRZuomnYUtKhs1beNz8zp6WKt/f1JmK7UDEkleIQnfe0 dM+Wa68DPL6AelGh8/FOUOJD6InDLQoTeAEdFgT8JB/aFOMV+gqPDn3rgJdEtLu+0pGc 70cSe+fYpn+X60o9jiHzultwAKsQJFDGYq9z3k4i22xGdVyu2+lIe1aI4SqmADmnyoJ3 Xz6h6bnDTs2UgEWHHOu3qSzU0o3Pth/Wmg7jdV0N+xs36bxPruwPIGQN4gIKtNVSpfyH NC8Q27mzZ8McEM4hH+kvG6EnPFjBk7GwwePOPwv5EWXj7QSiSPVPjUBltTnlI8JJQcET QFEg== X-Gm-Message-State: AGRZ1gLo4c/jBD89v7GN4C94AfF/LGRgundZjwb1tlWTUMguTBngfWmP uAGJFpIK5vgku5A/6RsncaI= X-Google-Smtp-Source: AJdET5dhkQJ4jFduLKkaHHDNMMXHLuYY6WY03oYUynBUpLEg/UFwtz/6PJeLj3M6DtVoCDXnQnipaQ== X-Received: by 2002:a2e:9ad0:: with SMTP id p16-v6mr8148863ljj.102.1541162215626; Fri, 02 Nov 2018 05:36:55 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id j66-v6sm5641477ljb.45.2018.11.02.05.36.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 05:36:55 -0700 (PDT) Date: Fri, 2 Nov 2018 14:36:42 +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 v3 4/7] clk: clk-hi655x: Free of_provider at remove Message-ID: <0f66b67315e67192ada302304e2d133fff4989f9.1541161503.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 Fri Nov 2 12:37:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10665431 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 0702117DF for ; Fri, 2 Nov 2018 12:37:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E679C2B3F0 for ; Fri, 2 Nov 2018 12:37:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D98C42B3FA; Fri, 2 Nov 2018 12:37:33 +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 942EF2B3F0 for ; Fri, 2 Nov 2018 12:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbeKBVof (ORCPT ); Fri, 2 Nov 2018 17:44:35 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33678 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbeKBVoe (ORCPT ); Fri, 2 Nov 2018 17:44:34 -0400 Received: by mail-lf1-f67.google.com with SMTP id i26so1244231lfc.0; Fri, 02 Nov 2018 05:37:29 -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=4b7mWWvbRMSl/BrY6BXSv/3823MeAc6TDJ2DxbTG2QU=; b=i+zOQDDPmlt5kN6ndbcAEF8pJnukwAVMcTg6ZHjjPGh9DU8LRWdsZat7I+E2RFIuCF jJTJQf+EKp27Ws2S3dM7ly6YJOoW4d9EzmGEN+MQRI9lgg88blaJI6g6JpqLyfb13TM2 s9aWSLp0U7p2PYTCYdVrWeRhDPufymYxj9i1umXx05celJGJanle/lmUQKR7CUeM/eu0 N126uyuttxI0pa7Y7ife21yrSPSgpjSuNTteXV+7cGAiD1PBJPdeBA6ru2C2CPj3i4OY 9N4dxG5VVXMhMOqMymxbj4oqJMIOhd0CFsJ9C86atUO8E3qXZd51VqjwI7R6hQqbSrF+ aQbw== X-Gm-Message-State: AGRZ1gLe7pxQ+4tEr5TpCsCavl4w1YD4b1q9UXjSKWIWyp1k3UgmrO9f kxLhxivkel0IsvNuQym2fGY= X-Google-Smtp-Source: AJdET5ey2hQGFTMu+Rc2Rtu+S/newd6zf17RtA9SMIAuBBhpOQg4DfiVCl26dLZMvX6mlbt7D/wc7w== X-Received: by 2002:a19:c396:: with SMTP id t144mr6633017lff.110.1541162248798; Fri, 02 Nov 2018 05:37:28 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id a9sm2639656lfi.57.2018.11.02.05.37.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 05:37:28 -0700 (PDT) Date: Fri, 2 Nov 2018 14:37:14 +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 v3 5/7] clk: rk808: use managed version of of_provider registration Message-ID: 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 Fri Nov 2 12:37:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10665439 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 524B017DF for ; Fri, 2 Nov 2018 12:38:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DF832B245 for ; Fri, 2 Nov 2018 12:38:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F6502B3D6; Fri, 2 Nov 2018 12:38:16 +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 D5AEF2B2CC for ; Fri, 2 Nov 2018 12:38:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726672AbeKBVpR (ORCPT ); Fri, 2 Nov 2018 17:45:17 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36143 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbeKBVpR (ORCPT ); Fri, 2 Nov 2018 17:45:17 -0400 Received: by mail-lj1-f193.google.com with SMTP id s15-v6so1630573lji.3; Fri, 02 Nov 2018 05:38:12 -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=JeHJuHO+4xpf3J2SVDQjxZVY8BBXyGfkraU6ANME+s8JM349NPItQMS6pYLfIdz/EB HqyTytO8844Bwnf4MA+CJuLtdcWMh+Usetb4AxWWHUh5TQ7p8s2pasG2pt53/+kt3xAi Og6upIt56/zb0oM+re0r5IRuKfxBcPWCFe5T5vwWE/THuRIY68Frkp1Bv7fHs6bzjlvb FVc1XZn5lgE6KmzPzsgiivxvCC+Hev2Gp96LwTHbXTKq8hKvm1HaRVokH1QxHx9QdPgJ zZ0sJ9DAB9TcAhYWHOiia33Go743f8NKjox7uTxTkfM9lmKOmKIox5QK+SILaqIRIteY 5Ulw== X-Gm-Message-State: AGRZ1gLqt2qa/Ka8pOl26TJkZmWGQovxaBMsjGUYGEo0LZJBHTJUjkyR CepMjLK3jE5MRbpFP5aLGGo= X-Google-Smtp-Source: AJdET5dyI91CdFj4DIaV7N3G9PaIKfCXsdJECg4xdUCO3IiKDOsNO4UkznNkquewRrPj9d2c3cMI5A== X-Received: by 2002:a2e:9783:: with SMTP id y3-v6mr7533376lji.167.1541162292222; Fri, 02 Nov 2018 05:38:12 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id k21-v6sm454793ljc.15.2018.11.02.05.38.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 05:38:11 -0700 (PDT) Date: Fri, 2 Nov 2018 14:37:58 +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 v3 6/7] clk: clk-twl6040: Free of_provider at remove Message-ID: <855d60c35f092de196b131838fe0b07e9d3080d3.1541161503.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 Acked-by: Peter Ujfalusi --- 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 Fri Nov 2 12:38:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 10665449 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 737B417DF for ; Fri, 2 Nov 2018 12:38:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CA652B40A for ; Fri, 2 Nov 2018 12:38:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 504AF2B3F0; Fri, 2 Nov 2018 12:38:50 +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 C55692B403 for ; Fri, 2 Nov 2018 12:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726129AbeKBVpq (ORCPT ); Fri, 2 Nov 2018 17:45:46 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33757 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbeKBVpq (ORCPT ); Fri, 2 Nov 2018 17:45:46 -0400 Received: by mail-lf1-f67.google.com with SMTP id i26so1246438lfc.0; Fri, 02 Nov 2018 05:38:41 -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=GkCzko3mQGts1eCHOnCyqHmgCmljKhybShTtJASOCr+IDAj5BGt0fDgqMe+eGrXyIy 9TzgX00JI2PtEg1bfoJGHtz/TyiGPe4J5QZGhhs72/Pd7XZ9ESyN9dhV3rrhndnDd2Dj FR5f0/wVmfuiD36Lj5eQ7iw1/kDQhAOy/FFKqjhWZhECPHq8OaAYuGqiVug8CueIWQOL Fr+sj7UwbIp0UHOX4bAl4tlcRq7c/v8j0A12dhF5QjBPsBFgFq54XEa0S9Z4GRE8MOUt EfjFIzW64RmQDLmC2XgpHtY+1AYK1U0tnst2ZCm33fAZp4jaesk4AbTV8xaBUxjTNRAu CuDw== X-Gm-Message-State: AGRZ1gKbdaXSHiuBYM2bU70LyYtz3BtBTO9Uir4q8tz2sv+FYI98/NQm WkT/dQg3TMkfiNaX/BcBL70= X-Google-Smtp-Source: AJdET5f59gj3giKEcfA7HmG//zPzEs+DCu7u8ul4wUV+I0FfLYxpMxxOuqZLix2NlyPzlXp1uIUySQ== X-Received: by 2002:a19:d04f:: with SMTP id h76mr6545138lfg.52.1541162320578; Fri, 02 Nov 2018 05:38:40 -0700 (PDT) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id t5-v6sm5605393lfg.90.2018.11.02.05.38.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Nov 2018 05:38:40 -0700 (PDT) Date: Fri, 2 Nov 2018 14:38:27 +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 v3 7/7] clk: apcs-msm8916: simplify probe cleanup by using devm Message-ID: 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; }