OpenCloudOS-Kernel/drivers/net/ethernet/3com
Vaibhav Gupta 7b46681cf4 typhoon: 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:
typhoon_resume() calls typhoon_wakeup() which then calls PCI helper
functions pci_set_power_state() and pci_restore_state(). The only other
function, using typhoon_wakeup() is typhoon_open().

Thus remove the pci_*() calls from tyhpoon_wakeup() and place them in
typhoon_open(), maintaining the order, to retain the normal behavior of
the function

Now, typhoon_suspend() calls typhoon_sleep() which then calls PCI helper
functions pci_enable_wake(), pci_disable_device() and
pci_set_power_state(). Other functions:
 - typhoon_open()
 - typhoon_close()
 - typhoon_init_one()
are also invoking typhoon_sleep(). Thus, in this case, cannot simply
move PCI helper functions call.

Hence, define a new function typhoon_sleep_early() which will do all the
operations, which typhoon_sleep() was doing before calling PCI helper
functions. Now typhoon_sleep() will call typhoon_sleep_early() to do
those tasks, hence, the behavior for _open(), _close and _init_one() remain
unchanged. And typhon_suspend() only requires typhoon_sleep_early().

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-01 12:58:33 -07:00
..
3c59x.c docs: networking: reorganize driver documentation again 2020-06-26 16:08:44 -07:00
3c509.c drivers: Remove inclusion of vermagic header 2020-04-21 13:27:37 -07:00
3c515.c drivers: Remove inclusion of vermagic header 2020-04-21 13:27:37 -07:00
3c574_cs.c netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
3c589_cs.c net/3com: Delete driver and module versions from 3com drivers 2020-02-24 11:23:36 -08:00
Kconfig docs: networking: reorganize driver documentation again 2020-06-26 16:08:44 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
typhoon.c typhoon: use generic power management 2020-07-01 12:58:33 -07:00
typhoon.h net: typhoon: Add required whitespace after keywords 2020-03-23 22:10:28 -07:00