@@ -507,11 +507,9 @@ static inline int pci_iov_bus_range(struct pci_bus *bus)
#ifdef CONFIG_PCIE_PTM
void pci_save_ptm_state(struct pci_dev *dev);
void pci_restore_ptm_state(struct pci_dev *dev);
-void pci_disable_ptm(struct pci_dev *dev);
#else
static inline void pci_save_ptm_state(struct pci_dev *dev) { }
static inline void pci_restore_ptm_state(struct pci_dev *dev) { }
-static inline void pci_disable_ptm(struct pci_dev *dev) { }
#endif
unsigned long pci_cardbus_resource_alignment(struct resource *);
@@ -29,7 +29,7 @@ static void pci_ptm_info(struct pci_dev *dev)
dev->ptm_root ? " (root)" : "", clock_desc);
}
-void pci_disable_ptm(struct pci_dev *dev)
+static void __pci_disable_ptm(struct pci_dev *dev)
{
int ptm = dev->ptm_cap;
u16 ctrl;
@@ -42,6 +42,13 @@ void pci_disable_ptm(struct pci_dev *dev)
pci_write_config_word(dev, ptm + PCI_PTM_CTRL, ctrl);
}
+void pci_disable_ptm(struct pci_dev *dev)
+{
+ __pci_disable_ptm(dev);
+ dev->ptm_enabled = 0;
+}
+EXPORT_SYMBOL(pci_disable_ptm);
+
void pci_save_ptm_state(struct pci_dev *dev)
{
int ptm = dev->ptm_cap;
@@ -1678,10 +1678,12 @@ bool pci_ats_disabled(void);
#ifdef CONFIG_PCIE_PTM
int pci_enable_ptm(struct pci_dev *dev, u8 *granularity);
+void pci_disable_ptm(struct pci_dev *dev);
bool pcie_ptm_enabled(struct pci_dev *dev);
#else
static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
{ return -EINVAL; }
+static inline void pci_disable_ptm(struct pci_dev *dev) { }
static inline bool pcie_ptm_enabled(struct pci_dev *dev)
{ return false; }
#endif