]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
soc/tegra: pmc: Populate powergate debugfs only when needed
authorJon Hunter <jonathanh@nvidia.com>
Fri, 22 May 2026 15:58:24 +0000 (16:58 +0100)
committerThierry Reding <treding@nvidia.com>
Sun, 31 May 2026 05:21:14 +0000 (07:21 +0200)
The 'powergate' debugfs node is used to show the state of the powergates
but for some devices the 'num_powergates' is 0 and so it displays
nothing. Therefore, only populate this debugfs entry for devices where
num_powergates is greater than 0.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/soc/tegra/pmc.c

index da60e7e5927df110cbb1e4e52ef998f92eda091b..d4edf701a40f1bd941c38f3fce508eb1b3bda6cb 100644 (file)
@@ -3160,7 +3160,8 @@ static int tegra_pmc_probe(struct platform_device *pdev)
        if (pmc->soc->set_wake_filters)
                pmc->soc->set_wake_filters(pmc);
 
-       debugfs_create_file("powergate", 0444, NULL, pmc, &powergate_fops);
+       if (pmc->soc->num_powergates)
+               debugfs_create_file("powergate", 0444, NULL, pmc, &powergate_fops);
 
        return 0;