• Vaibhav Gupta's avatar
    sis-agp: convert to generic power management · 6d1adc3d
    Vaibhav Gupta authored
    Convert sis-agp from legacy PCI power management to the generic power
    management framework.
    
    Previously, sis-agp used legacy PCI power management, and agp_sis_suspend()
    and agp_sis_resume() were responsible for both device-specific things and
    generic PCI things:
    
      agp_sis_suspend
        pci_save_state(pdev)                <-- generic PCI
        pci_set_power_state(pdev, pci_choose_state(pdev, state)) <-- generic PCI
    
      agp_sis_resume
        pci_set_power_state(pdev, PCI_D0)   <-- generic PCI
        pci_restore_state(pdev)             <-- generic PCI
        sis_driver.configure()              <-- device-specific
    
    With generic power management, the PCI bus PM methods do the generic PCI
    things, and the driver needs only the device-specific part, i.e.,
    
      suspend_devices_and_enter
        dpm_suspend_start(PMSG_SUSPEND)
          pci_pm_suspend                    # PCI bus .suspend() method
            agp_sis_suspend                 <-- not needed at all; removed
        suspend_enter
          dpm_suspend_noirq(PMSG_SUSPEND)
            pci_pm_suspend_noirq            # PCI bus .suspend_noirq() method
              pci_save_state                <-- generic PCI
              pci_prepare_to_sleep          <-- generic PCI
                pci_set_power_state
        ...
        dpm_resume_end(PMSG_RESUME)
          pci_pm_resume                     # PCI bus .resume() method
            pci_restore_standard_config
              pci_set_power_state(PCI_D0)   <-- generic PCI
              pci_restore_state             <-- generic PCI
            agp_sis_resume                  # dev->driver->pm->resume
              sis_driver.configure()        <-- device-specific
    
    [bhelgaas: commit log]
    Link: https://lore.kernel.org/r/20211208193305.147072-3-helgaas@kernel.orgSigned-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    Acked-by: default avatarDave Airlie <airlied@redhat.com>
    6d1adc3d
sis-agp.c 10.9 KB