Message ID | 20220906222351.64760-7-helgaas@kernel.org |
---|---|
State | New |
Headers | show |
Series | PCI/PM: Always disable PTM for all devices during suspend | expand |
On Tue, Sep 06, 2022 at 05:23:47PM -0500, Bjorn Helgaas wrote: > From: Bjorn Helgaas <bhelgaas@google.com> > > Implement pci_enable_ptm() as a wrapper around an internal > __pci_enable_ptm() that we can use during resume to enable PTM without > emitting log messages. > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > --- > drivers/pci/pcie/ptm.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c > index 762299984469..4a9f045126ca 100644 > --- a/drivers/pci/pcie/ptm.c > +++ b/drivers/pci/pcie/ptm.c > @@ -152,7 +152,7 @@ void pci_ptm_init(struct pci_dev *dev) > pci_enable_ptm(dev, NULL); > } > > -int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) > +static int __pci_enable_ptm(struct pci_dev *dev) > { > int ptm = dev->ptm_cap; > struct pci_dev *ups; > @@ -177,6 +177,17 @@ int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) > ctrl |= PCI_PTM_CTRL_ROOT; > > pci_write_config_dword(dev, ptm + PCI_PTM_CTRL, ctrl); > + return 0; > +} > + Same comment here about kernel-doc. > +int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) > +{ > + int rc; > + > + rc = __pci_enable_ptm(dev); > + if (rc) > + return rc; > + > dev->ptm_enabled = 1; > > pci_ptm_info(dev); > -- > 2.25.1
On 9/6/22 3:23 PM, Bjorn Helgaas wrote: > From: Bjorn Helgaas <bhelgaas@google.com> > > Implement pci_enable_ptm() as a wrapper around an internal > __pci_enable_ptm() that we can use during resume to enable PTM without > emitting log messages. Also add a note about not updating ptm_enabled in __pci_enable_ptm() > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > --- > drivers/pci/pcie/ptm.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c > index 762299984469..4a9f045126ca 100644 > --- a/drivers/pci/pcie/ptm.c > +++ b/drivers/pci/pcie/ptm.c > @@ -152,7 +152,7 @@ void pci_ptm_init(struct pci_dev *dev) > pci_enable_ptm(dev, NULL); > } > > -int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) > +static int __pci_enable_ptm(struct pci_dev *dev) > { > int ptm = dev->ptm_cap; > struct pci_dev *ups; > @@ -177,6 +177,17 @@ int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) > ctrl |= PCI_PTM_CTRL_ROOT; > > pci_write_config_dword(dev, ptm + PCI_PTM_CTRL, ctrl); > + return 0; > +} > + > +int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) > +{ > + int rc; > + > + rc = __pci_enable_ptm(dev); > + if (rc) > + return rc; > + > dev->ptm_enabled = 1; > > pci_ptm_info(dev);
diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c index 762299984469..4a9f045126ca 100644 --- a/drivers/pci/pcie/ptm.c +++ b/drivers/pci/pcie/ptm.c @@ -152,7 +152,7 @@ void pci_ptm_init(struct pci_dev *dev) pci_enable_ptm(dev, NULL); } -int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) +static int __pci_enable_ptm(struct pci_dev *dev) { int ptm = dev->ptm_cap; struct pci_dev *ups; @@ -177,6 +177,17 @@ int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) ctrl |= PCI_PTM_CTRL_ROOT; pci_write_config_dword(dev, ptm + PCI_PTM_CTRL, ctrl); + return 0; +} + +int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) +{ + int rc; + + rc = __pci_enable_ptm(dev); + if (rc) + return rc; + dev->ptm_enabled = 1; pci_ptm_info(dev);