• Vaibhav Gupta's avatar
    netxen_nic: use generic power management · 063ad9bc
    Vaibhav Gupta authored
    With legacy PM, drivers themselves were responsible for managing the
    device's power states and takes care of register states. And they use PCI
    helper functions to do it.
    
    After upgrading to the generic structure, PCI core will take care of
    required tasks and drivers should do only device-specific operations.
    
    In this driver:
    netxen_nic_resume() calls netxen_nic_attach_func() which then invokes PCI
    helper functions like pci_enable_device(), pci_set_power_state() and
    pci_restore_state(). Other function:
     - netxen_io_slot_reset()
    also calls netxen_nic_attach_func().
    
    Also, netxen_io_slot_reset() returns specific value based on the return value
    of netxen_nic_attach_func() as whole. Thus, cannot simply move some piece of
    code from netxen_nic_attach_func() to it.
    
    Hence, define a new function netxen_nic_attach_late_func() to do the tasks
    which has to be done after PCI helper functions have done their job.
    
    Now, netxen_nic_attach_func() invokes netxen_nic_attach_late_func(), thus
    netxen_io_slot_reset() behaves normally.
    And, netxen_nic_resume() calls netxen_nic_attach_late_func() to avoid PCI
    helper functions calls.
    
    Compile-tested only.
    Signed-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    063ad9bc
netxen_nic_main.c 82.5 KB