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: 10663577 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 CA37013A4 for ; Thu, 1 Nov 2018 07:18:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A68122B909 for ; Thu, 1 Nov 2018 07:18:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 997892B90B; Thu, 1 Nov 2018 07:18:45 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D73212B909 for ; Thu, 1 Nov 2018 07:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3OeVJ0gXQ7BWqeYRrGT2qoJwBC1sQXreK0XZK1leP/0=; b=DZvnsIF6qNVNGB mk4qz4UWeSRILO3lmEatDtoUINVDb+7RdZFw5PFa8cbomjER19mRPVkVIrrzf4TqEZ08plVaW9NEk CKoLXID5AlQXFtkA0w2eSKl4cLWfIC9rtI6etdmb6axrCSosse82ojd0Qw/8r7kWK/3oepzkHMdDY 8H5TcZE4s3gU6ZbT6+Z6Jw/Fv4MwapipoK+cFv2iJqid9I4n3O8V0lvdElj1GPijupIdwVPzo5BN6 MGWx5tXBSkTUyO6DGTMIe7Bm4Xy2NmjPOeppE6IFk7Q2r/rgiR52B50K3N+7Hy5ngFj5zldolif/8 /aOnKCxGCVIPMAmrRoag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7Fa-00055F-1q; Thu, 01 Nov 2018 07:18:42 +0000 Received: from mail-lf1-f66.google.com ([209.85.167.66]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7FW-00053f-TB for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2018 07:18:40 +0000 Received: by mail-lf1-f66.google.com with SMTP id p17so7045305lfh.4 for ; Thu, 01 Nov 2018 00:18:28 -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=qRD+1/M9V3VMjz8r+ybccL5bZorDTkZwkpFYEub2x+Hjw0SQs+kB03aMqcKQjDlIXt L7F21JY4CQ/hPFqLEcDz0h3DpzqXpaAM+xOT+6hJ8PyD7u/xqIaxv1hLwhQjQTdHIqpV cOGY/e2wstvDLuigucli/vMFvua6I4Fh5IKJD3IK61Gfrm5gPJ8y9QtPXuv8O3c3APd3 BkO9bCJE+PyRNh+GE/RlvIiXGk2u0iQfC8TX3I1xDs2hek7VxAQCg9kmySiuJ7BT1HOF pdHq0ePg1An1xsmt6+8I87u0Wiy9hjl8sGvM158eFGsHizPa9d4fT9pGJCqtpcWe/IAt oNBA== X-Gm-Message-State: AGRZ1gK6kSlPbZQZdU7LV58rjuFrgy9+aUmCfV0t08Jnh1oma9XBFAuO 4eBxmL4Fpyx0F+BKi2PxXDg= 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181101_001838_942534_C45F2BD0 X-CRM114-Status: GOOD ( 23.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10663585 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 9B45717D5 for ; Thu, 1 Nov 2018 07:19:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 781812B98F for ; Thu, 1 Nov 2018 07:19:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B8242B99D; Thu, 1 Nov 2018 07:19:20 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 137812B98F for ; Thu, 1 Nov 2018 07:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TLwVJUo2vPbipF0Uj2oWNQeg1XduXmSU06JHIX+ZFcQ=; b=NiNLhMxY+hlZEp HDIP2gbgsSgo7QROcNBjSRcvdr/GrnSwRokiijsOLt8+uRMzM0Nf5KKgJUbzj78kR/BjOfrBByFiA 8btHS2e8grT+NN9WFKJ+RrWZ7van92GyRQy087MtsFvObguUScpc5JzqYplBqo6K/wAC/bM9GBTYw L7WYVgZMZtyiYyCfKdqX6unKXc+bJqCSLY00Q7tKVLAaMQgOqMKIEA9cCFQj84mF+Vv7c0G2/dIRR JHD2fqbfcHfhkAo5gCJwKhMV0xQ2BOGTtjBpclbG6gmENNSh33ii44ERUSklFu5C0ZRdDtWBnxk0b DUsW4RNWHfLyVrqKfV1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7GA-0005T2-79; Thu, 01 Nov 2018 07:19:18 +0000 Received: from mail-lf1-f66.google.com ([209.85.167.66]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7G3-0005Oh-I2 for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2018 07:19:16 +0000 Received: by mail-lf1-f66.google.com with SMTP id n26-v6so13532207lfl.1 for ; Thu, 01 Nov 2018 00:19:01 -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=HzBOtbFB8xRUyJBP4DejEPzAIgHPyzGMri/ieoW3/uxvBdnATdhIfTiqL6Mh5Hj60l zOEtQoUosWTXZEgA26czuXj7frBVD6hCoTKtSnq8kCCkklre5WbWwSqvvwcL7BY6G0nv qzyIlV+sZOghE+DZ6w7ST1yvViUgBGIMpz5jYZz7rEe7cigzpx5V+yAWE/kshceKP6br Xgp0bXixLwbk0LmS/aYarypK0C0LmUSoqeszQnTLRy3m5YilnRtTV1lJkuvD9QTnvW5c ibd4rcQ6g2p7u85ic1e3OWMLLfzzrdtKJF1r0khaRiJgj/hhHES/8+EWXAU98bWqznkS lctg== X-Gm-Message-State: AGRZ1gIv2LOBEnJ1jzp7J0wt+jeAQhWB4ZK+YkTRXgeG3L1fTcEqxdO1 QAbdEG59FYDCtd3iytURkcE= 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181101_001911_695751_B073E69C X-CRM114-Status: GOOD ( 17.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10663593 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 0D02213B5 for ; Thu, 1 Nov 2018 07:19:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDF582B997 for ; Thu, 1 Nov 2018 07:19:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D11682B9B8; Thu, 1 Nov 2018 07:19: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74B2D2B997 for ; Thu, 1 Nov 2018 07:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UM8LqNW5qp7ihLeC0krrsM8Y8RlUSAzkzjHQF+5skuE=; b=SdpmCp+wf0yMBa dfBTN/S/WC94lcS7zeUzbh796xFfxGE2hLPFDMntqfaP9UqHFPiRzloWXivclCZ6lVnAbWLYTpMB6 GHLT92z3Kg/jFaAafxlQ+ptLYRX77+IVxgqIrWkafSiWG1UJUGZn6seS81eKazziD+Kd3nTiyE5/S FgnSrIx+6EWgX6IDXzF+7Hve3xirRYkrHAbltTuPvIJRZjO01EDKFHNPvxdIFB2kxna+f0QQeKAC9 40t/1ti5CXpyo/xhcUTjDnasT4XIqetoj1tEM9x65lX6dvPsGqCA1ru82toJZVkQA5guTsvPqXkTw z4my035Z7+oK98HUoEaQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7Gf-0005mE-Gu; Thu, 01 Nov 2018 07:19:49 +0000 Received: from mail-lj1-f194.google.com ([209.85.208.194]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7Gd-0005j3-2G for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2018 07:19:48 +0000 Received: by mail-lj1-f194.google.com with SMTP id a28-v6so14152378ljd.6 for ; Thu, 01 Nov 2018 00:19:36 -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=dsiFoqzvdnufcBElli/YihAhUni3NJddnC2RxC+f+RfnTnYiW5CYxhqcviruiRw6S7 zWL3B7CjO/PKS1DgG4LYEHYiNm2tE2nEaaJMw+JXLIOxJVdOkrF98LJnVTG8lu19re+B VQ2A5sinN8AuDld3KzK4RYZoecbZhbiScQSjfEHVDvNAE8MagHFSIjf3q+cUH1dGKgkk mOYBYFK/TlJMkbWQIbwq2hwnmHWftXk1V3ptbo1JNkS9GYlVf2Ha8m7Xkpvmu9+jCGaw 9dWE6MRWVUmwDWotFwrO0yNbb9vKWU7/Xr04Toc69/p+bpKelDxvB6R4YAJrEPmgtvhr epIQ== X-Gm-Message-State: AGRZ1gKM8Vj5OcpvdN9lEOO0eLNBhOmS9mUcmWzKF6LBY8tH8XWqCN+6 MTR2iZFgXPv3KI+ebb/wS78= 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181101_001947_109770_9D450569 X-CRM114-Status: GOOD ( 14.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10663597 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 04B6B17D5 for ; Thu, 1 Nov 2018 07:20:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D58232B9D2 for ; Thu, 1 Nov 2018 07:20:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFAD22BA68; 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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 35CC72B9F2 for ; Thu, 1 Nov 2018 07:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lzTTL4ZauqG+LAu44m2PPBVvqGlxJ5Vj5qOLoJCVYdg=; b=gFuS+cUthFkPmx uLcgjxAu78WEOOzmvDOo8QJycgRl6M7aN4RFHfZJDxdUViAY64sM93vL4WZ2ixIQ6i0b5+bx2Ohv4 cSAMSIabxMX7UbjB1HhPeoWV8S/e6k+RY5OZ9Ru25lGyAO527MfmaJG3hsmjjt56a6nYfrthZFXIw iY86efGtQ6PxHOvT0v7OnGuwcuubVcUixe2Uvvl9gGBTxlLVeDvzoTnRhQf5RzWg/25aKootUl4UP ua2xk4NptVkYACuON5lGx3YBMgizylUzVELPV+FujEIVJtAQ0OKIeo4W9HPSrbpNSFxteXE/qlSul 2SbeC4YYBPWNWTGRz+uw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7H9-0007NO-Au; Thu, 01 Nov 2018 07:20:19 +0000 Received: from mail-lj1-f194.google.com ([209.85.208.194]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7H4-000648-40 for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2018 07:20:17 +0000 Received: by mail-lj1-f194.google.com with SMTP id z21-v6so17170927ljz.0 for ; Thu, 01 Nov 2018 00:20: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=COmn/EezDX/GWsah2t8NJRxiKg5KtxdFjJeZJYU4E4A=; b=f+L3/WHyfdJWI4RlqNs7VBbZ8YIAB5n3EvPIgTLomP0juKfsW+8TgWl7U5QGsGkGDh Vd4q7BD+u3ecGA9vxbcAHJUfkTeSvIOl6IqgcOTEyvO2SDOqgR2KvkicNs4P0qyclayT c5wJ7/ExLmkfTlKSMBgkpNQMyXjrhK4Lp2NS/xX5JuO4NrpO8sgVXud2PfdstIw1W4uw gfop9TmN6b4XgNdP9Kyuo9f2l1ZyX7aY1tFcNI0uexKk7eKNqqn7jSqRcElQ7A4l/pux hLxo9YzkS2WnVaSE2eXTasRvfEGSE7E8C5qfhzGRuDOkcGAx4NDtvoMERWvIxteKtGrB 1V3Q== X-Gm-Message-State: AGRZ1gJHdovvNd1qQqwQoMtQeMyiflBPEE1qFUssLrNKeZlLG5JOHrDd PTheulsI+4Hh/P1r5k/2I5U= 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181101_002014_257549_6100418A X-CRM114-Status: GOOD ( 15.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10663609 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 5058813B5 for ; Thu, 1 Nov 2018 07:20:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D3702862C for ; Thu, 1 Nov 2018 07:20:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F8FA2BA63; Thu, 1 Nov 2018 07:20:58 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B28B42BA68 for ; Thu, 1 Nov 2018 07:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6GbZnwahHJBJImj5vNaEytfIqlkxnNgBKwJLAL8Klgo=; b=N7GY+TnhAx2G+I X59GfBS1qxzRjY0iHsBv02vdS4ryx9CfBM49MuSBdHgI2UyKXwnnvPI75py+H/iO95hnWVsnOg/Ey RdNtB4TGdAoWfI+xYThPiHg33Ceoc3OtlzVNIPFNhn3n65wsszo+A/uX+aLPzPF8cUxKJRXjaY+QD 0GGR0T7Mxpuoc5fHpJx8+JIpp3eG31/9h+MK20FJILj+LjK3i5y2WPDqm/O9KYML1RvDkm5SiA2vA E5t0HqNu9cvMhZKgdzTqlVRINhZXbstXgfUBSMgkkv7tEpPgP+CIeZw8M7+XiTtUJunwmwmT+xOvc QJLr4RSHVmG6+NtK7Z5A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7He-0007gk-5A; Thu, 01 Nov 2018 07:20:50 +0000 Received: from mail-lf1-f67.google.com ([209.85.167.67]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7HZ-0007cv-D6 for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2018 07:20:47 +0000 Received: by mail-lf1-f67.google.com with SMTP id d7-v6so13513542lfi.2 for ; Thu, 01 Nov 2018 00:20: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=KJKi78f3BmTlbgbFoV5YXjiBkX7wj5R8W+WOr3C0zec=; b=NYe4hevq3Y0h3/RckN1qQi9MiMNbx/cX/RVfGdMg7xwvXQD8ix4q9JY5XmaEYdcfqC LrlXEsiMQAu+z7c51OtaoMAdFMYYC/dvqu4wtDl9vaLUiNoaIbLc93WlaFK0F60Z+6wA ZVPBHeqGpT50CZPHzJz/g9vDUsH99YjDFGg1YKZAa9g62gz8FmlbR3lqt12wGp7VcsbV 7LSXeylORWrqmloz8rOx/vElyTjLUv3Ka+L0gvWk7Q5Zl2OR0WpOdExHe2ck0+6dU2Jw wSZ4Mr4YOZQsoA/KshiJQGtNgckHsUNOOVJ2NxJoHbB7XXa/vcyw2UPWMR9cSfjjqRoi oiSw== X-Gm-Message-State: AGRZ1gKyGT66gKVtZ9E+3tV51lnNbbghOUiD/CksQxnhC1FoiHa+w0Hm QJeZRP+G9uca19MhxnuEOxo= 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181101_002045_441139_581B6289 X-CRM114-Status: GOOD ( 15.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10663617 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 A03D213A4 for ; Thu, 1 Nov 2018 07:21:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E7D82BA66 for ; Thu, 1 Nov 2018 07:21:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C1832BC1B; Thu, 1 Nov 2018 07:21: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 24EFA2BA66 for ; Thu, 1 Nov 2018 07:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RGdoiIedUVumv1VY5MsdWFk+o93J698sq4oreuyw+X8=; b=Ja1qv4l8eXrG4y XNl/f8SCmfejoSAstXJTeHJtu05H6G6Ol2v2PIB6bvS+h3NnjPRSz37jx685xie5GlC5BMM+BQS1p IpM2N4aNXFZwDojQ4pgJLsUcngewsB/tY7If/t8TPYCRuyhEqNFsHYfY8XAs94Y1aMTlzbx0CeEqJ jzcraqjLIpoG1p+Ai7wQgXCDnhlljgdfrzlC9kPKOUNaVGnNLVQmsOH1HBvZ7fE7shy2wqCRIo8G2 HpoBvLVKdvMXf7tPLGT7fXx/HNP+RNo5JFvhQNIZjlJtYsx/oS8m+F5mApCBhM4ZCZKSN7ljZo5an H9ArtpT+CnNGpqw5/Dpw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7IJ-0008J6-A4; Thu, 01 Nov 2018 07:21:31 +0000 Received: from mail-lj1-f196.google.com ([209.85.208.196]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7I3-0007ww-Ee for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2018 07:21:29 +0000 Received: by mail-lj1-f196.google.com with SMTP id k19-v6so8651076lji.11 for ; Thu, 01 Nov 2018 00:21:05 -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=ZhzCOSXyJMNMC1MkgnCD8YSp9nXyZbuFIf+ZyU7VsN7wMOEfEOPOtIfDx1l3YD1tM0 r4H8u03jtwSsqzeaSOB2nTXFWfVO2tKWSEclCPLxslWSMTZx1iACMrc8/X9ENJYnE7vI 27/W40q+YIuQd2CV1qu6I0zY5JDBOEaylLx6OGPvAMWgERqnV85M7Au6toxAv5ZObBSA qNFaWUgGCtWDwbhFK49U/ls+xS3VJBOgU0rxcOeEJWLRXay9+9rwIuNdTpTQJtpyxCfF NL60RqGxAlPNSWCmNuKMJsVe/76YsW3kUn7S5lzkUF+Ik/PS4QSFO1vooYM/6PeIrMGH hEIw== X-Gm-Message-State: AGRZ1gLDHYCIjnBvle0VYmKlwsUDVVKmLLpxDUhfnnYXNVXEuDvRvVEu SMNnclKhcTchY7GK2cuUkeY= 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181101_002115_850645_956353F1 X-CRM114-Status: GOOD ( 15.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10663625 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 D4FB913B5 for ; Thu, 1 Nov 2018 07:21:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0DF82BBCF for ; Thu, 1 Nov 2018 07:21:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4A4B2BC2C; Thu, 1 Nov 2018 07:21:52 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4528E2BC29 for ; Thu, 1 Nov 2018 07:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AV/0q8ofR4yyrilKKmOSW3f08L1jPC1DPcp2W27Z5ro=; b=UX/+c0C+vuv8aO dK5W/1ZYDOnyvrVwfi07E44ojZQP0UvAjRhRMEjh4uhwImm/6leM2563STXLz90MSkDewitoYneHJ N/FJFjlTanRlTddp/e6MHNHGoEOmf1NdQq2dCe2pZVi596EUfonTf4O/eqDQVG6d7efkdoNzBGF5o zilb/WGZM3E3b1SWMmGh6kuvKV/UdK8Rg6bfQjcso0ca6OLpUHSsqjpPvNIbhiGwGD7BG/rR4R3R7 qdvdDXfPbKAgFTGNhGBTguj+KJs9EBFUXLBAd/8d7JK2WgktG8+Yrvjr0H2Ne0PIxjRq4r+VRkMSr aw3tnwgiKB4UKyFEiC4g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7Id-000092-76; Thu, 01 Nov 2018 07:21:51 +0000 Received: from mail-lj1-f195.google.com ([209.85.208.195]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7IX-0008MQ-SU for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2018 07:21:49 +0000 Received: by mail-lj1-f195.google.com with SMTP id k19-v6so8652026lji.11 for ; Thu, 01 Nov 2018 00:21: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=+s3r/08+Ga/YxLK3dh6bw5wWfEcqvsWpac0ppTzEu1E=; b=qntQ972v7KGRc5moKB9Cr+OrTDLWwa2T89qr63wPplftLEzdcGWbd8DCGp9QIeU+g9 Wu/9QHX4TOrtuVJjoq9KT/QGsOayjShjkRRiofyNcBx2oQmYb+b5MzsqvEaKal67WQCV CJBKl5fLHjZAtH9NzZOzsOJOqO+NRhTPjcZrvd93jupd+bRYi2FGxnMbrmSa3A9ZfoG6 DJCIqTg+njQkDiDOI1Bu4ONf0LP5gHgCCKFd5fJfQu3+QLvgBKbzYS+eWwAkGbslJxS6 hMwaGXFexKLxpDHrmvBv8rTzLpj+ACOUX4OJFRvlFAyXU9ULHXuTYUUGp3iz8zXS1b/+ TlXw== X-Gm-Message-State: AGRZ1gIFMDK1Awr1YUfxIQhKbbbfHn+znnuFRmA59pcve61ibeYd6j69 CaXV3tSed2LwuWf6pl46Nys= 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181101_002146_049439_51DA4839 X-CRM114-Status: GOOD ( 15.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10663633 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 E9BBF13B5 for ; Thu, 1 Nov 2018 07:22:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7F2D2BC10 for ; Thu, 1 Nov 2018 07:22:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5AFF2BC30; Thu, 1 Nov 2018 07:22:21 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CD162BBA7 for ; Thu, 1 Nov 2018 07:22:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XOWnGMkNNfEczf7WOLTGam7sB/E2h5C0IZ3MLBy4y70=; b=MVVGX3X1etpYMm 2J8/3JGF9d+ga4KG/JjoMHzhEPWHgKk7TZY535iHAeJoRNcBzRHINv5x99PGxQZku0ALecifcDHYY Mg2GZcRRmsHFNtUZDnW0bhZrAP5YyQ5TVO5Faia8Lf3xbfUvbudfYBhzW6o1d/s7usLvyFeF4J0Lk 4m2+R/XeeNUkDk+XPKdC0amhtwA0cmiv+8cvyUizVZtw6xYzNEuLmnPEYWaje26MLFRnW7CWM65JN PxpqTXT6HaM/0xMu2ZvUKwfvnLPhUv/7nMb3BQ8VJDuNJ+iO8z4s9N0jvlZfzinmuVpzvkwMfF55V 7cw8iLe3CBBS1fNjXpDw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7J6-0000Vv-AN; Thu, 01 Nov 2018 07:22:20 +0000 Received: from mail-lj1-f194.google.com ([209.85.208.194]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gI7J1-0000PD-GD for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2018 07:22:18 +0000 Received: by mail-lj1-f194.google.com with SMTP id z80-v6so11113728ljb.8 for ; Thu, 01 Nov 2018 00:22:05 -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=Mlv80Bmsckxs7OkDOKnzvH3a6DaYFvJ02ZIfgZhY6ibfO2UXlbY4w7T8kCJ9t4XXDu n7pE1TxnElG6ca36OaYZtInBZhho+QSGcjalf/25hZROeoT8+BRg7M3VHUqLHk0zmy67 a0lqQVhaVxbkh/4QXsOmbnceCjm6yq1hzPnCh9e9731qYMcCtTW56+R5ns2wTAdsNUQv wHHBABLacosEzrHBu5c8CGMhQv31Mc18mC8nbGx3D5vtiFqG6Ziu4Bx1rwA8ihThS/ao 6sjp9RMqrwqi92YG525Pq+8+gUj+7RpmnjkKaW/UBO78P/DD1NEbtj7pyok9VPkuopOe 6qIw== X-Gm-Message-State: AGRZ1gJ6D7OUMKU5avmXh0/dCh8HnmgqlsjXpDRVXBFEcx8S4Dlv6QCW GWZcyy+8htvsf0xk0y+Lvgs= 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 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181101_002215_624676_0B7391CA X-CRM114-Status: GOOD ( 15.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, matti.vaittinen@fi.rohmeurope.com, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }