Skip to content

Commit d7e445f

Browse files
hkallweitSeth Forshee
authored andcommitted
PCI/ASPM: Remove PCIEASPM_DEBUG Kconfig option and related code
BguLink: https://bugs.launchpad.net/bugs/1836030 Previously, CONFIG_PCIEASPM_DEBUG enabled "link_state" and "clk_ctl" sysfs files that controlled ASPM. We believe these files were rarely if ever used. We recently added sysfs ASPM controls that are always present, so the debug code is no longer needed. Removing this debug code has been discussed for quite some time, see e.g. [0]. Remove PCIEASPM_DEBUG and the related code. [0] https://lore.kernel.org/lkml/20180727202619.GD173328@bhelgaas-glaptop.roam.corp.google.com/ Link: https://lore.kernel.org/r/ec935d8e-c084-3938-f1d1-748617596b25@gmail.com Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> (cherry picked from commit 87e9028) Signed-off-by: AceLan Kao <acelan.kao@canonical.com> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
1 parent b5364e6 commit d7e445f

File tree

4 files changed

+0
-123
lines changed

4 files changed

+0
-123
lines changed

drivers/pci/pci-sysfs.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,6 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev)
13301330
int retval;
13311331

13321332
pcie_vpd_create_sysfs_dev_files(dev);
1333-
pcie_aspm_create_sysfs_dev_files(dev);
13341333

13351334
if (dev->reset_fn) {
13361335
retval = device_create_file(&dev->dev, &dev_attr_reset);
@@ -1340,7 +1339,6 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev)
13401339
return 0;
13411340

13421341
error:
1343-
pcie_aspm_remove_sysfs_dev_files(dev);
13441342
pcie_vpd_remove_sysfs_dev_files(dev);
13451343
return retval;
13461344
}
@@ -1416,7 +1414,6 @@ int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev)
14161414
static void pci_remove_capabilities_sysfs(struct pci_dev *dev)
14171415
{
14181416
pcie_vpd_remove_sysfs_dev_files(dev);
1419-
pcie_aspm_remove_sysfs_dev_files(dev);
14201417
if (dev->reset_fn) {
14211418
device_remove_file(&dev->dev, &dev_attr_reset);
14221419
dev->reset_fn = 0;

drivers/pci/pci.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,14 +545,6 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) { }
545545
static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { }
546546
#endif
547547

548-
#ifdef CONFIG_PCIEASPM_DEBUG
549-
void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev);
550-
void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev);
551-
#else
552-
static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) { }
553-
static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) { }
554-
#endif
555-
556548
#ifdef CONFIG_PCIE_ECRC
557549
void pcie_set_ecrc_checking(struct pci_dev *dev);
558550
void pcie_ecrc_get_policy(char *str);

drivers/pci/pcie/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,6 @@ config PCIEASPM
7979

8080
When in doubt, say Y.
8181

82-
config PCIEASPM_DEBUG
83-
bool "Debug PCI Express ASPM"
84-
depends on PCIEASPM
85-
help
86-
This enables PCI Express ASPM debug support. It will add per-device
87-
interface to control ASPM.
88-
8982
choice
9083
prompt "Default ASPM policy"
9184
default PCIEASPM_DEFAULT

drivers/pci/pcie/aspm.c

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,111 +1218,6 @@ bool pcie_aspm_enabled(struct pci_dev *pdev)
12181218
}
12191219
EXPORT_SYMBOL_GPL(pcie_aspm_enabled);
12201220

1221-
#ifdef CONFIG_PCIEASPM_DEBUG
1222-
static ssize_t link_state_show(struct device *dev,
1223-
struct device_attribute *attr,
1224-
char *buf)
1225-
{
1226-
struct pci_dev *pci_device = to_pci_dev(dev);
1227-
struct pcie_link_state *link_state = pci_device->link_state;
1228-
1229-
return sprintf(buf, "%d\n", link_state->aspm_enabled);
1230-
}
1231-
1232-
static ssize_t link_state_store(struct device *dev,
1233-
struct device_attribute *attr,
1234-
const char *buf,
1235-
size_t n)
1236-
{
1237-
struct pci_dev *pdev = to_pci_dev(dev);
1238-
struct pcie_link_state *link, *root = pdev->link_state->root;
1239-
u32 state;
1240-
1241-
if (aspm_disabled)
1242-
return -EPERM;
1243-
1244-
if (kstrtouint(buf, 10, &state))
1245-
return -EINVAL;
1246-
if ((state & ~ASPM_STATE_ALL) != 0)
1247-
return -EINVAL;
1248-
1249-
down_read(&pci_bus_sem);
1250-
mutex_lock(&aspm_lock);
1251-
list_for_each_entry(link, &link_list, sibling) {
1252-
if (link->root != root)
1253-
continue;
1254-
pcie_config_aspm_link(link, state);
1255-
}
1256-
mutex_unlock(&aspm_lock);
1257-
up_read(&pci_bus_sem);
1258-
return n;
1259-
}
1260-
1261-
static ssize_t clk_ctl_show(struct device *dev,
1262-
struct device_attribute *attr,
1263-
char *buf)
1264-
{
1265-
struct pci_dev *pci_device = to_pci_dev(dev);
1266-
struct pcie_link_state *link_state = pci_device->link_state;
1267-
1268-
return sprintf(buf, "%d\n", link_state->clkpm_enabled);
1269-
}
1270-
1271-
static ssize_t clk_ctl_store(struct device *dev,
1272-
struct device_attribute *attr,
1273-
const char *buf,
1274-
size_t n)
1275-
{
1276-
struct pci_dev *pdev = to_pci_dev(dev);
1277-
bool state;
1278-
1279-
if (strtobool(buf, &state))
1280-
return -EINVAL;
1281-
1282-
down_read(&pci_bus_sem);
1283-
mutex_lock(&aspm_lock);
1284-
pcie_set_clkpm_nocheck(pdev->link_state, state);
1285-
mutex_unlock(&aspm_lock);
1286-
up_read(&pci_bus_sem);
1287-
1288-
return n;
1289-
}
1290-
1291-
static DEVICE_ATTR_RW(link_state);
1292-
static DEVICE_ATTR_RW(clk_ctl);
1293-
1294-
static char power_group[] = "power";
1295-
void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
1296-
{
1297-
struct pcie_link_state *link_state = pdev->link_state;
1298-
1299-
if (!link_state)
1300-
return;
1301-
1302-
if (link_state->aspm_support)
1303-
sysfs_add_file_to_group(&pdev->dev.kobj,
1304-
&dev_attr_link_state.attr, power_group);
1305-
if (link_state->clkpm_capable)
1306-
sysfs_add_file_to_group(&pdev->dev.kobj,
1307-
&dev_attr_clk_ctl.attr, power_group);
1308-
}
1309-
1310-
void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
1311-
{
1312-
struct pcie_link_state *link_state = pdev->link_state;
1313-
1314-
if (!link_state)
1315-
return;
1316-
1317-
if (link_state->aspm_support)
1318-
sysfs_remove_file_from_group(&pdev->dev.kobj,
1319-
&dev_attr_link_state.attr, power_group);
1320-
if (link_state->clkpm_capable)
1321-
sysfs_remove_file_from_group(&pdev->dev.kobj,
1322-
&dev_attr_clk_ctl.attr, power_group);
1323-
}
1324-
#endif
1325-
13261221
static ssize_t aspm_attr_show_common(struct device *dev,
13271222
struct device_attribute *attr,
13281223
char *buf, u8 state)

0 commit comments

Comments
 (0)