.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | #define PRISM2_PCI |
---|
2 | 3 | |
---|
3 | 4 | /* Host AP driver's support for Intersil Prism2.5 PCI cards is based on |
---|
.. | .. |
---|
402 | 403 | pci_disable_device(pdev); |
---|
403 | 404 | } |
---|
404 | 405 | |
---|
405 | | - |
---|
406 | | -#ifdef CONFIG_PM |
---|
407 | | -static int prism2_pci_suspend(struct pci_dev *pdev, pm_message_t state) |
---|
| 406 | +static int __maybe_unused prism2_pci_suspend(struct device *dev_d) |
---|
408 | 407 | { |
---|
409 | | - struct net_device *dev = pci_get_drvdata(pdev); |
---|
| 408 | + struct net_device *dev = dev_get_drvdata(dev_d); |
---|
410 | 409 | |
---|
411 | 410 | if (netif_running(dev)) { |
---|
412 | 411 | netif_stop_queue(dev); |
---|
413 | 412 | netif_device_detach(dev); |
---|
414 | 413 | } |
---|
415 | 414 | prism2_suspend(dev); |
---|
416 | | - pci_save_state(pdev); |
---|
417 | | - pci_disable_device(pdev); |
---|
418 | | - pci_set_power_state(pdev, PCI_D3hot); |
---|
419 | 415 | |
---|
420 | 416 | return 0; |
---|
421 | 417 | } |
---|
422 | 418 | |
---|
423 | | -static int prism2_pci_resume(struct pci_dev *pdev) |
---|
| 419 | +static int __maybe_unused prism2_pci_resume(struct device *dev_d) |
---|
424 | 420 | { |
---|
425 | | - struct net_device *dev = pci_get_drvdata(pdev); |
---|
426 | | - int err; |
---|
| 421 | + struct net_device *dev = dev_get_drvdata(dev_d); |
---|
427 | 422 | |
---|
428 | | - err = pci_enable_device(pdev); |
---|
429 | | - if (err) { |
---|
430 | | - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", |
---|
431 | | - dev->name); |
---|
432 | | - return err; |
---|
433 | | - } |
---|
434 | | - pci_restore_state(pdev); |
---|
435 | 423 | prism2_hw_config(dev, 0); |
---|
436 | 424 | if (netif_running(dev)) { |
---|
437 | 425 | netif_device_attach(dev); |
---|
.. | .. |
---|
440 | 428 | |
---|
441 | 429 | return 0; |
---|
442 | 430 | } |
---|
443 | | -#endif /* CONFIG_PM */ |
---|
444 | | - |
---|
445 | 431 | |
---|
446 | 432 | MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); |
---|
| 433 | + |
---|
| 434 | +static SIMPLE_DEV_PM_OPS(prism2_pci_pm_ops, |
---|
| 435 | + prism2_pci_suspend, |
---|
| 436 | + prism2_pci_resume); |
---|
447 | 437 | |
---|
448 | 438 | static struct pci_driver prism2_pci_driver = { |
---|
449 | 439 | .name = "hostap_pci", |
---|
450 | 440 | .id_table = prism2_pci_id_table, |
---|
451 | 441 | .probe = prism2_pci_probe, |
---|
452 | 442 | .remove = prism2_pci_remove, |
---|
453 | | -#ifdef CONFIG_PM |
---|
454 | | - .suspend = prism2_pci_suspend, |
---|
455 | | - .resume = prism2_pci_resume, |
---|
456 | | -#endif /* CONFIG_PM */ |
---|
| 443 | + .driver.pm = &prism2_pci_pm_ops, |
---|
457 | 444 | }; |
---|
458 | 445 | |
---|
459 | 446 | module_pci_driver(prism2_pci_driver); |
---|