Skip to content

Commit ed798ff

Browse files
Hans ZhangMani-Sadhasivam
authored andcommitted
PCI: tegra194: Create debugfs directory only when CONFIG_PCIEASPM is enabled
Previously, the debugfs directory was unconditionally created in tegra_pcie_config_rp() regardless of the CONFIG_PCIEASPM setting. This led to unnecessary directory creation when ASPM support was disabled since only ASPM state count was exposed through debugfs. Hence, move the debugfs directory creation into init_debugfs() which is conditionally compiled based on CONFIG_PCIEASPM. This ensures that both the directory and 'aspm_state_cnt' entry are only created when ASPM is enabled and avoids cluttering debugfs with empty directories when ASPM is disabled. Signed-off-by: Hans Zhang <[email protected]> [mani: subject and description change] Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Christophe JAILLET <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 0af2f6b commit ed798ff

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

drivers/pci/controller/dwc/pcie-tegra194.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,16 @@ static void init_host_aspm(struct tegra_pcie_dw *pcie)
713713

714714
static void init_debugfs(struct tegra_pcie_dw *pcie)
715715
{
716-
debugfs_create_devm_seqfile(pcie->dev, "aspm_state_cnt", pcie->debugfs,
716+
struct device *dev = pcie->dev;
717+
char *name;
718+
719+
name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
720+
if (!name)
721+
return;
722+
723+
pcie->debugfs = debugfs_create_dir(name, NULL);
724+
725+
debugfs_create_devm_seqfile(dev, "aspm_state_cnt", pcie->debugfs,
717726
aspm_state_cnt);
718727
}
719728
#else
@@ -1634,7 +1643,6 @@ static void tegra_pcie_deinit_controller(struct tegra_pcie_dw *pcie)
16341643
static int tegra_pcie_config_rp(struct tegra_pcie_dw *pcie)
16351644
{
16361645
struct device *dev = pcie->dev;
1637-
char *name;
16381646
int ret;
16391647

16401648
pm_runtime_enable(dev);
@@ -1664,13 +1672,6 @@ static int tegra_pcie_config_rp(struct tegra_pcie_dw *pcie)
16641672
goto fail_host_init;
16651673
}
16661674

1667-
name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
1668-
if (!name) {
1669-
ret = -ENOMEM;
1670-
goto fail_host_init;
1671-
}
1672-
1673-
pcie->debugfs = debugfs_create_dir(name, NULL);
16741675
init_debugfs(pcie);
16751676

16761677
return ret;

0 commit comments

Comments
 (0)