From 4a4774bc0a5e9be248aa2b91941602f1b91b5f35 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Fri, 23 Jun 2023 15:05:53 -0700 Subject: [PATCH] tegra: hwpm: fix bug in hwpm unregister Currently, both register and unregister calls to HWPM continue to mark IP to be available. Fix this bug by updating tegra_hwpm_record_ip_ops() to accept IP "available" as boolean argument. Jira THWPM-8 Change-Id: I5a80ffa7ff20c1dc94528f20fd760a4f09721910 Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2925492 Reviewed-by: Vasuki Shankar Reviewed-by: Seema Khowala GVS: Gerrit_Virtual_Submit --- drivers/tegra/hwpm/os/linux/ip_utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tegra/hwpm/os/linux/ip_utils.c b/drivers/tegra/hwpm/os/linux/ip_utils.c index 1d1b8a7..9c01b8d 100644 --- a/drivers/tegra/hwpm/os/linux/ip_utils.c +++ b/drivers/tegra/hwpm/os/linux/ip_utils.c @@ -232,7 +232,7 @@ int tegra_hwpm_obtain_resource_info(struct tegra_soc_hwpm *hwpm, } static int tegra_hwpm_record_ip_ops(struct tegra_soc_hwpm *hwpm, - struct tegra_soc_hwpm_ip_ops *soc_ip_ops) + struct tegra_soc_hwpm_ip_ops *soc_ip_ops, bool available) { struct tegra_hwpm_ip_ops ip_ops; @@ -252,7 +252,7 @@ static int tegra_hwpm_record_ip_ops(struct tegra_soc_hwpm *hwpm, tegra_hwpm_translate_soc_hwpm_resource(hwpm, (enum tegra_soc_hwpm_resource)soc_ip_ops->resource_enum), soc_ip_ops->ip_base_address, - &ip_ops, true); + &ip_ops, available); } int tegra_hwpm_complete_ip_register_impl(struct tegra_soc_hwpm *hwpm) @@ -263,7 +263,7 @@ int tegra_hwpm_complete_ip_register_impl(struct tegra_soc_hwpm *hwpm) tegra_hwpm_fn(hwpm, " "); while (node != NULL) { - ret = tegra_hwpm_record_ip_ops(hwpm, &node->ip_ops); + ret = tegra_hwpm_record_ip_ops(hwpm, &node->ip_ops, REGISTER_IP); if (ret != 0) { tegra_hwpm_err(hwpm, "Resource enum %d extract IP ops failed", @@ -360,7 +360,7 @@ void tegra_soc_hwpm_ip_register(struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops) tegra_hwpm_dbg(hwpm, hwpm_info | hwpm_dbg_ip_register, "Register IP 0x%llx", hwpm_ip_ops->ip_base_address); - ret = tegra_hwpm_record_ip_ops(hwpm, hwpm_ip_ops); + ret = tegra_hwpm_record_ip_ops(hwpm, hwpm_ip_ops, REGISTER_IP); if (ret < 0) { tegra_hwpm_err(hwpm, "Failed to set IP ops for IP %d", hwpm_ip_ops->resource_enum); @@ -392,7 +392,7 @@ void tegra_soc_hwpm_ip_unregister(struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops) tegra_hwpm_dbg(hwpm, hwpm_info | hwpm_dbg_ip_register, "Unregister IP 0x%llx", hwpm_ip_ops->ip_base_address); - ret = tegra_hwpm_record_ip_ops(hwpm, hwpm_ip_ops); + ret = tegra_hwpm_record_ip_ops(hwpm, hwpm_ip_ops, UNREGISTER_IP); if (ret < 0) { tegra_hwpm_err(hwpm, "Failed to reset IP ops for IP %d", hwpm_ip_ops->resource_enum);