hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/misc/phantom.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * 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.
84 *
95 * You need a userspace library to cooperate with this driver. It (and other
106 * info) may be obtained here:
....@@ -461,31 +457,26 @@
461457 pci_disable_device(pdev);
462458 }
463459
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)
466461 {
467
- struct phantom_device *dev = pci_get_drvdata(pdev);
462
+ struct phantom_device *dev = dev_get_drvdata(dev_d);
468463
469464 iowrite32(0, dev->caddr + PHN_IRQCTL);
470465 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
471466
472
- synchronize_irq(pdev->irq);
467
+ synchronize_irq(to_pci_dev(dev_d)->irq);
473468
474469 return 0;
475470 }
476471
477
-static int phantom_resume(struct pci_dev *pdev)
472
+static int __maybe_unused phantom_resume(struct device *dev_d)
478473 {
479
- struct phantom_device *dev = pci_get_drvdata(pdev);
474
+ struct phantom_device *dev = dev_get_drvdata(dev_d);
480475
481476 iowrite32(0, dev->caddr + PHN_IRQCTL);
482477
483478 return 0;
484479 }
485
-#else
486
-#define phantom_suspend NULL
487
-#define phantom_resume NULL
488
-#endif
489480
490481 static struct pci_device_id phantom_pci_tbl[] = {
491482 { .vendor = PCI_VENDOR_ID_PLX, .device = PCI_DEVICE_ID_PLX_9050,
....@@ -495,13 +486,14 @@
495486 };
496487 MODULE_DEVICE_TABLE(pci, phantom_pci_tbl);
497488
489
+static SIMPLE_DEV_PM_OPS(phantom_pm_ops, phantom_suspend, phantom_resume);
490
+
498491 static struct pci_driver phantom_pci_driver = {
499492 .name = "phantom",
500493 .id_table = phantom_pci_tbl,
501494 .probe = phantom_probe,
502495 .remove = phantom_remove,
503
- .suspend = phantom_suspend,
504
- .resume = phantom_resume
496
+ .driver.pm = &phantom_pm_ops,
505497 };
506498
507499 static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION);