| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2005-2007 Jiri Slaby <jirislaby@gmail.com> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 6 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | | - * (at your option) any later version. |
|---|
| 8 | 4 | * |
|---|
| 9 | 5 | * You need a userspace library to cooperate with this driver. It (and other |
|---|
| 10 | 6 | * info) may be obtained here: |
|---|
| .. | .. |
|---|
| 461 | 457 | pci_disable_device(pdev); |
|---|
| 462 | 458 | } |
|---|
| 463 | 459 | |
|---|
| 464 | | -#ifdef CONFIG_PM |
|---|
| 465 | | -static int phantom_suspend(struct pci_dev *pdev, pm_message_t state) |
|---|
| 460 | +static int __maybe_unused phantom_suspend(struct device *dev_d) |
|---|
| 466 | 461 | { |
|---|
| 467 | | - struct phantom_device *dev = pci_get_drvdata(pdev); |
|---|
| 462 | + struct phantom_device *dev = dev_get_drvdata(dev_d); |
|---|
| 468 | 463 | |
|---|
| 469 | 464 | iowrite32(0, dev->caddr + PHN_IRQCTL); |
|---|
| 470 | 465 | ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */ |
|---|
| 471 | 466 | |
|---|
| 472 | | - synchronize_irq(pdev->irq); |
|---|
| 467 | + synchronize_irq(to_pci_dev(dev_d)->irq); |
|---|
| 473 | 468 | |
|---|
| 474 | 469 | return 0; |
|---|
| 475 | 470 | } |
|---|
| 476 | 471 | |
|---|
| 477 | | -static int phantom_resume(struct pci_dev *pdev) |
|---|
| 472 | +static int __maybe_unused phantom_resume(struct device *dev_d) |
|---|
| 478 | 473 | { |
|---|
| 479 | | - struct phantom_device *dev = pci_get_drvdata(pdev); |
|---|
| 474 | + struct phantom_device *dev = dev_get_drvdata(dev_d); |
|---|
| 480 | 475 | |
|---|
| 481 | 476 | iowrite32(0, dev->caddr + PHN_IRQCTL); |
|---|
| 482 | 477 | |
|---|
| 483 | 478 | return 0; |
|---|
| 484 | 479 | } |
|---|
| 485 | | -#else |
|---|
| 486 | | -#define phantom_suspend NULL |
|---|
| 487 | | -#define phantom_resume NULL |
|---|
| 488 | | -#endif |
|---|
| 489 | 480 | |
|---|
| 490 | 481 | static struct pci_device_id phantom_pci_tbl[] = { |
|---|
| 491 | 482 | { .vendor = PCI_VENDOR_ID_PLX, .device = PCI_DEVICE_ID_PLX_9050, |
|---|
| .. | .. |
|---|
| 495 | 486 | }; |
|---|
| 496 | 487 | MODULE_DEVICE_TABLE(pci, phantom_pci_tbl); |
|---|
| 497 | 488 | |
|---|
| 489 | +static SIMPLE_DEV_PM_OPS(phantom_pm_ops, phantom_suspend, phantom_resume); |
|---|
| 490 | + |
|---|
| 498 | 491 | static struct pci_driver phantom_pci_driver = { |
|---|
| 499 | 492 | .name = "phantom", |
|---|
| 500 | 493 | .id_table = phantom_pci_tbl, |
|---|
| 501 | 494 | .probe = phantom_probe, |
|---|
| 502 | 495 | .remove = phantom_remove, |
|---|
| 503 | | - .suspend = phantom_suspend, |
|---|
| 504 | | - .resume = phantom_resume |
|---|
| 496 | + .driver.pm = &phantom_pm_ops, |
|---|
| 505 | 497 | }; |
|---|
| 506 | 498 | |
|---|
| 507 | 499 | static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION); |
|---|