On Sat, Oct 05, 2019 at 02:07:56PM +0200, Heiner Kallweit wrote: > Background of this extension is a problem with the r8169 network driver. > Several combinations of board chipsets and network chip versions have > problems if ASPM is enabled, therefore we have to disable ASPM per default. > However especially on notebooks ASPM can provide significant power-saving, > therefore we want to give users the option to enable ASPM. With the new > sysfs attributes users can control which ASPM link-states are > enabled/disabled. > > Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx> > +static ssize_t aspm_attr_show_common(struct device *dev, > + struct device_attribute *attr, > + char *buf, u8 state) > +{ > + struct pci_dev *pdev = to_pci_dev(dev); > + struct pcie_link_state *link; > + bool enabled; > + > + link = pcie_aspm_get_link(pdev); > + > + mutex_lock(&aspm_lock); > + enabled = link->aspm_enabled & state; > + mutex_unlock(&aspm_lock); Not sure the mutex is needed; do you have a reason, or is it just copied from existing code? If the latter, we can just wait to see what Rafael says. > + return sprintf(buf, "%d\n", enabled ? 1 : 0); > +}