hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/xen/platform-pci.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /******************************************************************************
23 * platform-pci.c
34 *
....@@ -8,20 +9,6 @@
89 * Copyright (c) 2005, Intel Corporation.
910 * Copyright (c) 2007, XenSource Inc.
1011 * Copyright (c) 2010, Citrix
11
- *
12
- * This program is free software; you can redistribute it and/or modify it
13
- * under the terms and conditions of the GNU General Public License,
14
- * version 2, as published by the Free Software Foundation.
15
- *
16
- * This program is distributed in the hope it will be useful, but WITHOUT
17
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19
- * more details.
20
- *
21
- * You should have received a copy of the GNU General Public License along with
22
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23
- * Place - Suite 330, Boston, MA 02111-1307 USA.
24
- *
2512 */
2613
2714
....@@ -87,7 +74,7 @@
8774 "xen-platform-pci", pdev);
8875 }
8976
90
-static int platform_pci_resume(struct pci_dev *pdev)
77
+static int platform_pci_resume(struct device *dev)
9178 {
9279 int err;
9380
....@@ -96,7 +83,7 @@
9683
9784 err = xen_set_callback_via(callback_via);
9885 if (err) {
99
- dev_err(&pdev->dev, "platform_pci_resume failure!\n");
86
+ dev_err(dev, "platform_pci_resume failure!\n");
10087 return err;
10188 }
10289 return 0;
....@@ -150,7 +137,7 @@
150137 if (ret) {
151138 dev_warn(&pdev->dev, "Unable to set the evtchn callback "
152139 "err=%d\n", ret);
153
- goto out;
140
+ goto irq_out;
154141 }
155142 }
156143
....@@ -158,13 +145,16 @@
158145 grant_frames = alloc_xen_mmio(PAGE_SIZE * max_nr_gframes);
159146 ret = gnttab_setup_auto_xlat_frames(grant_frames);
160147 if (ret)
161
- goto out;
148
+ goto irq_out;
162149 ret = gnttab_init();
163150 if (ret)
164151 goto grant_out;
165152 return 0;
166153 grant_out:
167154 gnttab_free_auto_xlat_frames();
155
+irq_out:
156
+ if (!xen_have_vector_callback)
157
+ free_irq(pdev->irq, pdev);
168158 out:
169159 pci_release_region(pdev, 0);
170160 mem_out:
....@@ -180,13 +170,17 @@
180170 {0,}
181171 };
182172
173
+static const struct dev_pm_ops platform_pm_ops = {
174
+ .resume_noirq = platform_pci_resume,
175
+};
176
+
183177 static struct pci_driver platform_driver = {
184178 .name = DRV_NAME,
185179 .probe = platform_pci_probe,
186180 .id_table = platform_pci_tbl,
187
-#ifdef CONFIG_PM
188
- .resume_early = platform_pci_resume,
189
-#endif
181
+ .driver = {
182
+ .pm = &platform_pm_ops,
183
+ },
190184 };
191185
192186 builtin_pci_driver(platform_driver);