From patchwork Fri Jan 1 16:54:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355900 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FBD2C43331 for ; Fri, 1 Jan 2021 16:56:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 198F422241 for ; Fri, 1 Jan 2021 16:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727359AbhAAQ4p (ORCPT ); Fri, 1 Jan 2021 11:56:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727297AbhAAQ4o (ORCPT ); Fri, 1 Jan 2021 11:56:44 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E495C061757; Fri, 1 Jan 2021 08:56:04 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id n3so3609649pjm.1; Fri, 01 Jan 2021 08:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OISCRAIgQmaekeb9pf1t/tmPDqoCnBDMBSksrG4GFjQ=; b=SdIQDlcoDtgHtyDHDnSCVrgkjZUXLuGMDtJBgcxPckF3bM3N7WFG+QUvJvtKkQn8FB 0XOT8LcmsVwrgSwqZBQD5A3Fk5y4rpO6RMOthoajgzuYMlfHV8PbAg1ISwDfizb0E1Dx RFJXJXXDg2jboqZzG7Uor5ZyG8At4d8RnMDBue4iAX/IWH4tvHrabbwlppogJ2+LUVVS XOsiNRcEI/PNPQks0BJRVln6KmJYtEjsnCWuFZFF0kjmZKfW0DoUMlyYEdd7x3LnkJbE RIh27d2EFEpoA1RZkAm8iwXAVHMkuoEblNhw/kRM1uUdR333xCx9fkNzAVyNHkm58jqW zlaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OISCRAIgQmaekeb9pf1t/tmPDqoCnBDMBSksrG4GFjQ=; b=Uae/hCqWHJj9ABXF7MlyW50z08lbsLLZTVtSJrX8Kix8U/T4Hg1tKkUglU+7nLqRyr zbHAdkCnEvkTZVFuX42G3RfA3EeiDkw6kTY6dG68iWEgPS8SW1+0xgcKtbKRaCqpyp+q pzGonpfG8FeENJZg7QlfsYZKlopvqwP8Gz+A/Oq55r3NhIP3TdQYPkoN5Q7SRZB+7bSr zF9G0qWJQIbAXADkIntRV9eBlJziN4/cf7EtFJcIxigrruETLIggYZCp7P30ZEd7P6Zh g8V4pQYuDDITIYmfylEAdZxyUq0GMIj6CNGOEQtSrJgGvPE9CcgO95TcHc28sxp9/Hu1 YyFw== X-Gm-Message-State: AOAM530FwGTgx1jFEZ/s+SiIDsYR65/u2OMkzvctBeSnHkW+gx1W0MyQ 31Fx18xP9H0jFLfTXOJnmFQ= X-Google-Smtp-Source: ABdhPJwjb4xwfxDXKA1dorvp6qFeN5ipKmunmnSI1p5KjVMGdvQDbupPU2QPQakI04ZRhL5vbcnZWA== X-Received: by 2002:a17:90b:46ca:: with SMTP id jx10mr18747568pjb.208.1609520163922; Fri, 01 Jan 2021 08:56:03 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:56:03 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 02/31] opp: Add devres wrapper for dev_pm_opp_set_regulators and dev_pm_opp_put_regulators Date: Fri, 1 Jan 2021 16:54:38 +0000 Message-Id: <20210101165507.19486-3-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add devres wrapper for dev_pm_opp_set_regulators() dev_pm_opp_put_regulators () to simplify driver code. Signed-off-by: Yangtao Li --- drivers/opp/core.c | 50 ++++++++++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 9 ++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 53fdf33732d5..8709689a7152 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1878,6 +1878,56 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) } EXPORT_SYMBOL_GPL(dev_pm_opp_put_regulators); +static void devm_pm_opp_regulators_release(void *data) +{ + dev_pm_opp_put_regulators(data); +} + +/** + * devm_pm_opp_set_regulators() - Set regulator names for the device + * @dev: Device for which regulator name is being set. + * @names: Array of pointers to the names of the regulator. + * @count: Number of regulators. + * + * In order to support OPP switching, OPP layer needs to know the name of the + * device's regulators, as the core would be required to switch voltages as + * well. + * + * This must be called before any OPPs are initialized for the device. + * + * The opp_table structure will be freed after the device is destroyed. + */ +struct opp_table *devm_pm_opp_set_regulators(struct device *dev, + const char * const names[], + unsigned int count) +{ + struct opp_table *opp_table; + int err; + + opp_table = dev_pm_opp_set_regulators(dev, names, count); + if (IS_ERR(opp_table)) + return opp_table; + + err = devm_add_action_or_reset(dev, devm_pm_opp_regulators_release, + opp_table); + if (err) + opp_table = ERR_PTR(err); + + return opp_table; +} +EXPORT_SYMBOL_GPL(devm_pm_opp_set_regulators); + +/** + * devm_pm_opp_put_regulators() - Releases resources blocked for regulator + * @dev: Device for which we do this operation. + * @opp_table: OPP table returned from dev_pm_opp_set_regulators(). + */ +void devm_pm_opp_put_regulators(struct device *dev, struct opp_table *opp_table) +{ + devm_release_action(dev, devm_pm_opp_regulators_release, opp_table); +} +EXPORT_SYMBOL_GPL(devm_pm_opp_put_regulators); + /** * dev_pm_opp_set_clkname() - Set clk name for the device * @dev: Device for which clk name is being set. diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 3418a2874f88..8a329247e08e 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -143,6 +143,8 @@ struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name) void dev_pm_opp_put_prop_name(struct opp_table *opp_table); struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count); void dev_pm_opp_put_regulators(struct opp_table *opp_table); +struct opp_table *devm_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count); +void devm_pm_opp_put_regulators(struct device *dev, struct opp_table *opp_table); struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name); void dev_pm_opp_put_clkname(struct opp_table *opp_table); struct opp_table *devm_pm_opp_set_clkname(struct device *dev, const char *name); @@ -321,6 +323,13 @@ static inline struct opp_table *dev_pm_opp_set_regulators(struct device *dev, co static inline void dev_pm_opp_put_regulators(struct opp_table *opp_table) {} +static inline struct opp_table *devm_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count) +{ + return ERR_PTR(-ENOTSUPP); +} + +static inline void devm_pm_opp_put_regulators(struct device *dev, struct opp_table *opp_table) {} + static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name) { return ERR_PTR(-ENOTSUPP); From patchwork Fri Jan 1 16:54:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355899 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59D20C07208 for ; Fri, 1 Jan 2021 16:57:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3991C2222D for ; Fri, 1 Jan 2021 16:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727460AbhAAQ5W (ORCPT ); Fri, 1 Jan 2021 11:57:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727119AbhAAQ5V (ORCPT ); Fri, 1 Jan 2021 11:57:21 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB08CC061575; Fri, 1 Jan 2021 08:56:41 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id e2so14740566pgi.5; Fri, 01 Jan 2021 08:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ubat3ts9FbAfreFZfiBfut7K86ikhtjfvpeWs7xXMEk=; b=J5Zl7BAcXm9OBOmHsB2ywSPSsP5FyZj1mInI7jaePvK/deKaOXY52OkOvVeosQOjvB Lu5eaT0gNcc3bMY/D726LmsCh2ZIqnZkqhVX37tsTZXLaF5xdxDt9+GfEOVXqG4LxgYs nTu+zD+7L4yuzwEQIf/LJU/XCkKUN1sJeew8plRjO8SesIOJG5jQoI5LhgWWW31YtGhG 4YETODXP4Vo4nCl69trrf/MrslK+223YUxnjeqXbO+6blM4l4ZV0m7l48z+6MWyVh2ON /W0RqVC22XG9g6zBhvd0aItkxM5G4b/s2yFfsQ2A0RjaGj5zZ0qY991dz1LAc7uZMT6L +R3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ubat3ts9FbAfreFZfiBfut7K86ikhtjfvpeWs7xXMEk=; b=cgUtPkWwDZzfc2vpxpaQQYgDL2ZnC4tSW7b+o0F0GUGjPd8qrtSGesHwzcQmVbwE1h lIvejYOuApMjLpCeUY5SLnNGgSg3j4NpaPR+P9YVxMKFuwAVE+Pw2zTcSc+hYWu57aYK iDRJtf5XUKbmXgOQjRrjjG/yigfTO6T+FoQ0M7hG6XCim74+QTSAJUR+b5fzWJBD7tA2 T+PhqdVEtmuEpXNkQKvlu5+EbBmcq7dQ5etidNC69I1jRszRw/PMHxmj1Lgkg5JdWJxA H+1s/K/ysM+qP0hpCiHN/6EsfgAcMlF9CBO/l2oTfSRgblXp97hmmoT9ua681bIel24w qv4g== X-Gm-Message-State: AOAM531pQy4KyT9mAHt3S5AC1qwBRiXaVXXsOfTU8ewVKZXluL8/TxqW Q8mRchWd+AhxOekmNMKprMI= X-Google-Smtp-Source: ABdhPJwYfspmIkGNgMSm1eZOYHmkHpx4SDoHG3+f04ZQo0UnHylmSn2hZZkZjzhdjSLhB9FfLgcUEw== X-Received: by 2002:a63:804a:: with SMTP id j71mr60757814pgd.307.1609520201310; Fri, 01 Jan 2021 08:56:41 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:56:40 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 05/31] opp: Add devres wrapper for dev_pm_opp_register_notifier Date: Fri, 1 Jan 2021 16:54:41 +0000 Message-Id: <20210101165507.19486-6-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add devres wrapper for dev_pm_opp_register_notifier() to simplify driver code. Signed-off-by: Yangtao Li --- drivers/opp/core.c | 38 ++++++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 6b83e373f0d8..ef3544f8cecd 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2599,6 +2599,44 @@ int dev_pm_opp_unregister_notifier(struct device *dev, } EXPORT_SYMBOL(dev_pm_opp_unregister_notifier); +static void devm_pm_opp_notifier_release(struct device *dev, void *res) +{ + struct notifier_block *nb = *(struct notifier_block **)res; + + WARN_ON(dev_pm_opp_unregister_notifier(dev, nb)); +} + +/** + * devm_pm_opp_register_notifier() - Register OPP notifier for the device + * @dev: Device for which notifier needs to be registered + * @nb: Notifier block to be registered + * + * Return: 0 on success or a negative error value. + * + * The notifier will be unregistered after the device is destroyed. + */ +int devm_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb) +{ + struct notifier_block **ptr; + int ret; + + ptr = devres_alloc(devm_pm_opp_notifier_release, sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return -ENOMEM; + + ret = dev_pm_opp_register_notifier(dev, nb); + if (ret) { + devres_free(ptr); + return ret; + } + + *ptr = nb; + devres_add(dev, ptr); + + return 0; +} +EXPORT_SYMBOL(devm_pm_opp_register_notifier); + /** * dev_pm_opp_remove_table() - Free all OPPs associated with the device * @dev: device pointer used to lookup OPP table. diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index e8bdac5f9555..c24bd34339d7 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -136,6 +136,7 @@ int dev_pm_opp_disable(struct device *dev, unsigned long freq); int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb); int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb); +int devm_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb); struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count); void dev_pm_opp_put_supported_hw(struct opp_table *opp_table); @@ -288,6 +289,11 @@ static inline int dev_pm_opp_register_notifier(struct device *dev, struct notifi return -ENOTSUPP; } +static inline int devm_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb) +{ + return -ENOTSUPP; +} + static inline int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb) { return -ENOTSUPP; From patchwork Fri Jan 1 16:54:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355898 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C316C4332B for ; Fri, 1 Jan 2021 16:58:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AB8A221F2 for ; Fri, 1 Jan 2021 16:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727486AbhAAQ5f (ORCPT ); Fri, 1 Jan 2021 11:57:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbhAAQ5e (ORCPT ); Fri, 1 Jan 2021 11:57:34 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4BCC061757; Fri, 1 Jan 2021 08:56:54 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id y8so11248142plp.8; Fri, 01 Jan 2021 08:56:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9TIzmHgFsG6ITKjqTU0zZgw5fpm5ANHtZbVrmANAAI0=; b=nb6EiLBe1rK90KNqgI7Tblud+L8ORicNaxgYlOLpDnSDma8JhPbC+sE0K6N9WC6lCg e0wL0DyJ0iWBTM1v87pA6uoSqvkJSZrAVAd3hIOEOLdC5KQUZg8H7rgObvKQIKILT5BL dYW8qJYXrH/0Dd1tFkT/FQp/UhNxQMBedmIaVPARfPPF2GXQ8jYhin3DOm6mcu8X8Ly5 3kX1oKS5TkXd/hSFBZvPsJ6xHQI5RKSk3QL9IyGt2d2ZKzUiG9ZinPumxn7CPr3QunRI r31onRRx20ggyZxF+1eTR7PdiMUAks1Bd1qNwCzQYV2lkPBFhUHbIOULPhYiCySuuNsz i5mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9TIzmHgFsG6ITKjqTU0zZgw5fpm5ANHtZbVrmANAAI0=; b=Ty9zv+uB/zO6ctMabFSgQs4QUCLcIXfzX2E6bbfbXUqCZzfM8wX+zgUuSsvaA0O0YK 4A0VTMhrGiqtMk7iFfzDdzVjP5N2qokZ5XT6ctBWtYL2P7aUmJbGxSDUk6lDJgikK9+l c8ndt+1umAsTSsvd2eJLYTzMe0TP8juZt/3ipuwIvLdQ8qb/G6x9R5v4ldjrs41daDIX G9IyyMZd7jxzihEuhQEIADwPj084yr6hU92d6HaG+Xo9GvEGX0XfHQOI9Fvzzh6prvsy lkfGmjV1TchrQw4iAvDtH48NTgh6JFSlz9dakcU66HSjH0Jb9cg213/bgOi2FyZpOREP 2Zrw== X-Gm-Message-State: AOAM53164loikawrJ5N+92q/Cor9jcltm/MbhM5rUCDc8JYlhSa5ouc8 NPziT0RfUx60xsaFXWart5k= X-Google-Smtp-Source: ABdhPJxF4JOJ2XJhhjVVExcwCvFxLYoAt6vZHBBSIOTAC4TphoEUsVxfStvnXrBY+Pi7P/mH2L3ddA== X-Received: by 2002:a17:90a:fb43:: with SMTP id iq3mr18956764pjb.175.1609520213736; Fri, 01 Jan 2021 08:56:53 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:56:53 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 06/31] serial: qcom_geni_serial: fix potential mem leak in qcom_geni_serial_probe() Date: Fri, 1 Jan 2021 16:54:42 +0000 Message-Id: <20210101165507.19486-7-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We should use dev_pm_opp_put_clkname() to free opp table each time dev_pm_opp_of_add_table() got error. Signed-off-by: Yangtao Li --- drivers/tty/serial/qcom_geni_serial.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 291649f02821..5aada7ebae35 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1438,9 +1438,12 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) return PTR_ERR(port->se.opp_table); /* OPP table is optional */ ret = dev_pm_opp_of_add_table(&pdev->dev); - if (ret && ret != -ENODEV) { - dev_err(&pdev->dev, "invalid OPP table in device tree\n"); - goto put_clkname; + if (ret) { + dev_pm_opp_put_clkname(port->se.opp_table); + if (ret != -ENODEV) { + dev_err(&pdev->dev, "invalid OPP table in device tree\n"); + return ret; + } } port->private_data.drv = drv; @@ -1482,7 +1485,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) return 0; err: dev_pm_opp_of_remove_table(&pdev->dev); -put_clkname: dev_pm_opp_put_clkname(port->se.opp_table); return ret; } From patchwork Fri Jan 1 16:54:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355897 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18ED7C43381 for ; Fri, 1 Jan 2021 16:58:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC1502222F for ; Fri, 1 Jan 2021 16:58:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727562AbhAAQ6A (ORCPT ); Fri, 1 Jan 2021 11:58:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbhAAQ57 (ORCPT ); Fri, 1 Jan 2021 11:57:59 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FD8FC061573; Fri, 1 Jan 2021 08:57:19 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id i7so14725939pgc.8; Fri, 01 Jan 2021 08:57:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IV2zNN3s1AfACJeGsDqVwWi6DEirf5Jq6E3RccO1dz8=; b=Ai8tnh7FMLxYYFLHaBhX5U6plgk8yhFEVGcLAKcddIq/0TVgcrpzZlg95rL7L7JQzo xST9xnE0y1v7ro1sygyEU6gkm1UtSO1wlSNkgfcKBZhCkneMeuSV2a2fn+r3SH7+Z9Kf d5fc3BhOXaZ6s/w83nR2KkEYf/kBn1YMGyYiXbSNnTejHWb/cvihI1/KOJatQq18IfpH YciVBMjoCWz9icOJYX8NTbWzv2JQwhulBP2HhprEg2tGwIm2r00qCdU1qoGEOJlfw++G sPXzbA58an1PsZE3WtwYRI4r+xsTJ8YSWVwRticDxU9HakPD15nl+uvJCHGFig/gQmrV l7bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IV2zNN3s1AfACJeGsDqVwWi6DEirf5Jq6E3RccO1dz8=; b=GVONkCunNWUJvbRQiSa8LPBG17R2pzHYdeL9t7JAkz+unwTGODkk9ISMpyV8jEElCK 9vIzDlBSP+HyLlPRZe1hytK6tB6C0bttArd/5hGQN2AltK/AfQXpmhaasqE8/lF03POw 0ny+RBwAAOPvAnB/L0LoqMlF7qFxTDgUJtEtDUu3rgpIrRcbohTZYmLnnE6PLJQPpwzf XXjdyu+8G5uIqWlmN2fHbODhJ9ZOQiv1dB1I8/QUfxr6j8mjuoOgHTBB1fkG0fQIGz4G ahQQiq97azym8HNB9GEm81Oxfwu0N0B8D2Kkb6oSSBhshS/FYDRtAEZoB6hz6BNOErb5 H5gA== X-Gm-Message-State: AOAM533gfsIYgbVOtxFXH4AEFuNC5foKwfkxQck8aFYSwQ9LgN+c1X5+ QdIbuHkfyYSaSxVo1KWRI68= X-Google-Smtp-Source: ABdhPJxTg/RBi911Rlkg8zUKuFA1fjgLtPzwql4Vs33cJaLZwo97jJ74E4kLqBotEgBqj10cnqCjdQ== X-Received: by 2002:a63:5526:: with SMTP id j38mr13794107pgb.177.1609520238832; Fri, 01 Jan 2021 08:57:18 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:57:18 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 08/31] spi: spi-qcom-qspi: fix potential mem leak in spi_geni_probe() Date: Fri, 1 Jan 2021 16:54:44 +0000 Message-Id: <20210101165507.19486-9-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We should use dev_pm_opp_put_clkname() to free opp table each time dev_pm_opp_of_add_table() got error. Signed-off-by: Yangtao Li Acked-by: Mark Brown --- drivers/spi/spi-geni-qcom.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c index 512e925d5ea4..2b5a164fecb9 100644 --- a/drivers/spi/spi-geni-qcom.c +++ b/drivers/spi/spi-geni-qcom.c @@ -620,9 +620,12 @@ static int spi_geni_probe(struct platform_device *pdev) return PTR_ERR(mas->se.opp_table); /* OPP table is optional */ ret = dev_pm_opp_of_add_table(&pdev->dev); - if (ret && ret != -ENODEV) { - dev_err(&pdev->dev, "invalid OPP table in device tree\n"); - goto put_clkname; + if (ret) { + dev_pm_opp_put_clkname(mas->se.opp_table); + if (ret != -ENODEV) { + dev_err(&pdev->dev, "invalid OPP table in device tree\n"); + return ret; + } } spi->bus_num = -1; @@ -675,7 +678,6 @@ static int spi_geni_probe(struct platform_device *pdev) spi_geni_probe_runtime_disable: pm_runtime_disable(dev); dev_pm_opp_of_remove_table(&pdev->dev); -put_clkname: dev_pm_opp_put_clkname(mas->se.opp_table); return ret; } From patchwork Fri Jan 1 16:54:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355896 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74E94C433E0 for ; Fri, 1 Jan 2021 16:59:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4483E22203 for ; Fri, 1 Jan 2021 16:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727659AbhAAQ6Z (ORCPT ); Fri, 1 Jan 2021 11:58:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727655AbhAAQ6Y (ORCPT ); Fri, 1 Jan 2021 11:58:24 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17733C061757; Fri, 1 Jan 2021 08:57:44 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id lj6so6298080pjb.0; Fri, 01 Jan 2021 08:57:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tiWxikxPuWX5qrSsnG3gylr8SLwIWwlDgkk1TM03GZ8=; b=MnbYXRNcvlxfSbkvfcPK/n4tGcYIzBuapQ7RmCOI8N22yFh7Q4xtFIHESJQjSBaFY8 7ckmMWlwLam1mDcDw7+9zBiuMRRhtBGoJDlbQPI/1aMYW2+IvId/CD2hge4uoPtyKnCL DTFuHKA/o6mIdFmvtA4/xiSgdj8++GrPaXtFLaICWYgvOJzZmCqeQfiA98iutVtmhA6/ /7JaAvxRXdo1s0aIpNDSlNw8iHxAI4oDG6AkAEHgXmmVLNR5Q1KqtZXL6ttQVfl0hQz1 nsDuMCwd9IbchLS308FbcH0V3l4JKXE3idGACIqp1oLXnOPpLsA0ZOHbA1oEg0BVFKGx Vc9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tiWxikxPuWX5qrSsnG3gylr8SLwIWwlDgkk1TM03GZ8=; b=BvFPLEq8a9E6LkaGDY/nhVppAQW1EFmYy9fCuoSbHWahtp7zmCpyRSASMzFp+Qniy3 iyCkJ8Dog52YN+Or/nTHkOgAqLtD76qm1irQ8pCWw7aWDMpLT8VnWvyJotQr7xg4Dlz7 00SAgJLHzaqVJsBcmefM33ZGZ7/raFi1R7ifDXlzzmmMMwrGMeeJtX5ZxRYccmAtxcO3 DiJOSgTz+v7Oe1j0GHZ70Ztn/QAvT227i/vSU9WThAL0Iq5EipYOhkw3cBKOaKQBBFNv 1kI5kR3MOXchQZ0dznKkVnLKiVdT0Djnu6sgVUOwRJWsNOAmcgt5N4dKW6msSW9YndXY gDGw== X-Gm-Message-State: AOAM530sQ0aBaRmaD8vsnQmK08+IMvt26FLdWkknFEwn199ZMYGt8+rH kRxswfZbG6YWxD2Y2PnoIp4= X-Google-Smtp-Source: ABdhPJxz+nZU443EFCLWHTCQctcygBPdBe6EDrDrvOT6er4vAak3Hfyleyc/B7CaVd9ruLyg4w0AZw== X-Received: by 2002:a17:902:c195:b029:db:c725:24d1 with SMTP id d21-20020a170902c195b02900dbc72524d1mr62207622pld.28.1609520263684; Fri, 01 Jan 2021 08:57:43 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:57:43 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 10/31] qcom-geni-se: remove opp_table Date: Fri, 1 Jan 2021 16:54:46 +0000 Message-Id: <20210101165507.19486-11-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org opp_table isn't used anymore, remove it. Signed-off-by: Yangtao Li --- include/linux/qcom-geni-se.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h index ec2ad4b0fe14..cddef864a760 100644 --- a/include/linux/qcom-geni-se.h +++ b/include/linux/qcom-geni-se.h @@ -47,7 +47,6 @@ struct geni_icc_path { * @num_clk_levels: Number of valid clock levels in clk_perf_tbl * @clk_perf_tbl: Table of clock frequency input to serial engine clock * @icc_paths: Array of ICC paths for SE - * @opp_table: Pointer to the OPP table */ struct geni_se { void __iomem *base; @@ -57,7 +56,6 @@ struct geni_se { unsigned int num_clk_levels; unsigned long *clk_perf_tbl; struct geni_icc_path icc_paths[3]; - struct opp_table *opp_table; }; /* Common SE registers */ From patchwork Fri Jan 1 16:54:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355895 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F4160C4321A for ; Fri, 1 Jan 2021 16:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF58A22248 for ; Fri, 1 Jan 2021 16:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727296AbhAAQ6u (ORCPT ); Fri, 1 Jan 2021 11:58:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727143AbhAAQ6t (ORCPT ); Fri, 1 Jan 2021 11:58:49 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 587DBC061573; Fri, 1 Jan 2021 08:58:09 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id x18so11262257pln.6; Fri, 01 Jan 2021 08:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7eakgo8QJNSQOzZIp+kIaMol/JySCEaf1ptbvEAaka0=; b=DHzNSUdvyWGgCdH/SvWiCsESLnMfgYC/Qbc8CIEcqHoxqaru1aKzzfk8A9sBn5wvsG MIDRwm0er7cZAcPNY2mE4+mtDbknzjXm43fnYcOb1U11EgHjgga4/gfufvavm0NBqP+y OcWjBDwLp+tHWtA+pBTwQCQYBVh4pUDGfLh54yMKewA0b7tWVjzCXHs8MuEiMC7Sg4bz Tslq0Xhmjp5WQDk/k4rROsXHti8aAqbazzO5SspRw+obRGrKxd3evdGHYCIGXGR8T0Vb Mf3gIEIos2/O2XKzc9f1WBkkXTA1APCm3M29sv3UqR95xy87Ng0dPz4TIAykuWWOz9D9 xDtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7eakgo8QJNSQOzZIp+kIaMol/JySCEaf1ptbvEAaka0=; b=rR8qaAlMvJfbF/MybotDyAs/YCdgb/fEroA6ZkNx/Zp0n55EHGocnjeqTA+VDYqloJ uNgKeiHhxy5AW3XoZ6qEmHboazKiE3pzSOAycfVbP1GxMFHUSFwtRb540X7c7pI1Ndg7 D4GjM8wk68Ul71/8rb8bj0c1BXoV6CZy4Ibt8At/PwKTYue3f8FjKS0NGK1wvvCVj2gz kYSsb563fEZzU6b8nvCyI+d73Q6dzIR92UwaCiDP1/b29CRHQwz7G+VdfQuryyKFZB4Z Otc2fXpDWh6RAWFWEh4JUrl5La5p3EuRluHFTdfa3yfWPimdidhWs5JWOIRXS2ReYbEp WSAQ== X-Gm-Message-State: AOAM5310SqVau4yqnMd2zm8glNnC3SIFeAc5bBOe5lyeA5ULqJkQMqqE 72ujDoMt9u14OwaF4NOwlLQ= X-Google-Smtp-Source: ABdhPJxj836hq8IHDM7wBHmGNMR++3q92xi77JSpCMFpBgRNCI8v5QOGIWumKF44tZ/O5Tx8//m4QA== X-Received: by 2002:a17:90b:4b0a:: with SMTP id lx10mr18398745pjb.205.1609520288920; Fri, 01 Jan 2021 08:58:08 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:58:08 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 12/31] mmc: sdhci-msm: convert to use devm_pm_opp_* API Date: Fri, 1 Jan 2021 16:54:48 +0000 Message-Id: <20210101165507.19486-13-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use devm_pm_opp_* API to simplify code, and remove opp_table from sdhci_msm_host. Signed-off-by: Yangtao Li --- drivers/mmc/host/sdhci-msm.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 094ef95f5ecc..490ba5d68f72 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -261,7 +261,6 @@ struct sdhci_msm_host { struct clk_bulk_data bulk_clks[4]; /* core, iface, cal, sleep clocks */ unsigned long clk_rate; struct mmc_host *mmc; - struct opp_table *opp_table; bool use_14lpp_dll_reset; bool tuning_done; bool calibration_done; @@ -2215,6 +2214,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) const struct sdhci_msm_offset *msm_offset; const struct sdhci_msm_variant_info *var_info; struct device_node *node = pdev->dev.of_node; + struct opp_table *opp_table; host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, sizeof(*msm_host)); if (IS_ERR(host)) @@ -2283,16 +2283,16 @@ static int sdhci_msm_probe(struct platform_device *pdev) if (ret) goto bus_clk_disable; - msm_host->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core"); - if (IS_ERR(msm_host->opp_table)) { - ret = PTR_ERR(msm_host->opp_table); + opp_table = devm_pm_opp_set_clkname(&pdev->dev, "core"); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); goto bus_clk_disable; } /* OPP table is optional */ - ret = dev_pm_opp_of_add_table(&pdev->dev); + ret = devm_pm_opp_of_add_table(&pdev->dev); if (ret) { - dev_pm_opp_put_clkname(msm_host->opp_table); + devm_pm_opp_put_clkname(&pdev->dev, opp_table); if (ret != -ENODEV) { dev_err(&pdev->dev, "Invalid OPP table in Device tree\n"); goto bus_clk_disable; @@ -2317,7 +2317,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks), msm_host->bulk_clks); if (ret) - goto opp_cleanup; + goto bus_clk_disable; /* * xo clock is needed for FLL feature of cm_dll. @@ -2462,9 +2462,6 @@ static int sdhci_msm_probe(struct platform_device *pdev) clk_disable: clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), msm_host->bulk_clks); -opp_cleanup: - dev_pm_opp_of_remove_table(&pdev->dev); - dev_pm_opp_put_clkname(msm_host->opp_table); bus_clk_disable: if (!IS_ERR(msm_host->bus_clk)) clk_disable_unprepare(msm_host->bus_clk); @@ -2483,8 +2480,6 @@ static int sdhci_msm_remove(struct platform_device *pdev) sdhci_remove_host(host, dead); - dev_pm_opp_of_remove_table(&pdev->dev); - dev_pm_opp_put_clkname(msm_host->opp_table); pm_runtime_get_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); From patchwork Fri Jan 1 16:54:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355894 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DBD1C4360C for ; Fri, 1 Jan 2021 16:59:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B0D0221FE for ; Fri, 1 Jan 2021 16:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727753AbhAAQ7P (ORCPT ); Fri, 1 Jan 2021 11:59:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727230AbhAAQ7O (ORCPT ); Fri, 1 Jan 2021 11:59:14 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F5A5C061757; Fri, 1 Jan 2021 08:58:34 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id g15so14726065pgu.9; Fri, 01 Jan 2021 08:58:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yu74XuJH53c+EXvKWMencH3rXiKT1m6r0c1T0r676aY=; b=gh7RvhL62o/PSCpktmhn3EbfQ3dx1vvB+ZmqES+Jmm88swPVRtVyFOvVd2bYWOik29 Tf2nXsdUR5mBpBYKLAXO6pceBAG+flQxPB2Jvy/vdpPe3hCYniRi2wVmyV6KljZidpIl 7+ltUJSpOwmtrH+3uiSBW1XTFeAjnSeKy5Fhyn0mp8bJVgc1G0rxRm3FH1HR+zomceOW w/Zi0Kk1vApmR2ie30W9zO5+3nbEioG2IGELTxjHbYMIIzvzfngUncqFIwWUdgMXjiuU fmsVVrQWwoVQ40dUogwxdGBv2W0LcV1L+5Mgk0jrMk35BclmJuKCV9DZPpWeM4+osSWT pGUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yu74XuJH53c+EXvKWMencH3rXiKT1m6r0c1T0r676aY=; b=q97Bj3IZGTqoz+JoHnpVbgCImEHTdo62xMnIA55A4cKH8HbwqI+21Oj0Y0XkD1T20f aewQwUu4p78zO1LfYAyYNMK2AtdMOpbmnS1fv7dmIczrzWyjfvu9WPK+3yAZpAI36S3Z 8BQNVNOu3F52086Lv2/zXSXyBVOv+q477uPBUxNwsyXNd8l72dPSXfppsjILWD8pkQCp aKLD6ChgDI1VDOdaiyI2c+YKaNT3OC67LeJW2+wRbxWrAt9dPTYea2CFd3w5blNeLeph FwO7Qd/r8zl2/FzJUJCCOP47p5JH1WnUz+b2ALOh9VMqsv+2cKZKzZYqjSghxiZ1bNo/ ogMA== X-Gm-Message-State: AOAM531u+RToJ+aUjpG7Qtp0gaMSz5zfM/y+iTazD9NfPTawzhBUegyv VnJ/xYCP3p0bp1852nQ7RgQ= X-Google-Smtp-Source: ABdhPJwOll/dMiWiDKZQBDwgbOKq3kdz6aVDzq67HtJRRsr7Oec5o4g1+GYjXRy8liLw+XYioZ4FhQ== X-Received: by 2002:a63:5023:: with SMTP id e35mr61063976pgb.56.1609520313911; Fri, 01 Jan 2021 08:58:33 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:58:33 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 14/31] spi: spi-qcom-qspi: convert to use devm_pm_opp_* API Date: Fri, 1 Jan 2021 16:54:50 +0000 Message-Id: <20210101165507.19486-15-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use devm_pm_opp_* API to simplify code, and remove opp_table from qcom_qspi. Signed-off-by: Yangtao Li Acked-by: Mark Brown --- drivers/spi/spi-qcom-qspi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c index 915ae115d8c1..1a1ab153ff59 100644 --- a/drivers/spi/spi-qcom-qspi.c +++ b/drivers/spi/spi-qcom-qspi.c @@ -142,7 +142,6 @@ struct qcom_qspi { struct clk_bulk_data *clks; struct qspi_xfer xfer; struct icc_path *icc_path_cpu_to_qspi; - struct opp_table *opp_table; unsigned long last_speed; /* Lock to protect data accessed by IRQs */ spinlock_t lock; @@ -459,6 +458,7 @@ static int qcom_qspi_probe(struct platform_device *pdev) struct device *dev; struct spi_master *master; struct qcom_qspi *ctrl; + struct opp_table *opp_table; dev = &pdev->dev; @@ -531,13 +531,13 @@ static int qcom_qspi_probe(struct platform_device *pdev) master->handle_err = qcom_qspi_handle_err; master->auto_runtime_pm = true; - ctrl->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core"); - if (IS_ERR(ctrl->opp_table)) - return PTR_ERR(ctrl->opp_table); + opp_table = devm_pm_opp_set_clkname(dev, "core"); + if (IS_ERR(opp_table)) + return PTR_ERR(opp_table); /* OPP table is optional */ - ret = dev_pm_opp_of_add_table(&pdev->dev); + ret = devm_pm_opp_of_add_table(dev); if (ret) { - dev_pm_opp_put_clkname(ctrl->opp_table); + devm_pm_opp_put_clkname(dev, opp_table); if (ret != -ENODEV) { dev_err(&pdev->dev, "invalid OPP table in device tree\n"); return ret; @@ -553,8 +553,6 @@ static int qcom_qspi_probe(struct platform_device *pdev) return 0; pm_runtime_disable(dev); - dev_pm_opp_of_remove_table(&pdev->dev); - dev_pm_opp_put_clkname(ctrl->opp_table); return ret; } @@ -568,8 +566,6 @@ static int qcom_qspi_remove(struct platform_device *pdev) spi_unregister_master(master); pm_runtime_disable(&pdev->dev); - dev_pm_opp_of_remove_table(&pdev->dev); - dev_pm_opp_put_clkname(ctrl->opp_table); return 0; } From patchwork Fri Jan 1 16:54:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1E1EC4361A for ; Fri, 1 Jan 2021 16:59:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1B41221FE for ; Fri, 1 Jan 2021 16:59:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727792AbhAAQ7k (ORCPT ); Fri, 1 Jan 2021 11:59:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727213AbhAAQ7j (ORCPT ); Fri, 1 Jan 2021 11:59:39 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4876EC061573; Fri, 1 Jan 2021 08:58:59 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id b5so6772825pjk.2; Fri, 01 Jan 2021 08:58:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=d0MeQ6bYLtbPcxoPQlZFc3ic9eUjEeCkrstTXoX/svQ=; b=HAmdTHbj5KTn/8LyhESYVv8JE6FMzRlAkEB1db1RQttKdpr46a56BQdfYTw8JN7NGg nO8c6DAZE2viWIBzXRXLbANRuvpUdJZ4abRv0qHtpyj8cupXUGdcVES8REhggy5mJ1DS /SvqAlmLtRV7QRceQZtwahiWWz6ymNuzDODXAxX8770i87k8+/gajOdswWQ0y7SdRIkY /5u21r/3w+J60Ti2zUB9v14hew8q/5Pt1Bz3qclZH2mp6pSqCOoTdCgkLbF5TQbn7m5i UALh+YnLg8UINoPjD92g0i4mamXY+OPuF5S4YM6u991nZWSocAo0j45tQdccFgRyACuQ wy3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d0MeQ6bYLtbPcxoPQlZFc3ic9eUjEeCkrstTXoX/svQ=; b=NjMvDDlgqQyU+HuVKbicGP8Q8MSv9jiI+pVv0GkZt1Vd0hYPz636ltbCh/9xXqicff AJu0mN0l3mDwslQCYtUr24irQ4YvHKavPvH2CYNJRh+xA85Ts49exATKKlA+ThS4Styg 062VC5wySSNzLplidms9DyMGIH3j6wQfx5COKyhAWutg7okM+vIpMkHZznZweHtzEMBd +Sg8NvqyGet1UTMs8plyrSlDw/TBC7avKDmUjzMSp3W9Z+zdYIQRAN+CBg1kEhoaCI9j ROBfb/zK+I9vUq95JXe+oJILr2p8Z60v+eI209M848lJ5HHq982BC9ITm0FQDymyIhJ8 Jlng== X-Gm-Message-State: AOAM532evJUR8Th/kx9HRem/mrx7SyZHujrHE8R6oluMEOqZE7/2NXjV sqAIWFijmqKvXulvFeplZy8= X-Google-Smtp-Source: ABdhPJwLT40/cdQZVPfecrvJ0EfyqQq30J2h7Pf5a16H46Pl2j7y17c6pU10FoFKACrkriwNvo+nDA== X-Received: by 2002:a17:902:ed45:b029:da:c274:d7ac with SMTP id y5-20020a170902ed45b02900dac274d7acmr61615241plb.69.1609520338834; Fri, 01 Jan 2021 08:58:58 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:58:58 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 16/31] drm/msm: convert to use devm_pm_opp_* API and remove dp_ctrl_put Date: Fri, 1 Jan 2021 16:54:52 +0000 Message-Id: <20210101165507.19486-17-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 1. Use devm_pm_opp_* to simplif code and avoid mem leak. 2. Remove opp_table from dpu_kms, dp_ctrl_private and msm_dsi_host, since it does not need a global scope. 3. Remove dp_ctrl_put. Signed-off-by: Yangtao Li --- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 2 +- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 23 ++++++++------------ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 2 -- drivers/gpu/drm/msm/dp/dp_ctrl.c | 29 ++++++------------------- drivers/gpu/drm/msm/dp/dp_ctrl.h | 1 - drivers/gpu/drm/msm/dp/dp_display.c | 5 +---- drivers/gpu/drm/msm/dsi/dsi_host.c | 15 +++++-------- 9 files changed, 26 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c index a5af223eaf50..47e51c632209 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c @@ -1560,7 +1560,7 @@ static void check_speed_bin(struct device *dev) nvmem_cell_put(cell); } - dev_pm_opp_set_supported_hw(dev, &val, 1); + devm_pm_opp_set_supported_hw(dev, &val, 1); } struct msm_gpu *a5xx_gpu_init(struct drm_device *dev) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index e6703ae98760..bd159e6fac5a 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1321,7 +1321,7 @@ static int a6xx_gmu_pwrlevels_probe(struct a6xx_gmu *gmu) * The GMU handles its own frequency switching so build a list of * available frequencies to send during initialization */ - ret = dev_pm_opp_of_add_table(gmu->dev); + ret = devm_pm_opp_of_add_table(gmu->dev); if (ret) { DRM_DEV_ERROR(gmu->dev, "Unable to set the OPP table for the GMU\n"); return ret; diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index 6cf9975e951e..e6c446c436e3 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c @@ -845,7 +845,7 @@ static void adreno_get_pwrlevels(struct device *dev, if (!of_find_property(dev->of_node, "operating-points-v2", NULL)) ret = adreno_get_legacy_pwrlevels(dev); else { - ret = dev_pm_opp_of_add_table(dev); + ret = devm_pm_opp_of_add_table(dev); if (ret) DRM_DEV_ERROR(dev, "Unable to set the OPP table\n"); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 6f19dfcb4965..cb7e4fddf268 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1082,19 +1082,20 @@ static int dpu_bind(struct device *dev, struct device *master, void *data) struct msm_drm_private *priv = ddev->dev_private; struct dpu_kms *dpu_kms; struct dss_module_power *mp; + struct opp_table *opp_table; int ret = 0; dpu_kms = devm_kzalloc(&pdev->dev, sizeof(*dpu_kms), GFP_KERNEL); if (!dpu_kms) return -ENOMEM; - dpu_kms->opp_table = dev_pm_opp_set_clkname(dev, "core"); - if (IS_ERR(dpu_kms->opp_table)) - return PTR_ERR(dpu_kms->opp_table); + opp_table = devm_pm_opp_set_clkname(dev, "core"); + if (IS_ERR(opp_table)) + return PTR_ERR(opp_table); /* OPP table is optional */ - ret = dev_pm_opp_of_add_table(dev); + ret = devm_pm_opp_of_add_table(dev); if (ret) { - dev_pm_opp_put_clkname(dpu_kms->opp_table); + devm_pm_opp_put_clkname(dev, opp_table); if (ret != -ENODEV) { dev_err(dev, "invalid OPP table in device tree\n"); return ret; @@ -1105,7 +1106,7 @@ static int dpu_bind(struct device *dev, struct device *master, void *data) ret = msm_dss_parse_clock(pdev, mp); if (ret) { DPU_ERROR("failed to parse clocks, ret=%d\n", ret); - goto err; + return ret; } platform_set_drvdata(pdev, dpu_kms); @@ -1113,7 +1114,7 @@ static int dpu_bind(struct device *dev, struct device *master, void *data) ret = msm_kms_init(&dpu_kms->base, &kms_funcs); if (ret) { DPU_ERROR("failed to init kms, ret=%d\n", ret); - goto err; + return ret; } dpu_kms->dev = ddev; dpu_kms->pdev = pdev; @@ -1122,10 +1123,7 @@ static int dpu_bind(struct device *dev, struct device *master, void *data) dpu_kms->rpm_enabled = true; priv->kms = &dpu_kms->base; - return ret; -err: - dev_pm_opp_of_remove_table(dev); - dev_pm_opp_put_clkname(dpu_kms->opp_table); + return ret; } @@ -1141,9 +1139,6 @@ static void dpu_unbind(struct device *dev, struct device *master, void *data) if (dpu_kms->rpm_enabled) pm_runtime_disable(&pdev->dev); - - dev_pm_opp_of_remove_table(dev); - dev_pm_opp_put_clkname(dpu_kms->opp_table); } static const struct component_ops dpu_ops = { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index d6717d6672f7..1483995a94d9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -130,8 +130,6 @@ struct dpu_kms { struct platform_device *pdev; bool rpm_enabled; - struct opp_table *opp_table; - struct dss_module_power mp; /* reference count bandwidth requests, so we know when we can diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index e3462f5d96d7..fdb696ec9d9a 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -77,8 +77,6 @@ struct dp_ctrl_private { struct dp_parser *parser; struct dp_catalog *catalog; - struct opp_table *opp_table; - struct completion idle_comp; struct completion video_comp; }; @@ -1873,6 +1871,7 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, struct dp_parser *parser) { struct dp_ctrl_private *ctrl; + struct opp_table *opp_table; int ret; if (!dev || !panel || !aux || @@ -1887,19 +1886,18 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, return ERR_PTR(-ENOMEM); } - ctrl->opp_table = dev_pm_opp_set_clkname(dev, "ctrl_link"); - if (IS_ERR(ctrl->opp_table)) { + opp_table = devm_pm_opp_set_clkname(dev, "ctrl_link"); + if (IS_ERR(opp_table)) { dev_err(dev, "invalid DP OPP table in device tree\n"); - /* caller do PTR_ERR(ctrl->opp_table) */ - return (struct dp_ctrl *)ctrl->opp_table; + /* caller do PTR_ERR(opp_table) */ + return (struct dp_ctrl *)opp_table; } /* OPP table is optional */ - ret = dev_pm_opp_of_add_table(dev); + ret = devm_pm_opp_of_add_table(dev); if (ret) { dev_err(dev, "failed to add DP OPP table\n"); - dev_pm_opp_put_clkname(ctrl->opp_table); - ctrl->opp_table = NULL; + devm_pm_opp_put_clkname(dev, opp_table); } init_completion(&ctrl->idle_comp); @@ -1916,16 +1914,3 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, return &ctrl->dp_ctrl; } - -void dp_ctrl_put(struct dp_ctrl *dp_ctrl) -{ - struct dp_ctrl_private *ctrl; - - ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); - - if (ctrl->opp_table) { - dev_pm_opp_of_remove_table(ctrl->dev); - dev_pm_opp_put_clkname(ctrl->opp_table); - ctrl->opp_table = NULL; - } -} diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.h b/drivers/gpu/drm/msm/dp/dp_ctrl.h index f60ba93c8678..dcd6bde2b23d 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.h +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.h @@ -31,6 +31,5 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, struct dp_panel *panel, struct drm_dp_aux *aux, struct dp_power *power, struct dp_catalog *catalog, struct dp_parser *parser); -void dp_ctrl_put(struct dp_ctrl *dp_ctrl); #endif /* _DP_CTRL_H_ */ diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 6e971d552911..44c1572e7005 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -706,7 +706,6 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data) static void dp_display_deinit_sub_modules(struct dp_display_private *dp) { dp_debug_put(dp->debug); - dp_ctrl_put(dp->ctrl); dp_panel_put(dp->panel); dp_aux_put(dp->aux); dp_audio_put(dp->audio); @@ -800,13 +799,11 @@ static int dp_init_sub_modules(struct dp_display_private *dp) rc = PTR_ERR(dp->audio); pr_err("failed to initialize audio, rc = %d\n", rc); dp->audio = NULL; - goto error_audio; + goto error_ctrl; } return rc; -error_audio: - dp_ctrl_put(dp->ctrl); error_ctrl: dp_panel_put(dp->panel); error_link: diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index a282307f2799..30c89dd448b9 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -113,8 +113,6 @@ struct msm_dsi_host { struct clk *pixel_clk_src; struct clk *byte_intf_clk; - struct opp_table *opp_table; - u32 byte_clk_rate; u32 pixel_clk_rate; u32 esc_clk_rate; @@ -1822,6 +1820,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) { struct msm_dsi_host *msm_host = NULL; struct platform_device *pdev = msm_dsi->pdev; + struct opp_table *opp_table; int ret; msm_host = devm_kzalloc(&pdev->dev, sizeof(*msm_host), GFP_KERNEL); @@ -1886,13 +1885,13 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) goto fail; } - msm_host->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "byte"); - if (IS_ERR(msm_host->opp_table)) - return PTR_ERR(msm_host->opp_table); + opp_table = devm_pm_opp_set_clkname(&pdev->dev, "byte"); + if (IS_ERR(opp_table)) + return PTR_ERR(opp_table); /* OPP table is optional */ - ret = dev_pm_opp_of_add_table(&pdev->dev); + ret = devm_pm_opp_of_add_table(&pdev->dev); if (ret) { - dev_pm_opp_put_clkname(msm_host->opp_table); + devm_pm_opp_put_clkname(&pdev->dev, opp_table); if (ret != -ENODEV) { dev_err(&pdev->dev, "invalid OPP table in device tree\n"); return ret; @@ -1934,8 +1933,6 @@ void msm_dsi_host_destroy(struct mipi_dsi_host *host) mutex_destroy(&msm_host->cmd_mutex); mutex_destroy(&msm_host->dev_mutex); - dev_pm_opp_of_remove_table(&msm_host->pdev->dev); - dev_pm_opp_put_clkname(msm_host->opp_table); pm_runtime_disable(&msm_host->pdev->dev); } From patchwork Fri Jan 1 16:54:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A93EDC43331 for ; Fri, 1 Jan 2021 17:00:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93067221FE for ; Fri, 1 Jan 2021 17:00:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727441AbhAARAF (ORCPT ); Fri, 1 Jan 2021 12:00:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727433AbhAARAE (ORCPT ); Fri, 1 Jan 2021 12:00:04 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20F84C061757; Fri, 1 Jan 2021 08:59:24 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id i5so14759655pgo.1; Fri, 01 Jan 2021 08:59:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cYbuTbPahXxjzBKxhL5q3gV0giw+VU+SyFZg9kX4GMY=; b=PcGSIVgZm1QkNmbFXTx6HQATJc0uJhNwjGfiUzGg17YjZStOSQVciFoKHkgmRYd3IK g5kkL47cUsAkoxnLSFzDtOVj9vJrCQCw+D4vc4jainD1pt9Y1YsmVihYnVt3nVbOQt0r KFNnDkGQkq2qaZ6q+jNYYAspKa0TrVHIQDRQlf7sz1rP/1hprQRWtzaz1A65MhDNBMdN uGc8WjB41Pp65sQk29saTeHfdD8fyvnoPhE3RxgbpbaDWFGXXyFfQUhnmsZQxNAIyPcm 2CdEKT0iZMzkXVrszFNJLBIWD0Z/VC75teo4dAHjc7HaIElt0YC8qqBC7eos0xAjst1n MyQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cYbuTbPahXxjzBKxhL5q3gV0giw+VU+SyFZg9kX4GMY=; b=eydX1oAUTltjbsPy3/V9nU2dMDNLUk2XMYvofQHF+sNek6j0fGe0uyQZd09CSiVMsm B0Fab7nWvwhkx1g5QtoWxeF+U9k6kU63qin/zFRBT5ZW98VrMIiMP6bIeCHlMGy0w6oj oD7Hedu4xUYeokPhTJJVR56wYrV/8nTaTCsMXXb3f6tkKY3qDrFkcuMm7MXUPCa0gWET CQAqSz8Sz24lkPLhzvXuD+mzaPKjPftN6oRz1ONuzJzyeWfHOklESD7Npod5kalJMv1f qQAor7couHhQRVh+XGUWY+nQZ0WwheV66QguOukHvJEkIH2ypN9ZNUbSGvSvXwKYzFAg aqog== X-Gm-Message-State: AOAM531CFLqMPBMShvVnK1OWoV/I491eekmniz8kG4iGcPsh4XjEkJeQ 50VgGMmfN+2xv3KUZPHOzto= X-Google-Smtp-Source: ABdhPJzBxZnugCfohpOfZRma7u6PqMQpyK3PxPlNGZ20GA0zdzVpl57siWqjfJSY1kSGIemvsTRnQA== X-Received: by 2002:a62:145:0:b029:19e:a395:bd3d with SMTP id 66-20020a6201450000b029019ea395bd3dmr55173035pfb.13.1609520363720; Fri, 01 Jan 2021 08:59:23 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:59:23 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 18/31] drm/lima: remove unneeded devm_devfreq_remove_device() Date: Fri, 1 Jan 2021 16:54:54 +0000 Message-Id: <20210101165507.19486-19-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There is no need to manually release devm related resources. Signed-off-by: Yangtao Li --- drivers/gpu/drm/lima/lima_devfreq.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lima_devfreq.c index d5937cf86504..7690c5c69f9f 100644 --- a/drivers/gpu/drm/lima/lima_devfreq.c +++ b/drivers/gpu/drm/lima/lima_devfreq.c @@ -94,11 +94,6 @@ void lima_devfreq_fini(struct lima_device *ldev) devfreq_cooling_unregister(devfreq->cooling); devfreq->cooling = NULL; } - - if (devfreq->devfreq) { - devm_devfreq_remove_device(ldev->dev, devfreq->devfreq); - devfreq->devfreq = NULL; - } } int lima_devfreq_init(struct lima_device *ldev) From patchwork Fri Jan 1 16:54:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B77D1C4321A for ; Fri, 1 Jan 2021 17:00:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9AB05221FE for ; Fri, 1 Jan 2021 17:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727896AbhAARAa (ORCPT ); Fri, 1 Jan 2021 12:00:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727415AbhAARA3 (ORCPT ); Fri, 1 Jan 2021 12:00:29 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13E8AC061573; Fri, 1 Jan 2021 08:59:49 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id iq13so6293577pjb.3; Fri, 01 Jan 2021 08:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z6qbj8dgzROgh85miZBetCRcFsAMjj4rAUBFqdmQKAI=; b=tzzmbhnLanGifpkaEEuhMbq9nyVrZwGiezeyUg07DWbmSZBnrgr1HBe8d81xxwHD6i knswbUeHIFzwDFLdQ1euU3vIrCOW7O3Lf1Vu9ARrKIBTln9nU3g+tW3tzfBodrhf54Fi JmQRUdnEzTVeqeQofJI3pcqe4UkQ9S0EoMl7OcnNuD+yreAIgJF7RZ+Rk1dKrTUWWnle B6FPquXJVU2OsZqToQJtG7YVZkyPmGvN8Nvo3+Y2AvketrSmeP/DKIEMj5ZzB8+vXCX1 EuCR1SM9D0RjyHf3aAvEQM+/orr9w0z4fuphU2WonoZxfLlH0+g67Qrc8oF+jVZI9M4r ctMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z6qbj8dgzROgh85miZBetCRcFsAMjj4rAUBFqdmQKAI=; b=szutbNbr5Rt8z8HY8JGHSqZBgi/0Sm0GCEkf8fY5pEDGBHsZwsEf05k7rgk4Zg6hVh GR8CTibHR5jRSlyQd+EYHgrfCJ/F0ZaTb0L3pqOiVMaULU+lRq5VfwDl58eUeHO7Bz1a 8hih8nAwjeKJq3DD+fxP6CpaT94iS2APFZmWyEA9yuSIaBqZbl3YBPfpfXEwM2O+9UAg hekhflp+md3QaRWr6SPk0ZYB9ZRWVBplUof+VcsuAxaIasqb7KeSGfQKb/eTHI1mRPfa cBPO80esWTV1M7u/1m0dBLI1kcbrgzrXIeri5k9iPwFSJ1IrmKC3jLXh4RJjHxjPamKK 1itQ== X-Gm-Message-State: AOAM533a06wM5B5y5oOsZ5fPmFePA4p/rs9hZKbaxBrhAv10Ck5RmOdY LTjV2JZXUNedXjDu3iuFwlI= X-Google-Smtp-Source: ABdhPJzvKvhyQq+Adj8RaWYu975XY7J6amI//R0xez2m/CCUIqLkUExovMVLZ9HW3tr1oS8YMg71WQ== X-Received: by 2002:a17:902:eb0c:b029:db:c0d6:6289 with SMTP id l12-20020a170902eb0cb02900dbc0d66289mr62277763plb.12.1609520388641; Fri, 01 Jan 2021 08:59:48 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.08.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 08:59:47 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 20/31] media: venus: fix error check in core_get_v4() Date: Fri, 1 Jan 2021 16:54:56 +0000 Message-Id: <20210101165507.19486-21-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Don't call dev_pm_opp_put_clkname() when got invalid OPP table in device tree, since we do this in core_put_v4(). Signed-off-by: Yangtao Li --- drivers/media/platform/qcom/venus/pm_helpers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index a3850261d697..59cbd6c39450 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -881,8 +881,9 @@ static int core_get_v4(struct device *dev) core->has_opp_table = true; } else if (ret != -ENODEV) { dev_err(dev, "invalid OPP table in device tree\n"); - dev_pm_opp_put_clkname(core->opp_table); return ret; + } else { + dev_pm_opp_put_clkname(core->opp_table); } } From patchwork Fri Jan 1 16:54:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355890 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89B4CC43332 for ; Fri, 1 Jan 2021 17:01:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6BD4422203 for ; Fri, 1 Jan 2021 17:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727933AbhAARAz (ORCPT ); Fri, 1 Jan 2021 12:00:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727929AbhAARAy (ORCPT ); Fri, 1 Jan 2021 12:00:54 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF3BAC061757; Fri, 1 Jan 2021 09:00:13 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id y8so11250880plp.8; Fri, 01 Jan 2021 09:00:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Esa4NiAtIZhtLWaWjJVhH3nVuZJ3eKXT+OiaiAMEdVc=; b=qlYytcJ/2MzwOV3LwrxaUFba/mYHC8CDBvxWd6lCkIkLlNH2mWUlKy84RDYOyqc31F feDOz7mxtwpZ8c+n4J7yHPUmEJscYGljtNpQWCyU/42ErQjS4h3r7u7WizYlfNyAqSh0 HvkrQu7Egge2vU+w97NYle6WTOXuMkTV+bZ2U0c8ZGLof78QQHx49rc96OqBlstiLIgK OfHyKjExDM7ggqTdyGEs1fwAQxKfZRA/34C0Jkxk564+5S48gAmeuvzwmAQTjho2gQwh FlPiuRRvnqA4SkHgM/vAGL1u7cO9vpwSTZ4upa15WNR6gzeFbwCpqoCY2Ve/oXbHLcB/ QLKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Esa4NiAtIZhtLWaWjJVhH3nVuZJ3eKXT+OiaiAMEdVc=; b=t6V1nSNanqfjhsW1yxyYnOFvD0Q66YlkDh1WMSrizpxG4Ho8ZPniIv00uKml0gT1ff fYsKJmdJ6cKCOUFgkutGjA9pEmz77/SJZ2wpbjFqD+PQnoFMs+wpSHofj10V45FTkgqV 5wZyIxq3ZOZHSc4pVQqfQJgmwMdvNAdpW2dP5UR96mNUoE2AtvfGlhxJxuHjAxgFQODP LIu5kshYoHKuaX4skuHd7lhjbKvcUMZf1lfrzEIOo1IxoS88BpcHIbzG3GSB9TGRVtew DpB2epaEAgAbEh9/rrFcRBW26Ocr8uiVHgv6FBKR4KeCKPolg5u387nGrMM92XLuVk0h FK1w== X-Gm-Message-State: AOAM5307DASVezCa4SkhatPSLM/B5LcrvDV7vA+G9gMcvhzkF7IhZKGm dUhRiye1uMTTMRsXI9+k+EU= X-Google-Smtp-Source: ABdhPJz6W2sQQ064VIhfp96RrbKHlDA3l3zB9C+asJD6z4ULlLYD2v0/5Cn/Jk4MSEeNZvNrJlXsqw== X-Received: by 2002:a17:90a:a45:: with SMTP id o63mr18750005pjo.146.1609520413583; Fri, 01 Jan 2021 09:00:13 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.09.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 09:00:12 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 22/31] memory: samsung: exynos5422-dmc: fix return error in exynos5_init_freq_table Date: Fri, 1 Jan 2021 16:54:58 +0000 Message-Id: <20210101165507.19486-23-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We can't always return -EINVAL, let's fix it. Signed-off-by: Yangtao Li --- drivers/memory/samsung/exynos5422-dmc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c index c5ee4121a4d2..62a83633f837 100644 --- a/drivers/memory/samsung/exynos5422-dmc.c +++ b/drivers/memory/samsung/exynos5422-dmc.c @@ -353,16 +353,20 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc, dmc->opp = devm_kmalloc_array(dmc->dev, dmc->opp_count, sizeof(struct dmc_opp_table), GFP_KERNEL); - if (!dmc->opp) + if (!dmc->opp) { + ret = -ENOMEM; goto err_opp; + } idx = dmc->opp_count - 1; for (i = 0, freq = ULONG_MAX; i < dmc->opp_count; i++, freq--) { struct dev_pm_opp *opp; opp = dev_pm_opp_find_freq_floor(dmc->dev, &freq); - if (IS_ERR(opp)) + if (IS_ERR(opp)) { + ret = PTR_ERR(opp); goto err_opp; + } dmc->opp[idx - i].freq_hz = freq; dmc->opp[idx - i].volt_uv = dev_pm_opp_get_voltage(opp); @@ -375,7 +379,7 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc, err_opp: dev_pm_opp_of_remove_table(dmc->dev); - return -EINVAL; + return ret; } /** From patchwork Fri Jan 1 16:55:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 355889 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82EC3C43603 for ; Fri, 1 Jan 2021 17:01:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5531A221F2 for ; Fri, 1 Jan 2021 17:01:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727138AbhAARBU (ORCPT ); Fri, 1 Jan 2021 12:01:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbhAARBT (ORCPT ); Fri, 1 Jan 2021 12:01:19 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F7E8C061573; Fri, 1 Jan 2021 09:00:39 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id v1so6300300pjr.2; Fri, 01 Jan 2021 09:00:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8tu+qmTBn19dJ5gPJsn24LjDSvHBfNF8Z6WeRyPnF0o=; b=mtSShWOVItM7MqI3Ko7jFbYK4A8hl8pYqozq5KjocZVA23lW9QNonT8PJHA8dcPpTT hLP9GVa6SmvfValVy1c405ZwzEV0OL2w8EJvYuIXLPZD3567ExhOEf1QTA05xlhKsnlM CdAiTFViPyb7B88OR5kDre0PQPAl/MVnvcCHw2erWjrZtZCkqQKVwutd47duJlNxQSIX uE9ZZYKMgni5Z5Oli1DM/qZA/Gbmg0iVW/cWOXgZWa4M4npQ6m2tKmWgL7TKn2N2Nsdv uQY1BK6fWL6j/nVNJ+loYM+pc2TfwSMBKRZoWz+r9WXKAB71He02AHNrxbpUVW0AoF6S 4B5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8tu+qmTBn19dJ5gPJsn24LjDSvHBfNF8Z6WeRyPnF0o=; b=DVy5D/1FDfbWfqMXee4TjcnLts6uV8rwFOvxTMTmFhni7bU2z/pOAdyGjzXQa5XE7Q 5Tuj8mL8zWmyZF3d6B8RZOJIBc2nbFsm2+vps32ufUXCosy9HN9LRCgNXDfVzSSmQm0G o+S5UiVoa/Hkp/9eOyDsLdwBX28pRX6qRxN2wQsm5vCP46T03Y0OCQ6PS5OYQ1fHaDjc gZdfWelmhW5LUswTOK8/JIxzAPFq2Avrl2wFbtfJFIAIDH8vhkyLn6k6/Ij6y7yY875b YPKjb3oihatGA0UPQXGRHsf79OIWN5oJDnCyoe6aAfFqNWbpA4hCzVtMafExNd3u6zj5 QOcQ== X-Gm-Message-State: AOAM531Ad2yEZTxTxDtEf4y3ZXxDucpau4mCTGCd4YPoy22yFFcTyS85 0OYdEOo/XY/qBirFHi/37Mc= X-Google-Smtp-Source: ABdhPJxdcJSkAjLz7kwVtZIMVT7S93VrpqFpUMA6/+FN8KvXEJO8cvrLmP3NDvFgN9RfnewK7jzAFg== X-Received: by 2002:a17:90b:46ca:: with SMTP id jx10mr18760999pjb.208.1609520438671; Fri, 01 Jan 2021 09:00:38 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id 84sm50002729pfy.9.2021.01.01.09.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jan 2021 09:00:38 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 24/31] memory: tegra20: convert to use devm_pm_opp_* API Date: Fri, 1 Jan 2021 16:55:00 +0000 Message-Id: <20210101165507.19486-25-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210101165507.19486-1-tiny.windzz@gmail.com> References: <20210101165507.19486-1-tiny.windzz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use devm_pm_opp_* API to simplify code. Signed-off-by: Yangtao Li --- drivers/memory/tegra/tegra20-emc.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c index 686aaf477d8a..223d9d97eb8f 100644 --- a/drivers/memory/tegra/tegra20-emc.c +++ b/drivers/memory/tegra/tegra20-emc.c @@ -911,31 +911,31 @@ static int tegra_emc_interconnect_init(struct tegra_emc *emc) static int tegra_emc_opp_table_init(struct tegra_emc *emc) { u32 hw_version = BIT(tegra_sku_info.soc_process_id); - struct opp_table *clk_opp_table, *hw_opp_table; + struct opp_table *opp_table; int err; - clk_opp_table = dev_pm_opp_set_clkname(emc->dev, NULL); - err = PTR_ERR_OR_ZERO(clk_opp_table); + opp_table = devm_pm_opp_set_clkname(emc->dev, NULL); + err = PTR_ERR_OR_ZERO(opp_table); if (err) { dev_err(emc->dev, "failed to set OPP clk: %d\n", err); return err; } - hw_opp_table = dev_pm_opp_set_supported_hw(emc->dev, &hw_version, 1); - err = PTR_ERR_OR_ZERO(hw_opp_table); + opp_table = devm_pm_opp_set_supported_hw(emc->dev, &hw_version, 1); + err = PTR_ERR_OR_ZERO(opp_table); if (err) { dev_err(emc->dev, "failed to set OPP supported HW: %d\n", err); - goto put_clk_table; + return err; } - err = dev_pm_opp_of_add_table(emc->dev); + err = devm_pm_opp_of_add_table(emc->dev); if (err) { if (err == -ENODEV) dev_err(emc->dev, "OPP table not found, please update your device tree\n"); else dev_err(emc->dev, "failed to add OPP table: %d\n", err); - goto put_hw_table; + return err; } dev_info(emc->dev, "OPP HW ver. 0x%x, current clock rate %lu MHz\n", @@ -943,19 +943,8 @@ static int tegra_emc_opp_table_init(struct tegra_emc *emc) /* first dummy rate-set initializes voltage state */ err = dev_pm_opp_set_rate(emc->dev, clk_get_rate(emc->clk)); - if (err) { + if (err) dev_err(emc->dev, "failed to initialize OPP clock: %d\n", err); - goto remove_table; - } - - return 0; - -remove_table: - dev_pm_opp_of_remove_table(emc->dev); -put_hw_table: - dev_pm_opp_put_supported_hw(hw_opp_table); -put_clk_table: - dev_pm_opp_put_clkname(clk_opp_table); return err; }