netxen_nic: use generic power management
authorVaibhav Gupta <vaibhavgupta40@gmail.com>
Thu, 2 Jul 2020 17:01:42 +0000 (22:31 +0530)
committerDavid S. Miller <davem@davemloft.net>
Sun, 5 Jul 2020 01:02:06 +0000 (18:02 -0700)
commit063ad9bcc297c1f4cfd3a35a6a709b3fd52031f3
tree36b3ecdf511cf5e5fe1f36e860d321484857f31d
parentb20a6b29a811bee0e44b64958d415eb50436154c
netxen_nic: use generic power management

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: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c