Re: [PATCH 1/1] PCI/ASPM: Remove pcie_aspm_enabled() unnecessary locking

Bjorn Helgaas
2019-10-10T16:14:22Z

On Thu, Oct 10, 2019 at 04:01:21PM +0200, Christoph Hellwig wrote:
> On Thu, Oct 10, 2019 at 07:47:46AM -0500, Bjorn Helgaas wrote:
> > + return bridge->link_state ? !!bridge->link_state->aspm_enabled : false;
>
> Can we unobsfucated this while we're at it?
>
> if (!bridge->link_state)
> return false;
> return bridge->link_state->aspm_enabled;

Yep, after some of the follow-up patches from Heiner, it looks like
this:

bool pcie_aspm_enabled(struct pci_dev *pdev)
{
struct pcie_link_state *link = pcie_aspm_get_link(pdev);

if (!link)
return false;

return link->aspm_enabled;
}