forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/ptp/ptp_pch.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * PTP 1588 clock using the EG20T PCH
34 *
....@@ -5,19 +6,6 @@
56 * Copyright (C) 2011-2012 LAPIS SEMICONDUCTOR Co., LTD.
67 *
78 * This code was derived from the IXP46X driver.
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; version 2 of the License.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
219 */
2210
2311 #include <linux/device.h>
....@@ -520,40 +508,8 @@
520508 .enable = ptp_pch_enable,
521509 };
522510
523
-
524
-#ifdef CONFIG_PM
525
-static s32 pch_suspend(struct pci_dev *pdev, pm_message_t state)
526
-{
527
- pci_disable_device(pdev);
528
- pci_enable_wake(pdev, PCI_D3hot, 0);
529
-
530
- if (pci_save_state(pdev) != 0) {
531
- dev_err(&pdev->dev, "could not save PCI config state\n");
532
- return -ENOMEM;
533
- }
534
- pci_set_power_state(pdev, pci_choose_state(pdev, state));
535
-
536
- return 0;
537
-}
538
-
539
-static s32 pch_resume(struct pci_dev *pdev)
540
-{
541
- s32 ret;
542
-
543
- pci_set_power_state(pdev, PCI_D0);
544
- pci_restore_state(pdev);
545
- ret = pci_enable_device(pdev);
546
- if (ret) {
547
- dev_err(&pdev->dev, "pci_enable_device failed\n");
548
- return ret;
549
- }
550
- pci_enable_wake(pdev, PCI_D3hot, 0);
551
- return 0;
552
-}
553
-#else
554511 #define pch_suspend NULL
555512 #define pch_resume NULL
556
-#endif
557513
558514 static void pch_remove(struct pci_dev *pdev)
559515 {
....@@ -697,13 +653,14 @@
697653 };
698654 MODULE_DEVICE_TABLE(pci, pch_ieee1588_pcidev_id);
699655
656
+static SIMPLE_DEV_PM_OPS(pch_pm_ops, pch_suspend, pch_resume);
657
+
700658 static struct pci_driver pch_driver = {
701659 .name = KBUILD_MODNAME,
702660 .id_table = pch_ieee1588_pcidev_id,
703661 .probe = pch_probe,
704662 .remove = pch_remove,
705
- .suspend = pch_suspend,
706
- .resume = pch_resume,
663
+ .driver.pm = &pch_pm_ops,
707664 };
708665
709666 static void __exit ptp_pch_exit(void)